feature-toggle-api 4.1.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -16
- package/dist/feature-toggle.js +227 -385
- package/dist/feature-toggle.js.map +1 -0
- package/dist/featureToggle.d.ts +3 -0
- package/dist/html-plugin.js +42 -0
- package/dist/html-plugin.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/plugins/htmlplugin/plugin-html.d.ts +15 -0
- package/dist/plugins/urlplugin/plugin-url.d.ts +14 -0
- package/{src/types.ts → dist/types.d.ts} +44 -64
- package/dist/url-plugin.js +40 -0
- package/dist/url-plugin.js.map +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +26 -11
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
- package/dist/feature-toggle.d.ts +0 -130
- package/dist/feature-toggle.min.cjs +0 -2
- package/dist/feature-toggle.min.cjs.map +0 -1
- package/dist/feature-toggle.min.js +0 -2
- package/dist/feature-toggle.min.js.map +0 -1
- package/dist/feature-toggle.umd.min.js +0 -2
- package/dist/feature-toggle.umd.min.js.map +0 -1
- package/dist/html-plugin.umd.min.js +0 -2
- package/dist/html-plugin.umd.min.js.map +0 -1
- package/dist/url-plugin.umd.min.js +0 -2
- package/dist/url-plugin.umd.min.js.map +0 -1
- package/docs/_config.yml +0 -1
- package/docs/example-intro.html +0 -75
- package/docs/example-setup.html +0 -55
- package/docs/example-visibility-basic.html +0 -144
- package/docs/readme.md +0 -628
- package/docs/vue-feature-toggle.min.js +0 -902
- package/examples/01_basic_esmodule.js +0 -10
- package/examples/02_basic_cjsmodule.cjs +0 -6
- package/examples/03_basic_scripttag.html +0 -24
- package/examples/04_example-htmlplugin.html +0 -35
- package/examples/05_example-urlplugin.html +0 -25
- package/examples/06_withListener.html +0 -21
- package/rollup.config.js +0 -107
- package/src/featureToggle.ts +0 -352
- package/src/index.ts +0 -13
- package/src/plugins/htmlplugin/plugin-html.ts +0 -83
- package/src/plugins/htmlplugin/readme.md +0 -221
- package/src/plugins/urlplugin/plugin-url.ts +0 -90
- package/src/plugins/urlplugin/readme.md +0 -92
- package/tests/featuretoggle.test.ts +0 -450
- package/tests/polyfills.ts +0 -20
- package/tsconfig.cjs.json +0 -12
- package/tsconfig.json +0 -12
|
@@ -1,902 +0,0 @@
|
|
|
1
|
-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.vueFeatureToggle = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
2
|
-
;(function(root, factory) { // eslint-disable-line no-extra-semi
|
|
3
|
-
var deepDiff = factory(root);
|
|
4
|
-
// eslint-disable-next-line no-undef
|
|
5
|
-
if (typeof define === 'function' && define.amd) {
|
|
6
|
-
// AMD
|
|
7
|
-
define('DeepDiff', function() { // eslint-disable-line no-undef
|
|
8
|
-
return deepDiff;
|
|
9
|
-
});
|
|
10
|
-
} else if (typeof exports === 'object' || typeof navigator === 'object' && navigator.product.match(/ReactNative/i)) {
|
|
11
|
-
// Node.js or ReactNative
|
|
12
|
-
module.exports = deepDiff;
|
|
13
|
-
} else {
|
|
14
|
-
// Browser globals
|
|
15
|
-
var _deepdiff = root.DeepDiff;
|
|
16
|
-
deepDiff.noConflict = function() {
|
|
17
|
-
if (root.DeepDiff === deepDiff) {
|
|
18
|
-
root.DeepDiff = _deepdiff;
|
|
19
|
-
}
|
|
20
|
-
return deepDiff;
|
|
21
|
-
};
|
|
22
|
-
root.DeepDiff = deepDiff;
|
|
23
|
-
}
|
|
24
|
-
}(this, function(root) {
|
|
25
|
-
var validKinds = ['N', 'E', 'A', 'D'];
|
|
26
|
-
|
|
27
|
-
// nodejs compatible on server side and in the browser.
|
|
28
|
-
function inherits(ctor, superCtor) {
|
|
29
|
-
ctor.super_ = superCtor;
|
|
30
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
31
|
-
constructor: {
|
|
32
|
-
value: ctor,
|
|
33
|
-
enumerable: false,
|
|
34
|
-
writable: true,
|
|
35
|
-
configurable: true
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function Diff(kind, path) {
|
|
41
|
-
Object.defineProperty(this, 'kind', {
|
|
42
|
-
value: kind,
|
|
43
|
-
enumerable: true
|
|
44
|
-
});
|
|
45
|
-
if (path && path.length) {
|
|
46
|
-
Object.defineProperty(this, 'path', {
|
|
47
|
-
value: path,
|
|
48
|
-
enumerable: true
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function DiffEdit(path, origin, value) {
|
|
54
|
-
DiffEdit.super_.call(this, 'E', path);
|
|
55
|
-
Object.defineProperty(this, 'lhs', {
|
|
56
|
-
value: origin,
|
|
57
|
-
enumerable: true
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(this, 'rhs', {
|
|
60
|
-
value: value,
|
|
61
|
-
enumerable: true
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
inherits(DiffEdit, Diff);
|
|
65
|
-
|
|
66
|
-
function DiffNew(path, value) {
|
|
67
|
-
DiffNew.super_.call(this, 'N', path);
|
|
68
|
-
Object.defineProperty(this, 'rhs', {
|
|
69
|
-
value: value,
|
|
70
|
-
enumerable: true
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
inherits(DiffNew, Diff);
|
|
74
|
-
|
|
75
|
-
function DiffDeleted(path, value) {
|
|
76
|
-
DiffDeleted.super_.call(this, 'D', path);
|
|
77
|
-
Object.defineProperty(this, 'lhs', {
|
|
78
|
-
value: value,
|
|
79
|
-
enumerable: true
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
inherits(DiffDeleted, Diff);
|
|
83
|
-
|
|
84
|
-
function DiffArray(path, index, item) {
|
|
85
|
-
DiffArray.super_.call(this, 'A', path);
|
|
86
|
-
Object.defineProperty(this, 'index', {
|
|
87
|
-
value: index,
|
|
88
|
-
enumerable: true
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(this, 'item', {
|
|
91
|
-
value: item,
|
|
92
|
-
enumerable: true
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
inherits(DiffArray, Diff);
|
|
96
|
-
|
|
97
|
-
function arrayRemove(arr, from, to) {
|
|
98
|
-
var rest = arr.slice((to || from) + 1 || arr.length);
|
|
99
|
-
arr.length = from < 0 ? arr.length + from : from;
|
|
100
|
-
arr.push.apply(arr, rest);
|
|
101
|
-
return arr;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function realTypeOf(subject) {
|
|
105
|
-
var type = typeof subject;
|
|
106
|
-
if (type !== 'object') {
|
|
107
|
-
return type;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (subject === Math) {
|
|
111
|
-
return 'math';
|
|
112
|
-
} else if (subject === null) {
|
|
113
|
-
return 'null';
|
|
114
|
-
} else if (Array.isArray(subject)) {
|
|
115
|
-
return 'array';
|
|
116
|
-
} else if (Object.prototype.toString.call(subject) === '[object Date]') {
|
|
117
|
-
return 'date';
|
|
118
|
-
} else if (typeof subject.toString === 'function' && /^\/.*\//.test(subject.toString())) {
|
|
119
|
-
return 'regexp';
|
|
120
|
-
}
|
|
121
|
-
return 'object';
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
|
|
125
|
-
function hashThisString(string) {
|
|
126
|
-
var hash = 0;
|
|
127
|
-
if (string.length === 0) { return hash; }
|
|
128
|
-
for (var i = 0; i < string.length; i++) {
|
|
129
|
-
var char = string.charCodeAt(i);
|
|
130
|
-
hash = ((hash << 5) - hash) + char;
|
|
131
|
-
hash = hash & hash; // Convert to 32bit integer
|
|
132
|
-
}
|
|
133
|
-
return hash;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Gets a hash of the given object in an array order-independent fashion
|
|
137
|
-
// also object key order independent (easier since they can be alphabetized)
|
|
138
|
-
function getOrderIndependentHash(object) {
|
|
139
|
-
var accum = 0;
|
|
140
|
-
var type = realTypeOf(object);
|
|
141
|
-
|
|
142
|
-
if (type === 'array') {
|
|
143
|
-
object.forEach(function (item) {
|
|
144
|
-
// Addition is commutative so this is order indep
|
|
145
|
-
accum += getOrderIndependentHash(item);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
var arrayString = '[type: array, hash: ' + accum + ']';
|
|
149
|
-
return accum + hashThisString(arrayString);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (type === 'object') {
|
|
153
|
-
for (var key in object) {
|
|
154
|
-
if (object.hasOwnProperty(key)) {
|
|
155
|
-
var keyValueString = '[ type: object, key: ' + key + ', value hash: ' + getOrderIndependentHash(object[key]) + ']';
|
|
156
|
-
accum += hashThisString(keyValueString);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return accum;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Non object, non array...should be good?
|
|
164
|
-
var stringToHash = '[ type: ' + type + ' ; value: ' + object + ']';
|
|
165
|
-
return accum + hashThisString(stringToHash);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function deepDiff(lhs, rhs, changes, prefilter, path, key, stack, orderIndependent) {
|
|
169
|
-
changes = changes || [];
|
|
170
|
-
path = path || [];
|
|
171
|
-
stack = stack || [];
|
|
172
|
-
var currentPath = path.slice(0);
|
|
173
|
-
if (typeof key !== 'undefined' && key !== null) {
|
|
174
|
-
if (prefilter) {
|
|
175
|
-
if (typeof (prefilter) === 'function' && prefilter(currentPath, key)) {
|
|
176
|
-
return;
|
|
177
|
-
} else if (typeof (prefilter) === 'object') {
|
|
178
|
-
if (prefilter.prefilter && prefilter.prefilter(currentPath, key)) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
if (prefilter.normalize) {
|
|
182
|
-
var alt = prefilter.normalize(currentPath, key, lhs, rhs);
|
|
183
|
-
if (alt) {
|
|
184
|
-
lhs = alt[0];
|
|
185
|
-
rhs = alt[1];
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
currentPath.push(key);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Use string comparison for regexes
|
|
194
|
-
if (realTypeOf(lhs) === 'regexp' && realTypeOf(rhs) === 'regexp') {
|
|
195
|
-
lhs = lhs.toString();
|
|
196
|
-
rhs = rhs.toString();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
var ltype = typeof lhs;
|
|
200
|
-
var rtype = typeof rhs;
|
|
201
|
-
var i, j, k, other;
|
|
202
|
-
|
|
203
|
-
var ldefined = ltype !== 'undefined' ||
|
|
204
|
-
(stack && (stack.length > 0) && stack[stack.length - 1].lhs &&
|
|
205
|
-
Object.getOwnPropertyDescriptor(stack[stack.length - 1].lhs, key));
|
|
206
|
-
var rdefined = rtype !== 'undefined' ||
|
|
207
|
-
(stack && (stack.length > 0) && stack[stack.length - 1].rhs &&
|
|
208
|
-
Object.getOwnPropertyDescriptor(stack[stack.length - 1].rhs, key));
|
|
209
|
-
|
|
210
|
-
if (!ldefined && rdefined) {
|
|
211
|
-
changes.push(new DiffNew(currentPath, rhs));
|
|
212
|
-
} else if (!rdefined && ldefined) {
|
|
213
|
-
changes.push(new DiffDeleted(currentPath, lhs));
|
|
214
|
-
} else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
|
|
215
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
216
|
-
} else if (realTypeOf(lhs) === 'date' && (lhs - rhs) !== 0) {
|
|
217
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
218
|
-
} else if (ltype === 'object' && lhs !== null && rhs !== null) {
|
|
219
|
-
for (i = stack.length - 1; i > -1; --i) {
|
|
220
|
-
if (stack[i].lhs === lhs) {
|
|
221
|
-
other = true;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (!other) {
|
|
226
|
-
stack.push({ lhs: lhs, rhs: rhs });
|
|
227
|
-
if (Array.isArray(lhs)) {
|
|
228
|
-
// If order doesn't matter, we need to sort our arrays
|
|
229
|
-
if (orderIndependent) {
|
|
230
|
-
lhs.sort(function (a, b) {
|
|
231
|
-
return getOrderIndependentHash(a) - getOrderIndependentHash(b);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
rhs.sort(function (a, b) {
|
|
235
|
-
return getOrderIndependentHash(a) - getOrderIndependentHash(b);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
i = rhs.length - 1;
|
|
239
|
-
j = lhs.length - 1;
|
|
240
|
-
while (i > j) {
|
|
241
|
-
changes.push(new DiffArray(currentPath, i, new DiffNew(undefined, rhs[i--])));
|
|
242
|
-
}
|
|
243
|
-
while (j > i) {
|
|
244
|
-
changes.push(new DiffArray(currentPath, j, new DiffDeleted(undefined, lhs[j--])));
|
|
245
|
-
}
|
|
246
|
-
for (; i >= 0; --i) {
|
|
247
|
-
deepDiff(lhs[i], rhs[i], changes, prefilter, currentPath, i, stack, orderIndependent);
|
|
248
|
-
}
|
|
249
|
-
} else {
|
|
250
|
-
var akeys = Object.keys(lhs);
|
|
251
|
-
var pkeys = Object.keys(rhs);
|
|
252
|
-
for (i = 0; i < akeys.length; ++i) {
|
|
253
|
-
k = akeys[i];
|
|
254
|
-
other = pkeys.indexOf(k);
|
|
255
|
-
if (other >= 0) {
|
|
256
|
-
deepDiff(lhs[k], rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
257
|
-
pkeys[other] = null;
|
|
258
|
-
} else {
|
|
259
|
-
deepDiff(lhs[k], undefined, changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
for (i = 0; i < pkeys.length; ++i) {
|
|
263
|
-
k = pkeys[i];
|
|
264
|
-
if (k) {
|
|
265
|
-
deepDiff(undefined, rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
stack.length = stack.length - 1;
|
|
270
|
-
} else if (lhs !== rhs) {
|
|
271
|
-
// lhs is contains a cycle at this element and it differs from rhs
|
|
272
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
273
|
-
}
|
|
274
|
-
} else if (lhs !== rhs) {
|
|
275
|
-
if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
|
|
276
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function observableDiff(lhs, rhs, observer, prefilter, orderIndependent) {
|
|
282
|
-
var changes = [];
|
|
283
|
-
deepDiff(lhs, rhs, changes, prefilter, null, null, null, orderIndependent);
|
|
284
|
-
if (observer) {
|
|
285
|
-
for (var i = 0; i < changes.length; ++i) {
|
|
286
|
-
observer(changes[i]);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return changes;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function orderIndependentDeepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
|
|
293
|
-
return deepDiff(lhs, rhs, changes, prefilter, path, key, stack, true);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function accumulateDiff(lhs, rhs, prefilter, accum) {
|
|
297
|
-
var observer = (accum) ?
|
|
298
|
-
function (difference) {
|
|
299
|
-
if (difference) {
|
|
300
|
-
accum.push(difference);
|
|
301
|
-
}
|
|
302
|
-
} : undefined;
|
|
303
|
-
var changes = observableDiff(lhs, rhs, observer, prefilter);
|
|
304
|
-
return (accum) ? accum : (changes.length) ? changes : undefined;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function accumulateOrderIndependentDiff(lhs, rhs, prefilter, accum) {
|
|
308
|
-
var observer = (accum) ?
|
|
309
|
-
function (difference) {
|
|
310
|
-
if (difference) {
|
|
311
|
-
accum.push(difference);
|
|
312
|
-
}
|
|
313
|
-
} : undefined;
|
|
314
|
-
var changes = observableDiff(lhs, rhs, observer, prefilter, true);
|
|
315
|
-
return (accum) ? accum : (changes.length) ? changes : undefined;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function applyArrayChange(arr, index, change) {
|
|
319
|
-
if (change.path && change.path.length) {
|
|
320
|
-
var it = arr[index],
|
|
321
|
-
i, u = change.path.length - 1;
|
|
322
|
-
for (i = 0; i < u; i++) {
|
|
323
|
-
it = it[change.path[i]];
|
|
324
|
-
}
|
|
325
|
-
switch (change.kind) {
|
|
326
|
-
case 'A':
|
|
327
|
-
applyArrayChange(it[change.path[i]], change.index, change.item);
|
|
328
|
-
break;
|
|
329
|
-
case 'D':
|
|
330
|
-
delete it[change.path[i]];
|
|
331
|
-
break;
|
|
332
|
-
case 'E':
|
|
333
|
-
case 'N':
|
|
334
|
-
it[change.path[i]] = change.rhs;
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
} else {
|
|
338
|
-
switch (change.kind) {
|
|
339
|
-
case 'A':
|
|
340
|
-
applyArrayChange(arr[index], change.index, change.item);
|
|
341
|
-
break;
|
|
342
|
-
case 'D':
|
|
343
|
-
arr = arrayRemove(arr, index);
|
|
344
|
-
break;
|
|
345
|
-
case 'E':
|
|
346
|
-
case 'N':
|
|
347
|
-
arr[index] = change.rhs;
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
return arr;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
function applyChange(target, source, change) {
|
|
355
|
-
if (typeof change === 'undefined' && source && ~validKinds.indexOf(source.kind)) {
|
|
356
|
-
change = source;
|
|
357
|
-
}
|
|
358
|
-
if (target && change && change.kind) {
|
|
359
|
-
var it = target,
|
|
360
|
-
i = -1,
|
|
361
|
-
last = change.path ? change.path.length - 1 : 0;
|
|
362
|
-
while (++i < last) {
|
|
363
|
-
if (typeof it[change.path[i]] === 'undefined') {
|
|
364
|
-
it[change.path[i]] = (typeof change.path[i + 1] !== 'undefined' && typeof change.path[i + 1] === 'number') ? [] : {};
|
|
365
|
-
}
|
|
366
|
-
it = it[change.path[i]];
|
|
367
|
-
}
|
|
368
|
-
switch (change.kind) {
|
|
369
|
-
case 'A':
|
|
370
|
-
if (change.path && typeof it[change.path[i]] === 'undefined') {
|
|
371
|
-
it[change.path[i]] = [];
|
|
372
|
-
}
|
|
373
|
-
applyArrayChange(change.path ? it[change.path[i]] : it, change.index, change.item);
|
|
374
|
-
break;
|
|
375
|
-
case 'D':
|
|
376
|
-
delete it[change.path[i]];
|
|
377
|
-
break;
|
|
378
|
-
case 'E':
|
|
379
|
-
case 'N':
|
|
380
|
-
it[change.path[i]] = change.rhs;
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function revertArrayChange(arr, index, change) {
|
|
387
|
-
if (change.path && change.path.length) {
|
|
388
|
-
// the structure of the object at the index has changed...
|
|
389
|
-
var it = arr[index],
|
|
390
|
-
i, u = change.path.length - 1;
|
|
391
|
-
for (i = 0; i < u; i++) {
|
|
392
|
-
it = it[change.path[i]];
|
|
393
|
-
}
|
|
394
|
-
switch (change.kind) {
|
|
395
|
-
case 'A':
|
|
396
|
-
revertArrayChange(it[change.path[i]], change.index, change.item);
|
|
397
|
-
break;
|
|
398
|
-
case 'D':
|
|
399
|
-
it[change.path[i]] = change.lhs;
|
|
400
|
-
break;
|
|
401
|
-
case 'E':
|
|
402
|
-
it[change.path[i]] = change.lhs;
|
|
403
|
-
break;
|
|
404
|
-
case 'N':
|
|
405
|
-
delete it[change.path[i]];
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
|
-
} else {
|
|
409
|
-
// the array item is different...
|
|
410
|
-
switch (change.kind) {
|
|
411
|
-
case 'A':
|
|
412
|
-
revertArrayChange(arr[index], change.index, change.item);
|
|
413
|
-
break;
|
|
414
|
-
case 'D':
|
|
415
|
-
arr[index] = change.lhs;
|
|
416
|
-
break;
|
|
417
|
-
case 'E':
|
|
418
|
-
arr[index] = change.lhs;
|
|
419
|
-
break;
|
|
420
|
-
case 'N':
|
|
421
|
-
arr = arrayRemove(arr, index);
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
return arr;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
function revertChange(target, source, change) {
|
|
429
|
-
if (target && source && change && change.kind) {
|
|
430
|
-
var it = target,
|
|
431
|
-
i, u;
|
|
432
|
-
u = change.path.length - 1;
|
|
433
|
-
for (i = 0; i < u; i++) {
|
|
434
|
-
if (typeof it[change.path[i]] === 'undefined') {
|
|
435
|
-
it[change.path[i]] = {};
|
|
436
|
-
}
|
|
437
|
-
it = it[change.path[i]];
|
|
438
|
-
}
|
|
439
|
-
switch (change.kind) {
|
|
440
|
-
case 'A':
|
|
441
|
-
// Array was modified...
|
|
442
|
-
// it will be an array...
|
|
443
|
-
revertArrayChange(it[change.path[i]], change.index, change.item);
|
|
444
|
-
break;
|
|
445
|
-
case 'D':
|
|
446
|
-
// Item was deleted...
|
|
447
|
-
it[change.path[i]] = change.lhs;
|
|
448
|
-
break;
|
|
449
|
-
case 'E':
|
|
450
|
-
// Item was edited...
|
|
451
|
-
it[change.path[i]] = change.lhs;
|
|
452
|
-
break;
|
|
453
|
-
case 'N':
|
|
454
|
-
// Item is new...
|
|
455
|
-
delete it[change.path[i]];
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
function applyDiff(target, source, filter) {
|
|
462
|
-
if (target && source) {
|
|
463
|
-
var onChange = function (change) {
|
|
464
|
-
if (!filter || filter(target, source, change)) {
|
|
465
|
-
applyChange(target, source, change);
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
observableDiff(target, source, onChange);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
Object.defineProperties(accumulateDiff, {
|
|
473
|
-
|
|
474
|
-
diff: {
|
|
475
|
-
value: accumulateDiff,
|
|
476
|
-
enumerable: true
|
|
477
|
-
},
|
|
478
|
-
orderIndependentDiff: {
|
|
479
|
-
value: accumulateOrderIndependentDiff,
|
|
480
|
-
enumerable: true
|
|
481
|
-
},
|
|
482
|
-
observableDiff: {
|
|
483
|
-
value: observableDiff,
|
|
484
|
-
enumerable: true
|
|
485
|
-
},
|
|
486
|
-
orderIndependentObservableDiff: {
|
|
487
|
-
value: orderIndependentDeepDiff,
|
|
488
|
-
enumerable: true
|
|
489
|
-
},
|
|
490
|
-
orderIndepHash: {
|
|
491
|
-
value: getOrderIndependentHash,
|
|
492
|
-
enumerable: true
|
|
493
|
-
},
|
|
494
|
-
applyDiff: {
|
|
495
|
-
value: applyDiff,
|
|
496
|
-
enumerable: true
|
|
497
|
-
},
|
|
498
|
-
applyChange: {
|
|
499
|
-
value: applyChange,
|
|
500
|
-
enumerable: true
|
|
501
|
-
},
|
|
502
|
-
revertChange: {
|
|
503
|
-
value: revertChange,
|
|
504
|
-
enumerable: true
|
|
505
|
-
},
|
|
506
|
-
isConflict: {
|
|
507
|
-
value: function () {
|
|
508
|
-
return typeof $conflict !== 'undefined';
|
|
509
|
-
},
|
|
510
|
-
enumerable: true
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
// hackish...
|
|
515
|
-
accumulateDiff.DeepDiff = accumulateDiff;
|
|
516
|
-
// ...but works with:
|
|
517
|
-
// import DeepDiff from 'deep-diff'
|
|
518
|
-
// import { DeepDiff } from 'deep-diff'
|
|
519
|
-
// const DeepDiff = require('deep-diff');
|
|
520
|
-
// const { DeepDiff } = require('deep-diff');
|
|
521
|
-
|
|
522
|
-
if (root) {
|
|
523
|
-
root.DeepDiff = accumulateDiff;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
return accumulateDiff;
|
|
527
|
-
}));
|
|
528
|
-
|
|
529
|
-
},{}],2:[function(require,module,exports){
|
|
530
|
-
'use strict';
|
|
531
|
-
|
|
532
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
533
|
-
|
|
534
|
-
var parseToFn = function parseToFn(fnOrBool) {
|
|
535
|
-
if (typeof fnOrBool == 'boolean') return function () {
|
|
536
|
-
return fnOrBool;
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
return fnOrBool;
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
function initVisibilities() {
|
|
543
|
-
var visibilities = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
544
|
-
|
|
545
|
-
var returnVisibilities = {};
|
|
546
|
-
Object.keys(visibilities).forEach(function (key) {
|
|
547
|
-
if (key.startsWith('_')) return;
|
|
548
|
-
returnVisibilities[key] = parseToFn(visibilities[key]);
|
|
549
|
-
});
|
|
550
|
-
return returnVisibilities;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
function featuretoggleapi() {
|
|
554
|
-
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
var globals = {
|
|
558
|
-
datas: {},
|
|
559
|
-
listeners: {},
|
|
560
|
-
visibilities: initVisibilities(config),
|
|
561
|
-
showLogs: false,
|
|
562
|
-
usedPlugins: []
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
function init(api) {
|
|
566
|
-
if (config._plugins) {
|
|
567
|
-
if (!Array.isArray(config._plugins)) throw new Error('featuretoggleapi()-constructor: config.plugins must be an array.');
|
|
568
|
-
|
|
569
|
-
config._plugins.forEach(function (plugin) {
|
|
570
|
-
if (typeof plugin !== 'function') throw new Error('featuretoggleapi()-constructor: config.plugins needs functions as entries, not ' + (typeof plugin === 'undefined' ? 'undefined' : _typeof(plugin)) + '.');
|
|
571
|
-
|
|
572
|
-
_addPlugin(plugin, api);
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
triggerEvent('init');
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
function _addPlugin(plugin, api) {
|
|
580
|
-
plugin(api);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
function triggerEvent(eventtype, param) {
|
|
584
|
-
(globals.listeners[eventtype] || []).forEach(function (listener) {
|
|
585
|
-
listener(param);
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
var log = function log(message) {
|
|
590
|
-
if (!globals.showLogs) return;
|
|
591
|
-
|
|
592
|
-
//Nur Browser können Syntaxhighlighting die anderen geben die Nachricht einfach aus und schneiden
|
|
593
|
-
//die styletags raus
|
|
594
|
-
if (typeof window === 'undefined') {
|
|
595
|
-
var loggedMessage = message.replace(/<b>/g, "");
|
|
596
|
-
console.log(loggedMessage);
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
var hasBoldTag = message.indexOf('<b>') != -1;
|
|
601
|
-
var hasVisibleKeyword = message.indexOf('visible') != -1;
|
|
602
|
-
var hasHiddenKeyword = message.indexOf('hidden') != -1;
|
|
603
|
-
|
|
604
|
-
var _message = message.replace('visible', '%cvisible');
|
|
605
|
-
_message = _message.replace('hidden', '%chidden');
|
|
606
|
-
|
|
607
|
-
if (hasVisibleKeyword) console.log(_message, "color:green;font-weight:bold;");else if (hasHiddenKeyword) console.log(_message, "color:red;font-weight:bold;");else if (hasBoldTag) {
|
|
608
|
-
_message = _message.replace('<b>', '%c');
|
|
609
|
-
var parts = [_message, 'font-weight:bold;'];
|
|
610
|
-
console.log.apply(null, parts);
|
|
611
|
-
} else console.log(message);
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
var logAndReturn = function logAndReturn(returnValue, message) {
|
|
615
|
-
log(message);
|
|
616
|
-
log('');
|
|
617
|
-
return returnValue;
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
var getVisibility = function getVisibility(visibilityFn, functionname, name, variant, data) {
|
|
621
|
-
if (visibilityFn == null) return undefined;
|
|
622
|
-
|
|
623
|
-
var calculatedVisibility = visibilityFn({ name: name, variant: variant, data: data });
|
|
624
|
-
|
|
625
|
-
if (typeof calculatedVisibility == 'boolean') {
|
|
626
|
-
return calculatedVisibility;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
return logAndReturn(false, 'The ' + functionname + ' returns ' + calculatedVisibility + '. => Please return true or false. This result (and all non-boolean results) will return false.');
|
|
630
|
-
};
|
|
631
|
-
|
|
632
|
-
function getKey(name, variant) {
|
|
633
|
-
var _name = name.toLowerCase();
|
|
634
|
-
if (typeof variant == 'string') {
|
|
635
|
-
_name += "#" + variant.toLowerCase();
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
return _name;
|
|
639
|
-
}
|
|
640
|
-
function parseKey(key) {
|
|
641
|
-
var parts = key.split('#');
|
|
642
|
-
return {
|
|
643
|
-
name: parts[0],
|
|
644
|
-
variant: parts.length > 1 ? parts[1] : undefined,
|
|
645
|
-
data: globals.datas[key]
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
/*
|
|
650
|
-
the following calls are possible:
|
|
651
|
-
visibility(name,result);
|
|
652
|
-
visibility(name,variant,result);
|
|
653
|
-
visibility(name,variant,data,result);
|
|
654
|
-
|
|
655
|
-
=>
|
|
656
|
-
param1: name
|
|
657
|
-
param2: result || variant
|
|
658
|
-
param3: result || data
|
|
659
|
-
param4: result
|
|
660
|
-
*/
|
|
661
|
-
function visibilityFnParams(param1, param2, param3, param4) {
|
|
662
|
-
//name must always be set
|
|
663
|
-
if (param1 == undefined) throw new Error('feature.visibility(): 1st parameter name must be defined');
|
|
664
|
-
|
|
665
|
-
if (arguments.length == 1) throw new Error('feature.visibility(): 2nd parameter name must be a boolean or function, but is empty');
|
|
666
|
-
|
|
667
|
-
var name = param1,
|
|
668
|
-
variant = null,
|
|
669
|
-
data = null,
|
|
670
|
-
result = null;
|
|
671
|
-
if (param3 == undefined && param4 == undefined) {
|
|
672
|
-
result = param2;
|
|
673
|
-
} else if (param4 == undefined) {
|
|
674
|
-
variant = param2;
|
|
675
|
-
result = param3;
|
|
676
|
-
} else {
|
|
677
|
-
variant = param2;
|
|
678
|
-
data = param3;
|
|
679
|
-
result = param4;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
return {
|
|
683
|
-
name: name,
|
|
684
|
-
variant: variant,
|
|
685
|
-
data: data,
|
|
686
|
-
result: result
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
function getEvent(name, variant, data, result) {
|
|
691
|
-
|
|
692
|
-
var event = void 0;
|
|
693
|
-
|
|
694
|
-
event = { name: name, variant: variant, data: data };
|
|
695
|
-
|
|
696
|
-
event.key = getKey(event.name, event.variant);
|
|
697
|
-
|
|
698
|
-
if (result == null) return event;
|
|
699
|
-
|
|
700
|
-
event.visibilityFunction = parseToFn(result);
|
|
701
|
-
event.result = event.visibilityFunction({
|
|
702
|
-
name: event.name,
|
|
703
|
-
variant: event.variant,
|
|
704
|
-
data: event.data || {},
|
|
705
|
-
_internalCall: true,
|
|
706
|
-
description: 'When attaching a function, the result must be calculated internally. You can filter this out with the _internalCall:true -Flag.'
|
|
707
|
-
});
|
|
708
|
-
return event;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
function isVisible(name, variant, data) {
|
|
712
|
-
var visibilities = globals.visibilities;
|
|
713
|
-
|
|
714
|
-
log('\nCheck Visibility of <b>Feature "' + name + '", variant "' + (variant == undefined ? '' : variant) + '"' + (data ? " with data " + JSON.stringify(data) : "") + '.');
|
|
715
|
-
if (name == undefined) throw new Error('The attribute "name" is required for tag <feature></feature>. Example: <feature name="aname"></feature>');
|
|
716
|
-
|
|
717
|
-
var requiredFn = visibilities['_required'];
|
|
718
|
-
var requiredFnExists = visibilities['_required'] != null;
|
|
719
|
-
var requiredFnResult = getVisibility(requiredFn, 'requiredVisibility', name, variant, data);
|
|
720
|
-
|
|
721
|
-
var visibilityFnKey = getKey(name, variant);
|
|
722
|
-
var visibilityFn = visibilities[visibilityFnKey];
|
|
723
|
-
var visibilityFnExists = visibilities[visibilityFnKey] != null;
|
|
724
|
-
var visibilityFnResult = getVisibility(visibilityFn, 'visibility function', name, variant, data);
|
|
725
|
-
|
|
726
|
-
var variantExists = variant != null;
|
|
727
|
-
var visibilityOnlyNameFnKey = getKey(name, null);
|
|
728
|
-
var visibilityOnlyNameFn = visibilities[visibilityOnlyNameFnKey];
|
|
729
|
-
var visibilityOnlyNameFnResult = getVisibility(visibilityOnlyNameFn, 'visibility function (only name)', name, variant, data);
|
|
730
|
-
|
|
731
|
-
var defaultFn = visibilities['_default'];
|
|
732
|
-
var defaultFnExists = visibilities['_default'] != null;
|
|
733
|
-
var defaultFnResult = getVisibility(defaultFn, 'defaultVisibility', name, variant, data);
|
|
734
|
-
|
|
735
|
-
if (!requiredFnExists) log("No requiredVisibility rule specified for this feature.");else if (requiredFnExists && requiredFnResult === true) log("The requiredVisibility rule returns true. This feature will be shown when no other rule rejects it.");else if (requiredFnExists && requiredFnResult === false) return logAndReturn(false, "The requiredVisibility rule returns false. This feature will be hidden.");
|
|
736
|
-
|
|
737
|
-
if (visibilityFnExists) return logAndReturn(visibilityFnResult, 'The visibility rule returns ' + visibilityFnResult + '. This feature will be ' + (visibilityFnResult ? 'visible' : 'hidden') + '.');
|
|
738
|
-
log('No visibility rule found matching name and variant.');
|
|
739
|
-
|
|
740
|
-
if (variantExists && typeof visibilityOnlyNameFnResult == 'boolean') return logAndReturn(visibilityOnlyNameFnResult, 'Found a visibility rule for name ' + name + ' without variants. The rule returns ' + visibilityOnlyNameFnResult + '. => This feature will be ' + (visibilityOnlyNameFnResult ? 'visible' : 'hidden') + '.');else if (variantExists) log('No rules found for name ' + name + ' without variants.');
|
|
741
|
-
|
|
742
|
-
if (defaultFnExists) return logAndReturn(defaultFnResult, 'Found a defaultVisibility rule. The rule returns ' + defaultFnResult + '. => This feature will be ' + (defaultFnResult ? 'visible' : 'hidden') + '.');
|
|
743
|
-
log('No default rule found.');
|
|
744
|
-
|
|
745
|
-
if (requiredFnExists) return logAndReturn(true, 'Only the requiredVisibility rule was found. This returned true. => This feature will be visible.');
|
|
746
|
-
|
|
747
|
-
return logAndReturn(false, 'No rules were found. This feature will be hidden.');
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
var api = {
|
|
751
|
-
name: 'feature-toggle-api',
|
|
752
|
-
setData: function setData(nameParam, variantOrDataParam, dataParam) {
|
|
753
|
-
if (nameParam == undefined) throw new Error('setData(): The name must of the feature must be defined, but ist undefined');
|
|
754
|
-
|
|
755
|
-
var variant = dataParam != undefined ? variantOrDataParam : undefined;
|
|
756
|
-
var data = dataParam || variantOrDataParam;
|
|
757
|
-
|
|
758
|
-
var event = getEvent(nameParam, variant, data);
|
|
759
|
-
|
|
760
|
-
globals.datas[event.key] = event.data;
|
|
761
|
-
|
|
762
|
-
triggerEvent('visibilityrule', event);
|
|
763
|
-
},
|
|
764
|
-
on: function on(eventtype, fn, config) {
|
|
765
|
-
globals.listeners[eventtype] = globals.listeners[eventtype] || [];
|
|
766
|
-
globals.listeners[eventtype].push(fn);
|
|
767
|
-
|
|
768
|
-
triggerEvent('registerEvent', {
|
|
769
|
-
type: eventtype
|
|
770
|
-
});
|
|
771
|
-
if (config != undefined && config.ignorePreviousRules) return;
|
|
772
|
-
|
|
773
|
-
Object.keys(globals.visibilities).forEach(function (key) {
|
|
774
|
-
var event = parseKey(key, globals);
|
|
775
|
-
var rule = globals.visibilities[key];
|
|
776
|
-
event.result = rule(event);
|
|
777
|
-
fn(event);
|
|
778
|
-
});
|
|
779
|
-
},
|
|
780
|
-
trigger: triggerEvent,
|
|
781
|
-
showLogs: function showLogs(_showLogs) {
|
|
782
|
-
globals.showLogs = _showLogs == undefined ? true : _showLogs;
|
|
783
|
-
},
|
|
784
|
-
isVisible: isVisible,
|
|
785
|
-
/*
|
|
786
|
-
the following function calls are possible:
|
|
787
|
-
visibility(name,result);
|
|
788
|
-
visibility(name,variant,result);
|
|
789
|
-
visibility(name,variant,data,result);
|
|
790
|
-
*/
|
|
791
|
-
visibility: function visibility(param1, param2, param3, param4) {
|
|
792
|
-
var params = visibilityFnParams(param1, param2, param3, param4);
|
|
793
|
-
var event = getEvent(params.name, params.variant, params.data, params.result);
|
|
794
|
-
|
|
795
|
-
globals.visibilities[event.key] = event.visibilityFunction;
|
|
796
|
-
globals.datas[event.key] = event.data;
|
|
797
|
-
triggerEvent('visibilityrule', event);
|
|
798
|
-
},
|
|
799
|
-
requiredVisibility: function requiredVisibility(fn) {
|
|
800
|
-
if (typeof fn != "function") throw new Error('feature.requiredVisibility(): 1st parameter must be a function, but is ' + (typeof fn === 'undefined' ? 'undefined' : _typeof(fn)));
|
|
801
|
-
|
|
802
|
-
globals.visibilities['_required'] = parseToFn(fn);
|
|
803
|
-
},
|
|
804
|
-
defaultVisibility: function defaultVisibility(fn) {
|
|
805
|
-
if (typeof fn != "function") throw new Error('feature.defaultVisibility(): 1st parameter must be a function, but is ' + (typeof fn === 'undefined' ? 'undefined' : _typeof(fn)));
|
|
806
|
-
|
|
807
|
-
globals.visibilities['_default'] = parseToFn(fn);
|
|
808
|
-
},
|
|
809
|
-
addPlugin: function addPlugin(plugin) {
|
|
810
|
-
if (globals.usedPlugins.includes(plugin)) return;
|
|
811
|
-
|
|
812
|
-
_addPlugin(plugin, api);
|
|
813
|
-
globals.usedPlugins.push(plugin);
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
init(api);
|
|
817
|
-
return api;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
module.exports = featuretoggleapi;
|
|
821
|
-
},{}],3:[function(require,module,exports){
|
|
822
|
-
;(function(){
|
|
823
|
-
"use strict";
|
|
824
|
-
|
|
825
|
-
var featureToggleApi = require("feature-toggle-api");
|
|
826
|
-
var deepDiff = require('deep-diff');
|
|
827
|
-
|
|
828
|
-
var api = new featureToggleApi();
|
|
829
|
-
|
|
830
|
-
function vuePlugin(api) {
|
|
831
|
-
Object.assign(api, {
|
|
832
|
-
props: {
|
|
833
|
-
name: {
|
|
834
|
-
type: String
|
|
835
|
-
},
|
|
836
|
-
variant: {
|
|
837
|
-
type: String
|
|
838
|
-
},
|
|
839
|
-
data: {
|
|
840
|
-
type: [Object, String]
|
|
841
|
-
},
|
|
842
|
-
tag: {
|
|
843
|
-
type: String,
|
|
844
|
-
default: "div"
|
|
845
|
-
}
|
|
846
|
-
},
|
|
847
|
-
name: "feature",
|
|
848
|
-
data: function data() {
|
|
849
|
-
return {
|
|
850
|
-
isVisible: api.isVisible(this.name, this.variant, this.data)
|
|
851
|
-
};
|
|
852
|
-
},
|
|
853
|
-
|
|
854
|
-
render: function render(createElement) {
|
|
855
|
-
if (this.isVisible) {
|
|
856
|
-
return createElement(this.tag, {
|
|
857
|
-
"feature-name": this.name,
|
|
858
|
-
"feature-variant": this.variant
|
|
859
|
-
}, this.$slots.default);
|
|
860
|
-
}
|
|
861
|
-
},
|
|
862
|
-
mounted: function mounted() {
|
|
863
|
-
this.init();
|
|
864
|
-
},
|
|
865
|
-
ready: function ready() {
|
|
866
|
-
this.init();
|
|
867
|
-
},
|
|
868
|
-
methods: {
|
|
869
|
-
_isVisible: function _isVisible(name, variant, data) {
|
|
870
|
-
return api.isVisible(name, variant, data);
|
|
871
|
-
},
|
|
872
|
-
init: function init() {
|
|
873
|
-
var self = this;
|
|
874
|
-
api.on("visibilityrule", function (e) {
|
|
875
|
-
if((self.name || "") == (e.name || "") && (self.variant || "") == (e.variant || "") && deepDiff(self.data || "",e.data || "") == undefined)
|
|
876
|
-
self.isVisible = api.isVisible(e.name, e.variant, e.data);
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
api.addPlugin(vuePlugin);
|
|
884
|
-
module.exports = api;
|
|
885
|
-
})()
|
|
886
|
-
if (module.exports.__esModule) module.exports = module.exports.default
|
|
887
|
-
var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports)
|
|
888
|
-
__vue__options__._scopeId = "data-v-32d0d8b2"
|
|
889
|
-
|
|
890
|
-
},{"deep-diff":1,"feature-toggle-api":2}],4:[function(require,module,exports){
|
|
891
|
-
'use strict';
|
|
892
|
-
|
|
893
|
-
var _Feature = require('./Feature.vue');
|
|
894
|
-
|
|
895
|
-
var _Feature2 = _interopRequireDefault(_Feature);
|
|
896
|
-
|
|
897
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
898
|
-
|
|
899
|
-
module.exports = _Feature2.default;
|
|
900
|
-
|
|
901
|
-
},{"./Feature.vue":3}]},{},[3,4])(4)
|
|
902
|
-
});
|