@zcomponent/core 1.28.0 → 1.29.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.
@@ -8,9 +8,14 @@ export declare class Bezier {
8
8
  private _curveEvaluator;
9
9
  /**
10
10
  * Creates an instance of Bezier.
11
- * @param _curves An array of control points for each Bezier curve segment.
11
+ * @param curves An array of control points for each Bezier curve segment.
12
12
  */
13
- constructor(_curves: BezierData[]);
13
+ constructor(curves: BezierData[]);
14
+ /**
15
+ * Updates the curves without creating a new instance.
16
+ * @param curves An array of control points for each Bezier curve segment.
17
+ */
18
+ updateCurves(curves: BezierData[]): void;
14
19
  evaluate(t: number, epsilon?: number): number;
15
20
  }
16
21
  /**
@@ -55,12 +55,21 @@ function BezierFactory(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
55
55
  export class Bezier {
56
56
  /**
57
57
  * Creates an instance of Bezier.
58
- * @param _curves An array of control points for each Bezier curve segment.
58
+ * @param curves An array of control points for each Bezier curve segment.
59
59
  */
60
- constructor(_curves) {
61
- this._curves = _curves;
60
+ constructor(curves) {
61
+ this._curves = [];
62
62
  this._curveEvaluator = [];
63
- for (const curve of _curves) {
63
+ this.updateCurves(curves);
64
+ }
65
+ /**
66
+ * Updates the curves without creating a new instance.
67
+ * @param curves An array of control points for each Bezier curve segment.
68
+ */
69
+ updateCurves(curves) {
70
+ this._curves = curves;
71
+ this._curveEvaluator = [];
72
+ for (const curve of curves) {
64
73
  this._curveEvaluator.push(BezierFactory(curve[0][0], curve[0][1], curve[1][0], curve[1][1], curve[2][0], curve[2][1], curve[3][0], curve[3][1]));
65
74
  }
66
75
  }
@@ -0,0 +1,39 @@
1
+ import { ActionBehavior, ActionBehaviorConstructorProps } from '../actionbehavior';
2
+ import { Component } from '../component';
3
+ import { ContextManager } from '../context';
4
+ import { Observable } from '../observable';
5
+ /**
6
+ * Enum for different cursor styles
7
+ */
8
+ export declare enum CursorStyle {
9
+ Default = "default",
10
+ Pointer = "pointer",
11
+ Move = "move",
12
+ Grab = "grab",
13
+ Grabbing = "grabbing",
14
+ Wait = "wait",
15
+ Text = "text",
16
+ NotAllowed = "not-allowed",
17
+ ZoomIn = "zoom-in",
18
+ ZoomOut = "zoom-out"
19
+ }
20
+ /**
21
+ * Action behavior to change the cursor style.
22
+ * @zbehavior
23
+ * @zicon mouse
24
+ * @zgroup Actions
25
+ */
26
+ export declare class ChangeCursor extends ActionBehavior {
27
+ /**
28
+ * The cursor style to apply.
29
+ * @zprop
30
+ * @zdefault default
31
+ */
32
+ cursorStyle: Observable<CursorStyle, never>;
33
+ constructor(contextManager: ContextManager, instance: Component, props: ActionBehaviorConstructorProps);
34
+ /**
35
+ * Performs the cursor change action.
36
+ * @zprop
37
+ */
38
+ perform(): void;
39
+ }
@@ -0,0 +1,44 @@
1
+ import { ActionBehavior } from '../actionbehavior';
2
+ import { registerBehaviorRunAtDesignTime } from '../behavior';
3
+ import { Observable } from '../observable';
4
+ /**
5
+ * Enum for different cursor styles
6
+ */
7
+ export var CursorStyle;
8
+ (function (CursorStyle) {
9
+ CursorStyle["Default"] = "default";
10
+ CursorStyle["Pointer"] = "pointer";
11
+ CursorStyle["Move"] = "move";
12
+ CursorStyle["Grab"] = "grab";
13
+ CursorStyle["Grabbing"] = "grabbing";
14
+ CursorStyle["Wait"] = "wait";
15
+ CursorStyle["Text"] = "text";
16
+ CursorStyle["NotAllowed"] = "not-allowed";
17
+ CursorStyle["ZoomIn"] = "zoom-in";
18
+ CursorStyle["ZoomOut"] = "zoom-out";
19
+ })(CursorStyle || (CursorStyle = {}));
20
+ /**
21
+ * Action behavior to change the cursor style.
22
+ * @zbehavior
23
+ * @zicon mouse
24
+ * @zgroup Actions
25
+ */
26
+ export class ChangeCursor extends ActionBehavior {
27
+ constructor(contextManager, instance, props) {
28
+ super(contextManager, instance, props);
29
+ /**
30
+ * The cursor style to apply.
31
+ * @zprop
32
+ * @zdefault default
33
+ */
34
+ this.cursorStyle = new Observable(CursorStyle.Default);
35
+ }
36
+ /**
37
+ * Performs the cursor change action.
38
+ * @zprop
39
+ */
40
+ perform() {
41
+ document.body.style.cursor = this.cursorStyle.value;
42
+ }
43
+ }
44
+ registerBehaviorRunAtDesignTime(ChangeCursor);
package/lib/types.d.ts CHANGED
@@ -167,7 +167,8 @@ export declare enum TypeHint {
167
167
  'time-hertz' = "time-hertz",
168
168
  'emailaddress' = "emailaddress",
169
169
  'url' = "url",
170
- 'function-emit-component-prop-event' = "function-emit-component-prop-event"
170
+ 'function-emit-component-prop-event' = "function-emit-component-prop-event",
171
+ 'animationcurve' = "animationcurve"
171
172
  }
172
173
  /**
173
174
  * Enumeration of values types used in a values definition.
package/lib/types.js CHANGED
@@ -47,6 +47,7 @@ export var TypeHint;
47
47
  TypeHint["emailaddress"] = "emailaddress";
48
48
  TypeHint["url"] = "url";
49
49
  TypeHint["function-emit-component-prop-event"] = "function-emit-component-prop-event";
50
+ TypeHint["animationcurve"] = "animationcurve";
50
51
  })(TypeHint || (TypeHint = {}));
51
52
  /**
52
53
  * Enumeration of values types used in a values definition.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/core",
3
- "version": "1.28.0",
3
+ "version": "1.29.0-beta.1",
4
4
  "description": "The core component model and built-in functionality for Mattercraft.",
5
5
  "author": "Zappar Limited",
6
6
  "license": "Proprietary",