@zcomponent/core 1.21.1-beta → 1.22.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -1
- package/lib/animation/animation.d.ts +4 -0
- package/lib/animation/animation.js +4 -0
- package/lib/animation/layer.d.ts +1 -0
- package/lib/animation/layer.js +17 -4
- package/lib/animation/layerclip.js +6 -6
- package/lib/components/DefaultCookieConsent.js +1 -4
- package/lib/data/change.js +1 -1
- package/lib/fractionalindexing.js +1 -0
- package/lib/observable.js +3 -0
- package/lib/selectors.js +1 -3
- package/lib/types.js +3 -1
- package/package.json +59 -20
package/index.js
CHANGED
package/lib/animation/layer.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ export declare class Layer {
|
|
|
100
100
|
_activateLayerClip(layerClip: LayerClip | null | undefined, playOptions?: LayerClipPlayOptions): void;
|
|
101
101
|
/** @internal */
|
|
102
102
|
_evaulate(): void;
|
|
103
|
+
private _getTime;
|
|
103
104
|
/** @internal */
|
|
104
105
|
_serialize(state: AnimationState): void;
|
|
105
106
|
/** @internal */
|
package/lib/animation/layer.js
CHANGED
|
@@ -69,6 +69,8 @@ export class Layer {
|
|
|
69
69
|
if (next && next.startTime && next.startTime && entry !== this._active && t - next.startTime > next.fadeTime) {
|
|
70
70
|
entry.layerClip?.pause();
|
|
71
71
|
this._queue.splice(i, 1);
|
|
72
|
+
if (entry.layerClip)
|
|
73
|
+
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipState, args: [entry.layerClip] });
|
|
72
74
|
}
|
|
73
75
|
if (entry.layerClip && entry === this._active) {
|
|
74
76
|
if (next && (entry.layerClip.state.value === StreamState.Ended || next.fadeTime >= entry.layerClip.getRemainingTimeEstimate())) {
|
|
@@ -181,6 +183,9 @@ export class Layer {
|
|
|
181
183
|
_evaulate() {
|
|
182
184
|
this.animation.evaluateTouchedPaths([...this.influencedPaths.values()]);
|
|
183
185
|
}
|
|
186
|
+
_getTime() {
|
|
187
|
+
return Math.floor(this.animation.timeSource?.() ?? performance.now());
|
|
188
|
+
}
|
|
184
189
|
/** @internal */
|
|
185
190
|
_serialize(state) {
|
|
186
191
|
for (const layerClip of this._layerClips) {
|
|
@@ -191,13 +196,17 @@ export class Layer {
|
|
|
191
196
|
const entry = {
|
|
192
197
|
queue: [],
|
|
193
198
|
};
|
|
199
|
+
const timeOfSerialization = this._getTime();
|
|
194
200
|
for (const queueEntry of this._queue) {
|
|
195
201
|
if (queueEntry.layerClip && queueEntry.layerClip.id === undefined)
|
|
196
202
|
continue;
|
|
197
|
-
|
|
203
|
+
const mqe = {
|
|
198
204
|
...queueEntry,
|
|
199
205
|
layerClip: queueEntry.layerClip === null ? null : queueEntry.layerClip?.id,
|
|
200
|
-
}
|
|
206
|
+
};
|
|
207
|
+
if (mqe.startTime !== undefined)
|
|
208
|
+
mqe.startTime -= timeOfSerialization;
|
|
209
|
+
entry.queue.push(mqe);
|
|
201
210
|
}
|
|
202
211
|
entry.active = this._active === null ? null : this._active === undefined ? undefined : this._queue.indexOf(this._active);
|
|
203
212
|
state.byLayer[this.id] = entry;
|
|
@@ -213,6 +222,7 @@ export class Layer {
|
|
|
213
222
|
if (!entry)
|
|
214
223
|
return;
|
|
215
224
|
this._queue = [];
|
|
225
|
+
const timeOfSerialization = this._getTime();
|
|
216
226
|
for (const qe of entry.queue) {
|
|
217
227
|
let layerClip;
|
|
218
228
|
if (typeof qe.layerClip === 'string') {
|
|
@@ -221,10 +231,13 @@ export class Layer {
|
|
|
221
231
|
else if (qe.layerClip === null)
|
|
222
232
|
layerClip = null;
|
|
223
233
|
if (layerClip !== undefined) {
|
|
224
|
-
|
|
234
|
+
const mqe = {
|
|
225
235
|
...qe,
|
|
226
236
|
layerClip,
|
|
227
|
-
}
|
|
237
|
+
};
|
|
238
|
+
if (mqe.startTime !== undefined)
|
|
239
|
+
mqe.startTime += timeOfSerialization;
|
|
240
|
+
this._queue.push(mqe);
|
|
228
241
|
}
|
|
229
242
|
}
|
|
230
243
|
if (typeof entry.active === 'number') {
|
|
@@ -262,9 +262,9 @@ export class LayerClip {
|
|
|
262
262
|
if (this.id === undefined)
|
|
263
263
|
return;
|
|
264
264
|
const timeOfSerialization = this._getTime();
|
|
265
|
-
const t0 =
|
|
266
|
-
const pauseTime = this._pauseTime === undefined ? undefined :
|
|
267
|
-
const t1 = isFinite(this._t1) ?
|
|
265
|
+
const t0 = this._t0 - timeOfSerialization;
|
|
266
|
+
const pauseTime = this._pauseTime === undefined ? undefined : this._pauseTime - timeOfSerialization;
|
|
267
|
+
const t1 = isFinite(this._t1) ? this._t1 - timeOfSerialization : null;
|
|
268
268
|
const ret = {
|
|
269
269
|
t0,
|
|
270
270
|
t1,
|
|
@@ -284,9 +284,9 @@ export class LayerClip {
|
|
|
284
284
|
if (!entry)
|
|
285
285
|
return;
|
|
286
286
|
const timeOfDeserialization = this._getTime();
|
|
287
|
-
this._t0 = timeOfDeserialization
|
|
288
|
-
this._t1 = entry.t1 === null ? Infinity : timeOfDeserialization
|
|
289
|
-
this._pauseTime = entry.pauseTime === undefined ? undefined : timeOfDeserialization
|
|
287
|
+
this._t0 = timeOfDeserialization + entry.t0;
|
|
288
|
+
this._t1 = entry.t1 === null ? Infinity : timeOfDeserialization + entry.t1;
|
|
289
|
+
this._pauseTime = entry.pauseTime === undefined ? undefined : timeOfDeserialization + entry.pauseTime;
|
|
290
290
|
this._rate = entry.rate;
|
|
291
291
|
this._loop = entry.loop;
|
|
292
292
|
this._stopped = entry.stopped;
|
|
@@ -301,10 +301,7 @@ export class DefaultCookieConsent extends Component {
|
|
|
301
301
|
if (isDesignTime(this.contextManager) && !designTimeOverride)
|
|
302
302
|
return;
|
|
303
303
|
const context = this.contextManager.get(CookieConsentContext);
|
|
304
|
-
if (context.functionalCookies.value !== ConsentStatus.unknown &&
|
|
305
|
-
context.marketingCookies.value !== ConsentStatus.unknown &&
|
|
306
|
-
context.performanceCookies.value !== ConsentStatus.unknown &&
|
|
307
|
-
!designTimeOverride)
|
|
304
|
+
if (context.functionalCookies.value !== ConsentStatus.unknown && context.marketingCookies.value !== ConsentStatus.unknown && context.performanceCookies.value !== ConsentStatus.unknown && !designTimeOverride)
|
|
308
305
|
return;
|
|
309
306
|
this._loadDOM(isSettings);
|
|
310
307
|
const acceptedEssential = window.localStorage.getItem('zcomponent-cookieconsent-essential');
|
package/lib/data/change.js
CHANGED
|
@@ -180,7 +180,7 @@ export function deleteEntityPropOverride(zcomp, id) {
|
|
|
180
180
|
* @returns The unique ID for the EntityPropOverride.
|
|
181
181
|
*/
|
|
182
182
|
function idForEntityPropOverride(override) {
|
|
183
|
-
return
|
|
183
|
+
return override.type + ':' + (override.entityPropIsConstructor ? 'constructorprop' : 'prop') + ':' + override.entityID + ':' + override.entityPropPath.join('.');
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
186
186
|
* Deep clones the given object.
|
package/lib/observable.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
2
|
+
/* eslint-disable @typescript-eslint/adjacent-overload-signatures */
|
|
1
3
|
import { Emitter } from './emitter';
|
|
2
4
|
/**
|
|
3
5
|
* A class that holds a value and watches it for changes (deeply by default).
|
|
@@ -114,6 +116,7 @@ export class Observable extends Emitter {
|
|
|
114
116
|
this._emit(this._value.proxy);
|
|
115
117
|
}
|
|
116
118
|
setValueAtPath(path, val) {
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
117
120
|
let target = this;
|
|
118
121
|
let key = 'value';
|
|
119
122
|
for (let i = 0; i < path.length; i++) {
|
package/lib/selectors.js
CHANGED
|
@@ -342,9 +342,7 @@ ${Object.entries(scriptNames ?? {})
|
|
|
342
342
|
.map(entry => {
|
|
343
343
|
const values = Object.keys(entry[1]);
|
|
344
344
|
if (values.length > 1) {
|
|
345
|
-
return `\t\t${entry[0]}: {${values
|
|
346
|
-
.map(e => `${JSON.stringify(e)}: ${importMapping.get(nodes[e].type)}${getBehaviorBlockForNode(behaviors, behaviorsByNodeID[nodes[e].id] ?? [], importMapping)}`)
|
|
347
|
-
.join(', ')}},`;
|
|
345
|
+
return `\t\t${entry[0]}: {${values.map(e => `${JSON.stringify(e)}: ${importMapping.get(nodes[e].type)}${getBehaviorBlockForNode(behaviors, behaviorsByNodeID[nodes[e].id] ?? [], importMapping)}`).join(', ')}},`;
|
|
348
346
|
}
|
|
349
347
|
else {
|
|
350
348
|
return `\t\t${entry[0]}: ${importMapping.get(nodes[values[0]].type)}${getBehaviorBlockForNode(behaviors, behaviorsByNodeID[nodes[values[0]].id] ?? [], importMapping)},`;
|
package/lib/types.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-case-declarations */
|
|
2
|
+
import { EntityPropOverrideType, FunctionCallType } from './data/core';
|
|
2
3
|
import { getSafeKeyName } from './selectors';
|
|
3
4
|
/**
|
|
4
5
|
* Enumeration of type names used in type definitions.
|
|
@@ -52,6 +53,7 @@ export var TypeHint;
|
|
|
52
53
|
*
|
|
53
54
|
* This enum lists different kinds of values types that can be used in a values definition, representing various data sources or formats.
|
|
54
55
|
*/
|
|
56
|
+
// If you add a new value here, please also add it to typeinfo.ts > ZAnnotationValue
|
|
55
57
|
export var ValuesType;
|
|
56
58
|
(function (ValuesType) {
|
|
57
59
|
ValuesType["files"] = "files";
|
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zcomponent/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0-beta.1",
|
|
4
4
|
"description": "The core component model and built-in functionality for Mattercraft.",
|
|
5
|
+
"author": "Zappar Limited",
|
|
6
|
+
"license": "Proprietary",
|
|
5
7
|
"main": "index.js",
|
|
6
8
|
"types": "index.d.ts",
|
|
9
|
+
"type": "module",
|
|
7
10
|
"engines": {
|
|
8
11
|
"node": ">=12.0.0",
|
|
9
12
|
"browsers": "defaults"
|
|
10
13
|
},
|
|
11
|
-
"
|
|
14
|
+
"zexports": [
|
|
15
|
+
"./lib/components/**/*",
|
|
16
|
+
"./lib/behaviors/**/*",
|
|
17
|
+
"./lib/contexts/**/*"
|
|
18
|
+
],
|
|
12
19
|
"directories": {
|
|
13
20
|
"lib": "lib"
|
|
14
21
|
},
|
|
@@ -20,27 +27,59 @@
|
|
|
20
27
|
"assets/**/*"
|
|
21
28
|
],
|
|
22
29
|
"scripts": {
|
|
23
|
-
"build": "rm -rf lib && tsc",
|
|
24
|
-
"build-animation-tests": "tsc -p ./tsconfig.test.animation.json",
|
|
25
|
-
"test": "env TS_NODE_PROJECT=\"tsconfig.testing.json\" mocha --es-module-specifier-resolution=node",
|
|
30
|
+
"build": "rm -rf lib && tsc && tsc-alias",
|
|
26
31
|
"watch": "tsc -w",
|
|
27
|
-
"
|
|
28
|
-
"docs": "typedoc"
|
|
32
|
+
"prepack": "npm run build",
|
|
33
|
+
"docs": "typedoc --out docs",
|
|
34
|
+
"test": "env TS_NODE_PROJECT=\"tsconfig.testing.json\" mocha --es-module-specifier-resolution=node",
|
|
35
|
+
"build-animation-tests": "tsc -p ./tsconfig.test.animation.json",
|
|
36
|
+
"predocs": "npm run ctix",
|
|
37
|
+
"ctix": "ctix build"
|
|
29
38
|
},
|
|
30
|
-
"author": "Zappar Limited",
|
|
31
|
-
"license": "Proprietary",
|
|
32
39
|
"devDependencies": {
|
|
33
40
|
"@types/mocha": "^10.0.1",
|
|
34
|
-
"
|
|
35
|
-
"mocha": "^10.2.0",
|
|
36
|
-
"ts-node": "^10.9.1",
|
|
37
|
-
"typedoc": "^0.24.8",
|
|
38
|
-
"typedoc-plugin-mdn-links": "^3.1.7",
|
|
39
|
-
"typescript": "^4.9.4"
|
|
41
|
+
"mocha": "^10.2.0"
|
|
40
42
|
},
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
43
|
+
"keywords": [],
|
|
44
|
+
"release": {
|
|
45
|
+
"extends": "semantic-release-commit-filter",
|
|
46
|
+
"ci": true,
|
|
47
|
+
"branches": [
|
|
48
|
+
"main",
|
|
49
|
+
{
|
|
50
|
+
"name": "beta",
|
|
51
|
+
"channel": "beta",
|
|
52
|
+
"prerelease": "beta"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "alpha",
|
|
56
|
+
"channel": "alpha",
|
|
57
|
+
"prerelease": "alpha"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"plugins": [
|
|
61
|
+
"@semantic-release/commit-analyzer",
|
|
62
|
+
"@semantic-release/release-notes-generator",
|
|
63
|
+
"@semantic-release/changelog",
|
|
64
|
+
"@semantic-release/npm",
|
|
65
|
+
"@semantic-release/gitlab",
|
|
66
|
+
"@semantic-release/git",
|
|
67
|
+
[
|
|
68
|
+
"@rimac-technology/semantic-release-s3",
|
|
69
|
+
{
|
|
70
|
+
"s3Bucket": {
|
|
71
|
+
"main": "mattercraft-api-docs/prod",
|
|
72
|
+
"beta": "mattercraft-api-docs-beta",
|
|
73
|
+
"alpha": "mattercraft-api-docs-alpha"
|
|
74
|
+
},
|
|
75
|
+
"directoryPath": "../../docs/**/*",
|
|
76
|
+
"objectACL": "",
|
|
77
|
+
"removeDirectoryRoot": true,
|
|
78
|
+
"awsAccessKeyName": "DOCS_AWS_ACCESS_KEY_ID",
|
|
79
|
+
"awsSecretAccessKeyName": "DOCS_AWS_SECRET_ACCESS_KEY"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
],
|
|
83
|
+
"tagFormat": "@zcomponent/core@${version}"
|
|
84
|
+
}
|
|
46
85
|
}
|