@zcomponent/core 1.29.0 → 2.0.0-alpha.2
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 +1 -0
- package/css/zcomponent.css +121 -122
- package/index.js +0 -3
- package/lib/actionbehavior.d.ts +3 -3
- package/lib/actionbehavior.js +20 -19
- package/lib/animation/animation.d.ts +13 -6
- package/lib/animation/animation.js +56 -43
- package/lib/animation/bezier.d.ts +6 -0
- package/lib/animation/bezier.js +8 -2
- package/lib/animation/clips/clip.d.ts +13 -1
- package/lib/animation/clips/clip.js +34 -14
- package/lib/animation/index.d.ts +4 -4
- package/lib/animation/index.js +4 -4
- package/lib/animation/layer.d.ts +9 -0
- package/lib/animation/layer.js +28 -12
- package/lib/animation/layerclip.d.ts +21 -0
- package/lib/animation/layerclip.js +82 -45
- package/lib/animation/tracks/cliptrack.d.ts +18 -0
- package/lib/animation/tracks/cliptrack.js +27 -6
- package/lib/animation/tracks/functiontrack.d.ts +9 -0
- package/lib/animation/tracks/functiontrack.js +16 -3
- package/lib/animation/tracks/propertytrack.d.ts +20 -1
- package/lib/animation/tracks/propertytrack.js +48 -11
- package/lib/animation/tracks/streamtrack.d.ts +18 -0
- package/lib/animation/tracks/streamtrack.js +32 -6
- package/lib/animation/tracks/track.d.ts +8 -2
- package/lib/animation/tracks/track.js +3 -2
- package/lib/behavior.js +13 -10
- package/lib/behaviors/ActivateState.d.ts +22 -24
- package/lib/behaviors/ActivateState.js +145 -35
- package/lib/behaviors/CallFunction.d.ts +2 -4
- package/lib/behaviors/CallFunction.js +69 -11
- package/lib/behaviors/ChangeRootScene.d.ts +35 -0
- package/lib/behaviors/ChangeRootScene.js +123 -0
- package/lib/behaviors/ConsoleLog.d.ts +6 -5
- package/lib/behaviors/ConsoleLog.js +95 -12
- package/lib/behaviors/DownloadSnapshot.d.ts +7 -12
- package/lib/behaviors/DownloadSnapshot.js +70 -19
- package/lib/behaviors/EmitComponentPropEvent.d.ts +1 -3
- package/lib/behaviors/EmitComponentPropEvent.js +80 -12
- package/lib/behaviors/LaunchURL.d.ts +5 -5
- package/lib/behaviors/LaunchURL.js +92 -10
- package/lib/behaviors/LogAnalyticsEvent.d.ts +10 -4
- package/lib/behaviors/LogAnalyticsEvent.js +88 -7
- package/lib/behaviors/PauseLayerClip.d.ts +7 -9
- package/lib/behaviors/PauseLayerClip.js +89 -21
- package/lib/behaviors/PlayLayerClip.d.ts +35 -32
- package/lib/behaviors/PlayLayerClip.js +202 -48
- package/lib/behaviors/PlaySound.d.ts +19 -25
- package/lib/behaviors/PlaySound.js +122 -28
- package/lib/behaviors/SetLayerOff.d.ts +7 -9
- package/lib/behaviors/SetLayerOff.js +88 -21
- package/lib/behaviors/ShareSnapshot.d.ts +5 -9
- package/lib/behaviors/ShareSnapshot.js +70 -17
- package/lib/behaviors/ShowTextAlert.d.ts +16 -29
- package/lib/behaviors/ShowTextAlert.js +116 -48
- package/lib/behaviors/TakeSnapshot.d.ts +22 -26
- package/lib/behaviors/TakeSnapshot.js +131 -56
- package/lib/behaviors/ToggleLayerClips.d.ts +45 -62
- package/lib/behaviors/ToggleLayerClips.js +233 -64
- package/lib/behaviors/stream/PauseStream.d.ts +5 -16
- package/lib/behaviors/stream/PauseStream.js +94 -34
- package/lib/behaviors/stream/PlayStream.d.ts +14 -27
- package/lib/behaviors/stream/PlayStream.js +123 -34
- package/lib/behaviors/stream/SeekStream.d.ts +8 -18
- package/lib/behaviors/stream/SeekStream.js +97 -31
- package/lib/behaviors/stream/StopStream.d.ts +6 -15
- package/lib/behaviors/stream/StopStream.js +89 -27
- package/lib/component.d.ts +36 -13
- package/lib/component.js +237 -151
- package/lib/components/AnimatedLoader.d.ts +51 -0
- package/lib/components/AnimatedLoader.js +159 -0
- package/lib/components/Audio.d.ts +35 -37
- package/lib/components/Audio.js +264 -151
- package/lib/components/AudioLayerSettings.d.ts +13 -11
- package/lib/components/AudioLayerSettings.js +76 -18
- package/lib/components/Children.d.ts +2 -1
- package/lib/components/Children.js +66 -13
- package/lib/components/ConditionalConstruct.d.ts +44 -0
- package/lib/components/ConditionalConstruct.js +142 -0
- package/lib/components/DefaultCookieConsent.d.ts +53 -73
- package/lib/components/DefaultCookieConsent.js +382 -264
- package/lib/components/DefaultLoader.d.ts +40 -28
- package/lib/components/DefaultLoader.js +198 -46
- package/lib/components/Gamepad.d.ts +5 -26
- package/lib/components/Gamepad.js +201 -65
- package/lib/components/LoaderScope.d.ts +15 -0
- package/lib/components/LoaderScope.js +71 -0
- package/lib/components/LongLoad.d.ts +11 -15
- package/lib/components/LongLoad.js +89 -34
- package/lib/components/SnapshotUI.d.ts +19 -24
- package/lib/components/SnapshotUI.js +202 -105
- package/lib/context.d.ts +23 -5
- package/lib/context.js +12 -6
- package/lib/contexts/analyticscontext.d.ts +12 -2
- package/lib/contexts/analyticscontext.js +68 -10
- package/lib/contexts/audiocontextcontext.d.ts +1 -1
- package/lib/contexts/audiocontextcontext.js +9 -8
- package/lib/contexts/canvascontext.d.ts +32 -18
- package/lib/contexts/canvascontext.js +195 -120
- package/lib/contexts/cookieconsentcontext.d.ts +38 -28
- package/lib/contexts/cookieconsentcontext.js +35 -32
- package/lib/contexts/documentflagmanager.js +15 -11
- package/lib/contexts/environmentcontext.d.ts +22 -6
- package/lib/contexts/environmentcontext.js +135 -21
- package/lib/contexts/gamepadcontext.d.ts +29 -26
- package/lib/contexts/gamepadcontext.js +46 -46
- package/lib/contexts/gesturecontext.d.ts +31 -6
- package/lib/contexts/gesturecontext.js +110 -85
- package/lib/contexts/globaltagcontext.d.ts +1 -1
- package/lib/contexts/globaltagcontext.js +8 -11
- package/lib/contexts/loadcontext.d.ts +45 -8
- package/lib/contexts/loadcontext.js +232 -82
- package/lib/contexts/orientationcontext.d.ts +13 -15
- package/lib/contexts/orientationcontext.js +150 -67
- package/lib/contexts/rootcomponentscontext.d.ts +16 -0
- package/lib/contexts/rootcomponentscontext.js +65 -0
- package/lib/contexts/snapshotContext.d.ts +0 -3
- package/lib/contexts/snapshotContext.js +78 -23
- package/lib/contexts/tagcontext.d.ts +5 -5
- package/lib/contexts/tagcontext.js +16 -16
- package/lib/contexts/textalertcontext.d.ts +1 -5
- package/lib/contexts/textalertcontext.js +1 -5
- package/lib/contexts/usereventcontext.d.ts +1 -1
- package/lib/contexts/usereventcontext.js +12 -12
- package/lib/data/animation.d.ts +10 -2
- package/lib/data/change.d.ts +1 -1
- package/lib/data/change.js +7 -0
- package/lib/data/core.d.ts +9 -1
- package/lib/data/index.d.ts +1 -1
- package/lib/data/index.js +1 -1
- package/lib/decorators.d.ts +348 -0
- package/lib/decorators.js +239 -0
- package/lib/decoratorutils.d.ts +3 -0
- package/lib/decoratorutils.js +8 -0
- package/lib/emitter.d.ts +15 -2
- package/lib/emitter.js +15 -6
- package/lib/entity.d.ts +43 -25
- package/lib/entity.js +104 -71
- package/lib/event.d.ts +2 -1
- package/lib/event.js +1 -4
- package/lib/groups.d.ts +18 -0
- package/lib/groups.js +19 -0
- package/lib/icons.d.ts +3372 -0
- package/lib/icons.js +1 -0
- package/lib/index.d.ts +18 -13
- package/lib/index.js +17 -13
- package/lib/inflate.d.ts +7 -7
- package/lib/inflate.js +5 -5
- package/lib/observable.d.ts +9 -2
- package/lib/observable.js +5 -4
- package/lib/observe.d.ts +18 -0
- package/lib/observe.js +177 -0
- package/lib/profile.d.ts +9 -5
- package/lib/profile.js +27 -17
- package/lib/selectors.d.ts +1 -1
- package/lib/selectors.js +5 -4
- package/lib/types.d.ts +161 -19
- package/lib/types.js +22 -1
- package/lib/values/values.d.ts +7 -8
- package/lib/values/values.js +1 -2
- package/lib/values/valuesmutator.d.ts +4 -1
- package/lib/values/valuesmutator.js +10 -8
- package/lib/zcomponent.d.ts +21 -10
- package/lib/zcomponent.js +717 -540
- package/package.json +22 -5
- package/lib/behaviors/ChangeCursor.d.ts +0 -39
- package/lib/behaviors/ChangeCursor.js +0 -44
|
@@ -1,28 +1,86 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
1
35
|
import { Component } from '../component';
|
|
2
36
|
import { AudioContextContext } from '../contexts/audiocontextcontext';
|
|
3
|
-
import {
|
|
37
|
+
import { zComponent, zObserve, zUI } from '../decorators';
|
|
4
38
|
/**
|
|
5
39
|
* Audio layer settings.
|
|
6
40
|
* @zcomponent
|
|
7
|
-
* @ztag core/audiolayersettings
|
|
8
|
-
* @zgroup Media
|
|
9
41
|
* @zicon volume_up
|
|
42
|
+
* @zgroup Media
|
|
43
|
+
* @ztag core/audiolayersettings
|
|
10
44
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
45
|
+
let AudioLayerSettings = (() => {
|
|
46
|
+
let _classDecorators = [zComponent({ icon: 'volume_up', group: 'Media', tags: ['core/audiolayersettings'] })];
|
|
47
|
+
let _classDescriptor;
|
|
48
|
+
let _classExtraInitializers = [];
|
|
49
|
+
let _classThis;
|
|
50
|
+
let _classSuper = Component;
|
|
51
|
+
let _volume_decorators;
|
|
52
|
+
let _volume_initializers = [];
|
|
53
|
+
let _volume_extraInitializers = [];
|
|
54
|
+
var AudioLayerSettings = class extends _classSuper {
|
|
55
|
+
static { _classThis = this; }
|
|
56
|
+
static {
|
|
57
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
58
|
+
_volume_decorators = [zObserve((v, instance) => instance.contextManager.get(AudioContextContext).setVolumeForLayer(instance.constructorProps?.layer, v)), zUI({ type: 'proportion' })];
|
|
59
|
+
__esDecorate(null, null, _volume_decorators, { kind: "field", name: "volume", static: false, private: false, access: { has: obj => "volume" in obj, get: obj => obj.volume, set: (obj, value) => { obj.volume = value; } }, metadata: _metadata }, _volume_initializers, _volume_extraInitializers);
|
|
60
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
61
|
+
AudioLayerSettings = _classThis = _classDescriptor.value;
|
|
62
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
63
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
64
|
+
}
|
|
19
65
|
/**
|
|
20
|
-
*
|
|
66
|
+
* The volume of the layer.
|
|
67
|
+
*
|
|
68
|
+
* Default is 1.
|
|
69
|
+
* @default 1
|
|
70
|
+
* @zui
|
|
21
71
|
* @ztype proportion
|
|
22
|
-
* @zdefault 1
|
|
23
72
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
73
|
+
volume = __runInitializers(this, _volume_initializers, 1);
|
|
74
|
+
/**
|
|
75
|
+
* Creates a new AudioLayerSettings component.
|
|
76
|
+
* @param contextManager - The current ContextManager
|
|
77
|
+
* @param props - The constructor properties.
|
|
78
|
+
*/
|
|
79
|
+
constructor(contextManager, props) {
|
|
80
|
+
super(contextManager, props);
|
|
81
|
+
__runInitializers(this, _volume_extraInitializers);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return AudioLayerSettings = _classThis;
|
|
85
|
+
})();
|
|
86
|
+
export { AudioLayerSettings };
|
|
@@ -2,12 +2,13 @@ import { Component, ConstructorProps } from '../component';
|
|
|
2
2
|
import { ContextManager } from '../context';
|
|
3
3
|
/**
|
|
4
4
|
* @zcomponent
|
|
5
|
-
* @zgroup Advanced
|
|
6
5
|
* @zicon list
|
|
6
|
+
* @zgroup Advanced
|
|
7
7
|
*/
|
|
8
8
|
export declare class Children extends Component {
|
|
9
9
|
/**
|
|
10
10
|
* Creates an instance of Children.
|
|
11
|
+
*
|
|
11
12
|
* @param contextManager - The current ContextManager
|
|
12
13
|
* @param props - The constructor properties.
|
|
13
14
|
*/
|
|
@@ -1,18 +1,71 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
1
35
|
import { Component } from '../component';
|
|
36
|
+
import { zComponent } from '../decorators';
|
|
2
37
|
/**
|
|
3
38
|
* @zcomponent
|
|
4
|
-
* @zgroup Advanced
|
|
5
39
|
* @zicon list
|
|
40
|
+
* @zgroup Advanced
|
|
6
41
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
42
|
+
let Children = (() => {
|
|
43
|
+
let _classDecorators = [zComponent({ icon: 'list', group: 'Advanced' })];
|
|
44
|
+
let _classDescriptor;
|
|
45
|
+
let _classExtraInitializers = [];
|
|
46
|
+
let _classThis;
|
|
47
|
+
let _classSuper = Component;
|
|
48
|
+
var Children = class extends _classSuper {
|
|
49
|
+
static { _classThis = this; }
|
|
50
|
+
static {
|
|
51
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
52
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
53
|
+
Children = _classThis = _classDescriptor.value;
|
|
54
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
55
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates an instance of Children.
|
|
59
|
+
*
|
|
60
|
+
* @param contextManager - The current ContextManager
|
|
61
|
+
* @param props - The constructor properties.
|
|
62
|
+
*/
|
|
63
|
+
constructor(contextManager, props) {
|
|
64
|
+
super(contextManager, props);
|
|
65
|
+
const zcomponent = this.getZComponentInstance();
|
|
66
|
+
this.constructChildren(zcomponent?.constructorProps?.children ?? []);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return Children = _classThis;
|
|
70
|
+
})();
|
|
71
|
+
export { Children };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component, ConstructorProps } from '../component';
|
|
2
|
+
import { ContextManager } from '../context';
|
|
3
|
+
/**
|
|
4
|
+
* A component that conditionally loads its children based on the values of its loadAtRuntime and loadAtDesignTime properties.
|
|
5
|
+
*
|
|
6
|
+
* Useful for optimizing performance by only loading certain parts of the component tree when needed.
|
|
7
|
+
* @zcomponent
|
|
8
|
+
* @zicon switches
|
|
9
|
+
* @zgroup Advanced
|
|
10
|
+
*/
|
|
11
|
+
export declare class ConditionalConstruct extends Component {
|
|
12
|
+
constructorProps: ConstructorProps;
|
|
13
|
+
private _childrenSpec;
|
|
14
|
+
/**
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
private _isLoaded;
|
|
18
|
+
constructor(contextManager: ContextManager, constructorProps: ConstructorProps);
|
|
19
|
+
private _updateWithDelay;
|
|
20
|
+
private _update;
|
|
21
|
+
/**
|
|
22
|
+
* @default false
|
|
23
|
+
* @zui
|
|
24
|
+
* @zgroup ConditionalConstruct
|
|
25
|
+
* @zgrouppriority 100
|
|
26
|
+
*/
|
|
27
|
+
loadAtRuntime: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @default false
|
|
30
|
+
* @zui
|
|
31
|
+
* @zgroup ConditionalConstruct
|
|
32
|
+
* @zgrouppriority 100
|
|
33
|
+
*/
|
|
34
|
+
loadAtDesignTime: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* An amount of time to delay any changes to loading state. Use this to give time for a loader to appear before changing the content.
|
|
37
|
+
* @default 0
|
|
38
|
+
* @zui
|
|
39
|
+
* @zgroup ConditionalConstruct
|
|
40
|
+
* @zgrouppriority 100
|
|
41
|
+
* @ztype time-milliseconds
|
|
42
|
+
*/
|
|
43
|
+
delayForLoader: number;
|
|
44
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { Component } from '../component';
|
|
36
|
+
import { isDesignTime } from '../contexts/environmentcontext';
|
|
37
|
+
import { registerLoadable } from '../contexts/loadcontext';
|
|
38
|
+
import { zComponent, zObserve, zUI } from '../decorators';
|
|
39
|
+
/**
|
|
40
|
+
* A component that conditionally loads its children based on the values of its loadAtRuntime and loadAtDesignTime properties.
|
|
41
|
+
*
|
|
42
|
+
* Useful for optimizing performance by only loading certain parts of the component tree when needed.
|
|
43
|
+
* @zcomponent
|
|
44
|
+
* @zicon switches
|
|
45
|
+
* @zgroup Advanced
|
|
46
|
+
*/
|
|
47
|
+
let ConditionalConstruct = (() => {
|
|
48
|
+
let _classDecorators = [zComponent({ icon: 'switches', group: 'Advanced' })];
|
|
49
|
+
let _classDescriptor;
|
|
50
|
+
let _classExtraInitializers = [];
|
|
51
|
+
let _classThis;
|
|
52
|
+
let _classSuper = Component;
|
|
53
|
+
let _loadAtRuntime_decorators;
|
|
54
|
+
let _loadAtRuntime_initializers = [];
|
|
55
|
+
let _loadAtRuntime_extraInitializers = [];
|
|
56
|
+
let _loadAtDesignTime_decorators;
|
|
57
|
+
let _loadAtDesignTime_initializers = [];
|
|
58
|
+
let _loadAtDesignTime_extraInitializers = [];
|
|
59
|
+
let _delayForLoader_decorators;
|
|
60
|
+
let _delayForLoader_initializers = [];
|
|
61
|
+
let _delayForLoader_extraInitializers = [];
|
|
62
|
+
var ConditionalConstruct = class extends _classSuper {
|
|
63
|
+
static { _classThis = this; }
|
|
64
|
+
static {
|
|
65
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
66
|
+
_loadAtRuntime_decorators = [zUI({ group: { name: 'ConditionalConstruct', priority: 100 } }), zObserve((v, instance) => instance._updateWithDelay())];
|
|
67
|
+
_loadAtDesignTime_decorators = [zUI({ group: { name: 'ConditionalConstruct', priority: 100 } }), zObserve((v, instance) => instance._updateWithDelay())];
|
|
68
|
+
_delayForLoader_decorators = [zUI({ group: { name: 'ConditionalConstruct', priority: 100 }, type: 'time-milliseconds' })];
|
|
69
|
+
__esDecorate(null, null, _loadAtRuntime_decorators, { kind: "field", name: "loadAtRuntime", static: false, private: false, access: { has: obj => "loadAtRuntime" in obj, get: obj => obj.loadAtRuntime, set: (obj, value) => { obj.loadAtRuntime = value; } }, metadata: _metadata }, _loadAtRuntime_initializers, _loadAtRuntime_extraInitializers);
|
|
70
|
+
__esDecorate(null, null, _loadAtDesignTime_decorators, { kind: "field", name: "loadAtDesignTime", static: false, private: false, access: { has: obj => "loadAtDesignTime" in obj, get: obj => obj.loadAtDesignTime, set: (obj, value) => { obj.loadAtDesignTime = value; } }, metadata: _metadata }, _loadAtDesignTime_initializers, _loadAtDesignTime_extraInitializers);
|
|
71
|
+
__esDecorate(null, null, _delayForLoader_decorators, { kind: "field", name: "delayForLoader", static: false, private: false, access: { has: obj => "delayForLoader" in obj, get: obj => obj.delayForLoader, set: (obj, value) => { obj.delayForLoader = value; } }, metadata: _metadata }, _delayForLoader_initializers, _delayForLoader_extraInitializers);
|
|
72
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
73
|
+
ConditionalConstruct = _classThis = _classDescriptor.value;
|
|
74
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
75
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
76
|
+
}
|
|
77
|
+
constructorProps;
|
|
78
|
+
_childrenSpec;
|
|
79
|
+
/**
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
_isLoaded = false;
|
|
83
|
+
constructor(contextManager, constructorProps) {
|
|
84
|
+
const propsSansChildren = { ...constructorProps, children: [] };
|
|
85
|
+
super(contextManager, propsSansChildren);
|
|
86
|
+
__runInitializers(this, _delayForLoader_extraInitializers);
|
|
87
|
+
this.constructorProps = constructorProps;
|
|
88
|
+
this._childrenSpec = constructorProps.children ?? [];
|
|
89
|
+
}
|
|
90
|
+
_updateWithDelay = () => {
|
|
91
|
+
if (this.delayForLoader === 0)
|
|
92
|
+
return this._update();
|
|
93
|
+
registerLoadable(this, (async () => {
|
|
94
|
+
await delay(this.delayForLoader);
|
|
95
|
+
this._update();
|
|
96
|
+
})());
|
|
97
|
+
};
|
|
98
|
+
_update = () => {
|
|
99
|
+
const shouldBeLoaded = (isDesignTime(this.contextManager) && this.loadAtDesignTime) || (!isDesignTime(this.contextManager) && this.loadAtRuntime);
|
|
100
|
+
if (this._isLoaded && !shouldBeLoaded) {
|
|
101
|
+
let child = this.children[0];
|
|
102
|
+
while (child) {
|
|
103
|
+
child.remove();
|
|
104
|
+
child.dispose();
|
|
105
|
+
child = this.children[0];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else if (!this._isLoaded && shouldBeLoaded) {
|
|
109
|
+
this.constructChildren(this._childrenSpec);
|
|
110
|
+
}
|
|
111
|
+
this._isLoaded = shouldBeLoaded;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* @default false
|
|
115
|
+
* @zui
|
|
116
|
+
* @zgroup ConditionalConstruct
|
|
117
|
+
* @zgrouppriority 100
|
|
118
|
+
*/
|
|
119
|
+
loadAtRuntime = __runInitializers(this, _loadAtRuntime_initializers, false);
|
|
120
|
+
/**
|
|
121
|
+
* @default false
|
|
122
|
+
* @zui
|
|
123
|
+
* @zgroup ConditionalConstruct
|
|
124
|
+
* @zgrouppriority 100
|
|
125
|
+
*/
|
|
126
|
+
loadAtDesignTime = (__runInitializers(this, _loadAtRuntime_extraInitializers), __runInitializers(this, _loadAtDesignTime_initializers, false));
|
|
127
|
+
/**
|
|
128
|
+
* An amount of time to delay any changes to loading state. Use this to give time for a loader to appear before changing the content.
|
|
129
|
+
* @default 0
|
|
130
|
+
* @zui
|
|
131
|
+
* @zgroup ConditionalConstruct
|
|
132
|
+
* @zgrouppriority 100
|
|
133
|
+
* @ztype time-milliseconds
|
|
134
|
+
*/
|
|
135
|
+
delayForLoader = (__runInitializers(this, _loadAtDesignTime_extraInitializers), __runInitializers(this, _delayForLoader_initializers, 0));
|
|
136
|
+
};
|
|
137
|
+
return ConditionalConstruct = _classThis;
|
|
138
|
+
})();
|
|
139
|
+
export { ConditionalConstruct };
|
|
140
|
+
function delay(ms) {
|
|
141
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
142
|
+
}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { Component } from '../component';
|
|
2
2
|
import { ContextManager } from '../context';
|
|
3
|
-
import { Observable } from '../observable';
|
|
4
3
|
export interface DefaultCookieConsentConstructorProps {
|
|
5
4
|
/**
|
|
6
5
|
* Show the cookie consent dialog when the experience starts, rather than when the component is initialized.
|
|
7
|
-
* @
|
|
8
|
-
* @zdefault false
|
|
6
|
+
* @default false
|
|
9
7
|
*/
|
|
10
8
|
waitForStart: boolean;
|
|
11
9
|
/**
|
|
12
10
|
* Only show the cookie consent dialog if the experience contains analytics components that indicate they use cookies.
|
|
13
|
-
* @
|
|
14
|
-
* @zdefault true
|
|
11
|
+
* @default true
|
|
15
12
|
*/
|
|
16
13
|
onlyShowIfVendors: boolean;
|
|
17
14
|
/**
|
|
18
15
|
* Previews how the consent dialog looks at design time.
|
|
19
|
-
* @
|
|
20
|
-
* @zdefault false
|
|
16
|
+
* @default false
|
|
21
17
|
*/
|
|
22
18
|
preview: boolean;
|
|
23
19
|
}
|
|
@@ -28,123 +24,107 @@ export interface DefaultCookieConsentConstructorProps {
|
|
|
28
24
|
* The component handles the logic for displaying the banner, receiving the user's consent, and storing this consent.
|
|
29
25
|
* It also provides methods to check if the user has already given their consent.
|
|
30
26
|
* @zcomponent
|
|
31
|
-
* @zgroup Cookie Consent
|
|
32
27
|
* @zicon cookie
|
|
28
|
+
* @zgroup Cookie Consent
|
|
33
29
|
*/
|
|
34
30
|
export declare class DefaultCookieConsent extends Component {
|
|
35
31
|
constructorProps: DefaultCookieConsentConstructorProps;
|
|
36
32
|
/**
|
|
37
|
-
* @
|
|
33
|
+
* @default "This website uses cookies to store information on your computer."
|
|
34
|
+
* @zui
|
|
38
35
|
* @zgroup Consent Screen
|
|
39
|
-
* @zgrouppriority 20
|
|
40
|
-
* @zdefault "This website uses cookies to store information on your computer."
|
|
41
36
|
*/
|
|
42
|
-
|
|
37
|
+
title: string;
|
|
43
38
|
/**
|
|
44
|
-
* @
|
|
39
|
+
* @default "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."
|
|
40
|
+
* @zui
|
|
45
41
|
* @zgroup Consent Screen
|
|
46
|
-
* @zgrouppriority 20
|
|
47
|
-
* @zdefault "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."
|
|
48
42
|
*/
|
|
49
|
-
|
|
43
|
+
description: string;
|
|
50
44
|
/**
|
|
51
|
-
* @
|
|
45
|
+
* @default "Privacy Policy"
|
|
46
|
+
* @zui
|
|
52
47
|
* @zgroup Settings
|
|
53
|
-
* @zgrouppriority 10
|
|
54
|
-
* @zdefault "Privacy Policy"
|
|
55
48
|
*/
|
|
56
|
-
|
|
49
|
+
privacyPolicyText: string;
|
|
57
50
|
/**
|
|
58
|
-
* @
|
|
51
|
+
* @default ""
|
|
52
|
+
* @zui
|
|
59
53
|
* @zgroup Settings
|
|
60
|
-
* @zgrouppriority 10
|
|
61
|
-
* @zdefault ""
|
|
62
54
|
*/
|
|
63
|
-
|
|
55
|
+
privacyPolicyURL: string;
|
|
64
56
|
/**
|
|
65
|
-
* @
|
|
57
|
+
* @default "I Accept Cookies"
|
|
58
|
+
* @zui
|
|
66
59
|
* @zgroup Consent Screen
|
|
67
|
-
* @zgrouppriority 20
|
|
68
|
-
* @zdefault "I Accept Cookies"
|
|
69
60
|
*/
|
|
70
|
-
|
|
61
|
+
acceptButton: string;
|
|
71
62
|
/**
|
|
72
|
-
* @
|
|
63
|
+
* @default "Settings"
|
|
64
|
+
* @zui
|
|
73
65
|
* @zgroup Consent Screen
|
|
74
|
-
* @zgrouppriority 20
|
|
75
|
-
* @zdefault "Settings"
|
|
76
66
|
*/
|
|
77
|
-
|
|
67
|
+
settingsButton: string;
|
|
78
68
|
/**
|
|
79
|
-
* @
|
|
80
|
-
* @
|
|
81
|
-
* @
|
|
82
|
-
* @zdefault "Save"
|
|
69
|
+
* @default "Save"
|
|
70
|
+
* @zui
|
|
71
|
+
* @zgroup Settings
|
|
83
72
|
*/
|
|
84
|
-
|
|
73
|
+
saveButton: string;
|
|
85
74
|
/**
|
|
86
|
-
* @
|
|
75
|
+
* @default "Essential"
|
|
76
|
+
* @zui
|
|
87
77
|
* @zgroup Settings
|
|
88
|
-
* @zgrouppriority 10
|
|
89
|
-
* @zdefault "Essential"
|
|
90
78
|
*/
|
|
91
|
-
|
|
79
|
+
essentialTitle: string;
|
|
92
80
|
/**
|
|
93
|
-
* @
|
|
81
|
+
* @default "Cookies that are necessary to provide the service."
|
|
82
|
+
* @zui
|
|
94
83
|
* @zgroup Settings
|
|
95
|
-
* @zgrouppriority 10
|
|
96
|
-
* @zdefault "Cookies that are necessary to provide the service."
|
|
97
84
|
*/
|
|
98
|
-
|
|
85
|
+
essentialDescription: string;
|
|
99
86
|
/**
|
|
100
|
-
* @
|
|
87
|
+
* @default "Functional"
|
|
88
|
+
* @zui
|
|
101
89
|
* @zgroup Settings
|
|
102
|
-
* @zgrouppriority 10
|
|
103
|
-
* @zdefault "Functional"
|
|
104
90
|
*/
|
|
105
|
-
|
|
91
|
+
functionalTitle: string;
|
|
106
92
|
/**
|
|
107
|
-
* @
|
|
93
|
+
* @default "Cookies that provide you with useful functionality, such as saving your preferences."
|
|
94
|
+
* @zui
|
|
108
95
|
* @zgroup Settings
|
|
109
|
-
* @zgrouppriority 10
|
|
110
|
-
* @zdefault "Cookies that provide you with useful functionality, such as saving your preferences."
|
|
111
96
|
*/
|
|
112
|
-
|
|
97
|
+
functionalDescription: string;
|
|
113
98
|
/**
|
|
114
|
-
* @
|
|
99
|
+
* @default "Performance"
|
|
100
|
+
* @zui
|
|
115
101
|
* @zgroup Settings
|
|
116
|
-
* @zgrouppriority 10
|
|
117
|
-
* @zdefault "Performance"
|
|
118
102
|
*/
|
|
119
|
-
|
|
103
|
+
performanceTitle: string;
|
|
120
104
|
/**
|
|
121
|
-
* @
|
|
105
|
+
* @default "Cookies that help us measure and understand how the site is being used."
|
|
106
|
+
* @zui
|
|
122
107
|
* @zgroup Settings
|
|
123
|
-
* @zgrouppriority 10
|
|
124
|
-
* @zdefault "Cookies that help us measure and understand how the site is being used."
|
|
125
108
|
*/
|
|
126
|
-
|
|
109
|
+
performanceDescription: string;
|
|
127
110
|
/**
|
|
128
|
-
* @
|
|
111
|
+
* @default "Marketing"
|
|
112
|
+
* @zui
|
|
129
113
|
* @zgroup Settings
|
|
130
|
-
* @zgrouppriority 10
|
|
131
|
-
* @zdefault "Marketing"
|
|
132
114
|
*/
|
|
133
|
-
|
|
115
|
+
marketingTitle: string;
|
|
134
116
|
/**
|
|
135
|
-
* @
|
|
117
|
+
* @default "Cookies that help us market our site and services."
|
|
118
|
+
* @zui
|
|
136
119
|
* @zgroup Settings
|
|
137
|
-
* @zgrouppriority 10
|
|
138
|
-
* @zdefault "Cookies that help us market our site and services."
|
|
139
120
|
*/
|
|
140
|
-
|
|
121
|
+
marketingDescription: string;
|
|
141
122
|
/**
|
|
142
|
-
* @
|
|
123
|
+
* @default "Required"
|
|
124
|
+
* @zui
|
|
143
125
|
* @zgroup Settings
|
|
144
|
-
* @zgrouppriority 10
|
|
145
|
-
* @zdefault "Required"
|
|
146
126
|
*/
|
|
147
|
-
|
|
127
|
+
required: string;
|
|
148
128
|
private _dom;
|
|
149
129
|
private _functional;
|
|
150
130
|
private _performance;
|