@motionscript/grids 0.1.0-alpha.5 → 0.1.0-alpha.7

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +47 -15
  3. package/dist/browser/chunks/chunk-J62D7EFZ.js +2 -0
  4. package/dist/browser/chunks/chunk-J62D7EFZ.js.map +7 -0
  5. package/dist/browser/index.js +1 -1
  6. package/dist/browser/index.js.map +3 -3
  7. package/dist/browser/kit.js +1 -1
  8. package/dist/browser/manifest.json +1 -1
  9. package/dist/engine.d.ts +4 -4
  10. package/dist/engine.js +4 -4
  11. package/dist/engine.js.map +1 -1
  12. package/dist/kit/index.d.ts +3 -1
  13. package/dist/kit/index.d.ts.map +1 -1
  14. package/dist/kit/index.js +4 -1
  15. package/dist/kit/index.js.map +1 -1
  16. package/dist/kit/item-grid.d.ts +203 -198
  17. package/dist/kit/item-grid.d.ts.map +1 -1
  18. package/dist/kit/item-grid.js +413 -440
  19. package/dist/kit/item-grid.js.map +1 -1
  20. package/dist/nodes.d.ts +8 -3
  21. package/dist/nodes.d.ts.map +1 -1
  22. package/dist/nodes.js +6 -10
  23. package/dist/nodes.js.map +1 -1
  24. package/dist/path-grid/path-grid.d.ts +187 -73
  25. package/dist/path-grid/path-grid.d.ts.map +1 -1
  26. package/dist/path-grid/path-grid.js +129 -172
  27. package/dist/path-grid/path-grid.js.map +1 -1
  28. package/dist/radial-grid/radial-grid.d.ts +171 -45
  29. package/dist/radial-grid/radial-grid.d.ts.map +1 -1
  30. package/dist/radial-grid/radial-grid.js +55 -87
  31. package/dist/radial-grid/radial-grid.js.map +1 -1
  32. package/dist/rectangular-grid/rectangular-grid.d.ts +203 -70
  33. package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -1
  34. package/dist/rectangular-grid/rectangular-grid.js +107 -145
  35. package/dist/rectangular-grid/rectangular-grid.js.map +1 -1
  36. package/dist/sphere-grid/sphere-grid.d.ts +192 -60
  37. package/dist/sphere-grid/sphere-grid.d.ts.map +1 -1
  38. package/dist/sphere-grid/sphere-grid.js +90 -137
  39. package/dist/sphere-grid/sphere-grid.js.map +1 -1
  40. package/package.json +4 -4
  41. package/src/engine.ts +4 -4
  42. package/src/kit/index.ts +13 -1
  43. package/src/kit/item-grid.ts +505 -442
  44. package/src/nodes.ts +18 -3
  45. package/src/path-grid/path-grid.ts +137 -164
  46. package/src/radial-grid/radial-grid.ts +69 -78
  47. package/src/rectangular-grid/rectangular-grid.ts +118 -133
  48. package/src/sphere-grid/sphere-grid.ts +103 -117
  49. package/dist/browser/chunks/chunk-XDUDKWM7.js +0 -2
  50. package/dist/browser/chunks/chunk-XDUDKWM7.js.map +0 -7
@@ -1,51 +1,177 @@
1
- import { type Command, type CommandArgs, type NodeConfig } from "@motionscript/sdk";
2
- import { ItemGrid, type ItemGridProps, type RadialArrangement, type RadialDirection } from "../kit/index.js";
3
- export interface RadialGridProps extends ItemGridProps {
4
- radius: number;
5
- startAngle: number;
6
- sweep: number;
7
- direction: RadialDirection;
8
- rotateItems: boolean;
9
- spinSpeed: number;
10
- }
1
+ import { type NodeOf, type Node2D as _Node2D, type Node2DProps as _Node2DProps } from "@motionscript/sdk";
2
+ import { ItemGrid } from "../kit/index.js";
11
3
  /**
12
4
  * Children round a circle, or along an arc of one.
13
5
  *
14
6
  * A full circle spaces the items evenly with none on top of another; an arc
15
- * puts one at each end. Angles run clockwise from twelve o'clock, so
16
- * {@link turnTo} can bring any item to the top like a dial.
7
+ * puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`
8
+ * can bring any item to the top like a dial.
17
9
  */
18
- export declare class RadialGrid extends ItemGrid<RadialGridProps> {
19
- radius: number;
20
- startAngle: number;
21
- sweep: number;
22
- direction: RadialDirection;
23
- rotateItems: boolean;
24
- spinSpeed: number;
25
- constructor(props?: NodeConfig<RadialGrid, RadialGridProps>);
26
- /** Orbit the items round the centre by `degrees` — `360` is one full turn. */
27
- spin(args: CommandArgs<{
28
- degrees?: number;
29
- }> & {
30
- duration: number;
31
- }): Command<RadialGridProps>;
32
- /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */
33
- turnTo(args: CommandArgs<{
34
- item?: number;
35
- }> & {
36
- duration: number;
37
- }): Command<RadialGridProps>;
38
- radiusTo(args: CommandArgs<{
39
- radius: number;
40
- }> & {
41
- duration: number;
42
- }): Command<RadialGridProps>;
43
- /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */
44
- sweepTo(args: CommandArgs<{
45
- sweep: number;
46
- }> & {
47
- duration: number;
48
- }): Command<RadialGridProps>;
49
- protected arrangementFor(): RadialArrangement;
50
- }
10
+ export declare const RadialGrid: import("@motionscript/sdk").Component<"radialGrid", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
11
+ readonly radius: import("@motionscript/sdk").Type<number, number, false>;
12
+ readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
13
+ readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
14
+ readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
15
+ readonly rotateItems: boolean;
16
+ readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
17
+ readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
18
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
19
+ readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
20
+ readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
21
+ readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
22
+ readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
23
+ readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
24
+ readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
25
+ }>, {
26
+ readonly spin: {
27
+ readonly degrees: import("@motionscript/sdk").Type<number, number, false>;
28
+ };
29
+ readonly turnTo: {
30
+ readonly item: import("@motionscript/sdk").Type<number, number, false>;
31
+ };
32
+ readonly radiusTo: {
33
+ readonly radius: import("@motionscript/sdk").Type<280 | undefined, 280 | undefined, false>;
34
+ };
35
+ readonly sweepTo: {
36
+ readonly sweep: import("@motionscript/sdk").Type<360 | undefined, 360 | undefined, false>;
37
+ };
38
+ readonly reveal: {
39
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
40
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
41
+ readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
42
+ };
43
+ readonly conceal: {
44
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
45
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
46
+ readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
47
+ };
48
+ readonly wave: {
49
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
50
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
51
+ readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
52
+ readonly amount: import("@motionscript/sdk").Type<number, number, false>;
53
+ };
54
+ readonly focus: {
55
+ readonly item: import("@motionscript/sdk").Type<number, number, false>;
56
+ readonly dim: import("@motionscript/sdk").Type<number, number, false>;
57
+ readonly grow: import("@motionscript/sdk").Type<number, number, false>;
58
+ };
59
+ readonly unfocus: unknown;
60
+ readonly spreadTo: {
61
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
62
+ };
63
+ readonly shuffle: {
64
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
65
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
66
+ readonly seed: import("@motionscript/sdk").Type<number, number, false>;
67
+ };
68
+ readonly swap: {
69
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
70
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
71
+ readonly first: import("@motionscript/sdk").Type<number, number, false>;
72
+ readonly second: import("@motionscript/sdk").Type<number, number, false>;
73
+ };
74
+ readonly reorder: {
75
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
76
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
77
+ readonly order: import("@motionscript/sdk").Type<string, string, false>;
78
+ };
79
+ readonly morphInto: {
80
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
81
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
82
+ readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
83
+ };
84
+ }, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
85
+ readonly radius: import("@motionscript/sdk").Type<number, number, false>;
86
+ readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
87
+ readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
88
+ readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
89
+ readonly rotateItems: boolean;
90
+ readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
91
+ readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
92
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
93
+ readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
94
+ readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
95
+ readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
96
+ readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
97
+ readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
98
+ readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
99
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
100
+ readonly radius: import("@motionscript/sdk").Type<number, number, false>;
101
+ readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
102
+ readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
103
+ readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
104
+ readonly rotateItems: boolean;
105
+ readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
106
+ readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
107
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
108
+ readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
109
+ readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
110
+ readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
111
+ readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
112
+ readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
113
+ readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
114
+ }>, {
115
+ readonly spin: {
116
+ readonly degrees: import("@motionscript/sdk").Type<number, number, false>;
117
+ };
118
+ readonly turnTo: {
119
+ readonly item: import("@motionscript/sdk").Type<number, number, false>;
120
+ };
121
+ readonly radiusTo: {
122
+ readonly radius: import("@motionscript/sdk").Type<280 | undefined, 280 | undefined, false>;
123
+ };
124
+ readonly sweepTo: {
125
+ readonly sweep: import("@motionscript/sdk").Type<360 | undefined, 360 | undefined, false>;
126
+ };
127
+ readonly reveal: {
128
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
129
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
130
+ readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
131
+ };
132
+ readonly conceal: {
133
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
134
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
135
+ readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
136
+ };
137
+ readonly wave: {
138
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
139
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
140
+ readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
141
+ readonly amount: import("@motionscript/sdk").Type<number, number, false>;
142
+ };
143
+ readonly focus: {
144
+ readonly item: import("@motionscript/sdk").Type<number, number, false>;
145
+ readonly dim: import("@motionscript/sdk").Type<number, number, false>;
146
+ readonly grow: import("@motionscript/sdk").Type<number, number, false>;
147
+ };
148
+ readonly unfocus: unknown;
149
+ readonly spreadTo: {
150
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
151
+ };
152
+ readonly shuffle: {
153
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
154
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
155
+ readonly seed: import("@motionscript/sdk").Type<number, number, false>;
156
+ };
157
+ readonly swap: {
158
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
159
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
160
+ readonly first: import("@motionscript/sdk").Type<number, number, false>;
161
+ readonly second: import("@motionscript/sdk").Type<number, number, false>;
162
+ };
163
+ readonly reorder: {
164
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
165
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
166
+ readonly order: import("@motionscript/sdk").Type<string, string, false>;
167
+ };
168
+ readonly morphInto: {
169
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
170
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
171
+ readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
172
+ };
173
+ }, _Node2D<_Node2DProps>>>>;
174
+ export type RadialGrid = NodeOf<typeof RadialGrid>;
175
+ /** What a call or a document row may set. */
176
+ export type RadialGridProps = NonNullable<Parameters<typeof RadialGrid>[0]>;
51
177
  //# sourceMappingURL=radial-grid.d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AW,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAIhG,mFAAmF;IAEnF,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;cAI3E,cAAc,IAAI,iBAAiB;CAWvD"}
1
+ {"version":3,"file":"radial-grid.d.ts","sourceRoot":"","sources":["../../src/radial-grid/radial-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EAGX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EACjC,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,QAAQ,EAA8E,MAAM,QAAQ,CAAA;AA2B7G;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAgCV,CAAA;AAEb,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAA;AAClD,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -1,95 +1,63 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ import { component2d, Types, } from "@motionscript/sdk";
2
+ import { ItemGrid, normalizeOrder, RADIAL_DIRECTIONS, radialTurnToTop } from "../kit/index.js";
3
+ const own = {
4
+ radius: Types.number(200, { min: 0, step: 1 }),
5
+ startAngle: Types.number(0, { step: 1, unit: "°" }),
6
+ sweep: Types.number(360, { min: -360, max: 360, step: 1, unit: "°" }),
7
+ direction: Types.oneOf(RADIAL_DIRECTIONS, { default: "clockwise" }),
8
+ rotateItems: false,
9
+ spinSpeed: Types.number(0, { step: 1, unit: "°/s" }),
6
10
  };
7
- import { command, node, property } from "@motionscript/sdk";
8
- import { ItemGrid, normalizeOrder, RADIAL_DIRECTIONS, radialTurnToTop, } from "../kit/index.js";
11
+ function arrangement(s) {
12
+ return {
13
+ kind: "radial",
14
+ radius: s.radius,
15
+ startAngle: s.startAngle,
16
+ sweep: s.sweep,
17
+ direction: s.direction,
18
+ rotateItems: s.rotateItems,
19
+ spinSpeed: s.spinSpeed,
20
+ };
21
+ }
22
+ const arranger = { arrangement };
9
23
  /**
10
24
  * Children round a circle, or along an arc of one.
11
25
  *
12
26
  * A full circle spaces the items evenly with none on top of another; an arc
13
- * puts one at each end. Angles run clockwise from twelve o'clock, so
14
- * {@link turnTo} can bring any item to the top like a dial.
27
+ * puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`
28
+ * can bring any item to the top like a dial.
15
29
  */
16
- let RadialGrid = class RadialGrid extends ItemGrid {
17
- constructor(props) {
18
- super(props);
19
- }
20
- /** Orbit the items round the centre by `degrees` — `360` is one full turn. */
21
- spin(args) {
22
- const degrees = args.data?.degrees ?? 360;
23
- return this.to({ data: { startAngle: this.startAngle + degrees }, duration: args.duration, easing: args.easing });
24
- }
25
- /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */
26
- turnTo(args) {
27
- const count = this._itemCount();
28
- const slot = normalizeOrder(this.order, count).indexOf(Math.round(args.data?.item ?? 0));
29
- const turn = slot < 0 ? 0 : radialTurnToTop(this.arrangementFor(), count, slot);
30
- return this.to({ data: { startAngle: this.startAngle + turn }, duration: args.duration, easing: args.easing });
31
- }
32
- radiusTo(args) {
33
- return this.to({ data: { radius: args.data?.radius ?? this.radius }, duration: args.duration, easing: args.easing });
34
- }
35
- /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */
36
- sweepTo(args) {
37
- return this.to({ data: { sweep: args.data?.sweep ?? this.sweep }, duration: args.duration, easing: args.easing });
38
- }
39
- arrangementFor() {
40
- return {
41
- kind: "radial",
42
- radius: this.radius,
43
- startAngle: this.startAngle,
44
- sweep: this.sweep,
45
- direction: this.direction,
46
- rotateItems: this.rotateItems,
47
- spinSpeed: this.spinSpeed,
48
- };
49
- }
50
- };
51
- __decorate([
52
- property({ default: 200, min: 0, step: 1 })
53
- ], RadialGrid.prototype, "radius", void 0);
54
- __decorate([
55
- property({ default: 0, step: 1, unit: "°" })
56
- ], RadialGrid.prototype, "startAngle", void 0);
57
- __decorate([
58
- property({ default: 360, min: -360, max: 360, step: 1, unit: "°" })
59
- ], RadialGrid.prototype, "sweep", void 0);
60
- __decorate([
61
- property({ default: "clockwise", kind: "enum", options: RADIAL_DIRECTIONS })
62
- ], RadialGrid.prototype, "direction", void 0);
63
- __decorate([
64
- property({ default: false })
65
- ], RadialGrid.prototype, "rotateItems", void 0);
66
- __decorate([
67
- property({ default: 0, step: 1, unit: "°/s" })
68
- ], RadialGrid.prototype, "spinSpeed", void 0);
69
- __decorate([
70
- command({ args: [{ key: "degrees", step: 15, unit: "°", default: 360 }] })
71
- ], RadialGrid.prototype, "spin", null);
72
- __decorate([
73
- command({ args: [{ key: "item", min: 0, step: 1, default: 0 }] })
74
- ], RadialGrid.prototype, "turnTo", null);
75
- __decorate([
76
- command({ args: [{ key: "radius", min: 0, default: 280 }] })
77
- ], RadialGrid.prototype, "radiusTo", null);
78
- __decorate([
79
- command({ args: [{ key: "sweep", min: -360, max: 360, unit: "°", default: 360 }] })
80
- ], RadialGrid.prototype, "sweepTo", null);
81
- RadialGrid = __decorate([
82
- node({
83
- key: "radialGrid",
84
- parentKey: "node",
85
- forkable: true,
86
- layout: {
87
- children: "freeform",
88
- acceptsChildren: true,
89
- defaultWidthMode: "hug",
90
- defaultHeightMode: "hug",
30
+ export const RadialGrid = ItemGrid.define(component2d({
31
+ key: "radialGrid",
32
+ state: { ...ItemGrid.state, ...own },
33
+ defaults: ItemGrid.defaults,
34
+ commands: {
35
+ ...ItemGrid.commands,
36
+ /** Orbit the items round the centre by `degrees` — `360` is one full turn. */
37
+ spin: {
38
+ args: { degrees: Types.number(360, { step: 15, unit: "°" }) },
39
+ run: (timeline, s) => timeline.tween({ startAngle: s.startAngle + (timeline.args.degrees ?? 360) }),
40
+ },
41
+ /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */
42
+ turnTo: {
43
+ args: { item: Types.number(0, { min: 0, step: 1 }) },
44
+ run: (timeline, s, children) => {
45
+ const count = children.length;
46
+ const slot = normalizeOrder(s.order, count).indexOf(Math.round(timeline.args.item ?? 0));
47
+ const turn = slot < 0 ? 0 : radialTurnToTop(arrangement(s), count, slot);
48
+ return timeline.tween({ startAngle: s.startAngle + turn });
49
+ },
50
+ },
51
+ radiusTo: {
52
+ args: { radius: ItemGrid.hinted(280, { min: 0 }) },
53
+ run: (timeline, s) => timeline.tween({ radius: timeline.args.radius ?? s.radius }),
54
+ },
55
+ /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */
56
+ sweepTo: {
57
+ args: { sweep: ItemGrid.hinted(360, { min: -360, max: 360, unit: "°" }) },
58
+ run: (timeline, s) => timeline.tween({ sweep: timeline.args.sweep ?? s.sweep }),
91
59
  },
92
- })
93
- ], RadialGrid);
94
- export { RadialGrid };
60
+ },
61
+ ...ItemGrid.fields(arranger),
62
+ }), arranger);
95
63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ACJ,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,QAAQ,EAAE,UAAU;YACpB,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE,KAAK;YACvB,iBAAiB,EAAE,KAAK;SACzB;KACF,CAAC;GACW,UAAU,CAkDtB","sourcesContent":["import { command, node, property, type Command, type CommandArgs, type NodeConfig } from \"@motionscript/sdk\"\r\n\r\nimport {\r\n ItemGrid,\r\n normalizeOrder,\r\n RADIAL_DIRECTIONS,\r\n radialTurnToTop,\r\n type ItemGridProps,\r\n type RadialArrangement,\r\n type RadialDirection,\r\n} from \"../kit\"\r\n\r\nexport interface RadialGridProps extends ItemGridProps {\r\n radius: number\r\n startAngle: number\r\n sweep: number\r\n direction: RadialDirection\r\n rotateItems: boolean\r\n spinSpeed: number\r\n}\r\n\r\n/**\r\n * Children round a circle, or along an arc of one.\r\n *\r\n * A full circle spaces the items evenly with none on top of another; an arc\r\n * puts one at each end. Angles run clockwise from twelve o'clock, so\r\n * {@link turnTo} can bring any item to the top like a dial.\r\n */\r\n@node({\r\n key: \"radialGrid\",\r\n parentKey: \"node\",\r\n forkable: true,\r\n layout: {\r\n children: \"freeform\",\r\n acceptsChildren: true,\r\n defaultWidthMode: \"hug\",\r\n defaultHeightMode: \"hug\",\r\n },\r\n})\r\nexport class RadialGrid extends ItemGrid<RadialGridProps> {\r\n @property({ default: 200, min: 0, step: 1 }) declare radius: number\r\n @property({ default: 0, step: 1, unit: \"°\" }) declare startAngle: number\r\n @property({ default: 360, min: -360, max: 360, step: 1, unit: \"°\" }) declare sweep: number\r\n @property({ default: \"clockwise\", kind: \"enum\", options: RADIAL_DIRECTIONS }) declare direction: RadialDirection\r\n @property({ default: false }) declare rotateItems: boolean\r\n @property({ default: 0, step: 1, unit: \"°/s\" }) declare spinSpeed: number\r\n\r\n constructor(props?: NodeConfig<RadialGrid, RadialGridProps>) {\r\n super(props)\r\n }\r\n\r\n /** Orbit the items round the centre by `degrees` — `360` is one full turn. */\r\n @command({ args: [{ key: \"degrees\", step: 15, unit: \"°\", default: 360 }] })\r\n spin(args: CommandArgs<{ degrees?: number }> & { duration: number }): Command<RadialGridProps> {\r\n const degrees = args.data?.degrees ?? 360\r\n return this.to({ data: { startAngle: this.startAngle + degrees }, duration: args.duration, easing: args.easing })\r\n }\r\n\r\n /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */\r\n @command({ args: [{ key: \"item\", min: 0, step: 1, default: 0 }] })\r\n turnTo(args: CommandArgs<{ item?: number }> & { duration: number }): Command<RadialGridProps> {\r\n const count = this._itemCount()\r\n const slot = normalizeOrder(this.order, count).indexOf(Math.round(args.data?.item ?? 0))\r\n const turn = slot < 0 ? 0 : radialTurnToTop(this.arrangementFor(), count, slot)\r\n return this.to({ data: { startAngle: this.startAngle + turn }, duration: args.duration, easing: args.easing })\r\n }\r\n\r\n @command({ args: [{ key: \"radius\", min: 0, default: 280 }] })\r\n radiusTo(args: CommandArgs<{ radius: number }> & { duration: number }): Command<RadialGridProps> {\r\n return this.to({ data: { radius: args.data?.radius ?? this.radius }, duration: args.duration, easing: args.easing })\r\n }\r\n\r\n /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */\r\n @command({ args: [{ key: \"sweep\", min: -360, max: 360, unit: \"°\", default: 360 }] })\r\n sweepTo(args: CommandArgs<{ sweep: number }> & { duration: number }): Command<RadialGridProps> {\r\n return this.to({ data: { sweep: args.data?.sweep ?? this.sweep }, duration: args.duration, easing: args.easing })\r\n }\r\n\r\n protected override arrangementFor(): RadialArrangement {\r\n return {\r\n kind: \"radial\",\r\n radius: this.radius,\r\n startAngle: this.startAngle,\r\n sweep: this.sweep,\r\n direction: this.direction,\r\n rotateItems: this.rotateItems,\r\n spinSpeed: this.spinSpeed,\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"radial-grid.js","sourceRoot":"","sources":["../../src/radial-grid/radial-grid.ts"],"names":[],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AAO,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,CAAC,CAAA;YAC5D,CAAC;SACF;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE;YAClD,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;SACnF;QACD,mFAAmF;QACnF,OAAO,EAAE;YACP,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;YACzE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;SAChF;KACF;IACD,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;CAC7B,CAAC,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["import {\r\n component2d,\r\n Types,\r\n type NodeOf,\r\n type Values,\r\n // Named so the emitted declaration reaches these through the sdk, not core.\r\n type Node2D as _Node2D,\r\n type Node2DProps as _Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { ItemGrid, normalizeOrder, RADIAL_DIRECTIONS, radialTurnToTop, type RadialArrangement } from \"../kit\"\r\n\r\nconst own = {\r\n radius: Types.number(200, { min: 0, step: 1 }),\r\n startAngle: Types.number(0, { step: 1, unit: \"°\" }),\r\n sweep: Types.number(360, { min: -360, max: 360, step: 1, unit: \"°\" }),\r\n direction: Types.oneOf(RADIAL_DIRECTIONS, { default: \"clockwise\" }),\r\n rotateItems: false,\r\n spinSpeed: Types.number(0, { step: 1, unit: \"°/s\" }),\r\n}\r\n\r\ntype Own = Values<typeof own>\r\n\r\nfunction arrangement(s: Own): RadialArrangement {\r\n return {\r\n kind: \"radial\",\r\n radius: s.radius,\r\n startAngle: s.startAngle,\r\n sweep: s.sweep,\r\n direction: s.direction,\r\n rotateItems: s.rotateItems,\r\n spinSpeed: s.spinSpeed,\r\n }\r\n}\r\n\r\nconst arranger: ItemGrid.Arranger<Own> = { arrangement }\r\n\r\n/**\r\n * Children round a circle, or along an arc of one.\r\n *\r\n * A full circle spaces the items evenly with none on top of another; an arc\r\n * puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`\r\n * can bring any item to the top like a dial.\r\n */\r\nexport const RadialGrid = ItemGrid.define(component2d({\r\n key: \"radialGrid\",\r\n state: { ...ItemGrid.state, ...own },\r\n defaults: ItemGrid.defaults,\r\n commands: {\r\n ...ItemGrid.commands,\r\n /** Orbit the items round the centre by `degrees` — `360` is one full turn. */\r\n spin: {\r\n args: { degrees: Types.number(360, { step: 15, unit: \"°\" }) },\r\n run: (timeline, s) => timeline.tween({ startAngle: s.startAngle + (timeline.args.degrees ?? 360) }),\r\n },\r\n /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */\r\n turnTo: {\r\n args: { item: Types.number(0, { min: 0, step: 1 }) },\r\n run: (timeline, s, children) => {\r\n const count = children.length\r\n const slot = normalizeOrder(s.order, count).indexOf(Math.round(timeline.args.item ?? 0))\r\n const turn = slot < 0 ? 0 : radialTurnToTop(arrangement(s), count, slot)\r\n return timeline.tween({ startAngle: s.startAngle + turn })\r\n },\r\n },\r\n radiusTo: {\r\n args: { radius: ItemGrid.hinted(280, { min: 0 }) },\r\n run: (timeline, s) => timeline.tween({ radius: timeline.args.radius ?? s.radius }),\r\n },\r\n /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */\r\n sweepTo: {\r\n args: { sweep: ItemGrid.hinted(360, { min: -360, max: 360, unit: \"°\" }) },\r\n run: (timeline, s) => timeline.tween({ sweep: timeline.args.sweep ?? s.sweep }),\r\n },\r\n },\r\n ...ItemGrid.fields(arranger),\r\n}), arranger)\r\n\r\nexport type RadialGrid = NodeOf<typeof RadialGrid>\r\n/** What a call or a document row may set. */\r\nexport type RadialGridProps = NonNullable<Parameters<typeof RadialGrid>[0]>\r\n"]}