@motionscript/patterns 0.0.0-stage → 0.1.0-alpha.10
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/CHANGELOG.md +56 -0
- package/LICENSE +201 -0
- package/NOTICE +49 -0
- package/README.md +82 -2
- package/dist/browser/chunks/chunk-FXDYEY4R.js +2 -0
- package/dist/browser/chunks/chunk-FXDYEY4R.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +13 -0
- package/dist/dot-grid-pattern/dot-grid-pattern.d.ts +118 -0
- package/dist/dot-grid-pattern/dot-grid-pattern.d.ts.map +1 -0
- package/dist/dot-grid-pattern/dot-grid-pattern.js +89 -0
- package/dist/dot-grid-pattern/dot-grid-pattern.js.map +1 -0
- package/dist/dot-grid-pattern/index.d.ts +2 -0
- package/dist/dot-grid-pattern/index.d.ts.map +1 -0
- package/dist/dot-grid-pattern/index.js +2 -0
- package/dist/dot-grid-pattern/index.js.map +1 -0
- package/dist/engine.d.ts +12 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +12 -0
- package/dist/engine.js.map +1 -0
- package/dist/grid-pattern/grid-pattern.d.ts +94 -0
- package/dist/grid-pattern/grid-pattern.d.ts.map +1 -0
- package/dist/grid-pattern/grid-pattern.js +119 -0
- package/dist/grid-pattern/grid-pattern.js.map +1 -0
- package/dist/grid-pattern/index.d.ts +2 -0
- package/dist/grid-pattern/index.d.ts.map +1 -0
- package/dist/grid-pattern/index.js +2 -0
- package/dist/grid-pattern/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/grid-lines.d.ts +111 -0
- package/dist/kit/grid-lines.d.ts.map +1 -0
- package/dist/kit/grid-lines.js +148 -0
- package/dist/kit/grid-lines.js.map +1 -0
- package/dist/kit/index.d.ts +3 -0
- package/dist/kit/index.d.ts.map +1 -0
- package/dist/kit/index.js +3 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/kit/viewport-pattern.d.ts +81 -0
- package/dist/kit/viewport-pattern.d.ts.map +1 -0
- package/dist/kit/viewport-pattern.js +74 -0
- package/dist/kit/viewport-pattern.js.map +1 -0
- package/dist/line-grid-pattern/index.d.ts +2 -0
- package/dist/line-grid-pattern/index.d.ts.map +1 -0
- package/dist/line-grid-pattern/index.js +2 -0
- package/dist/line-grid-pattern/index.js.map +1 -0
- package/dist/line-grid-pattern/line-grid-pattern.d.ts +93 -0
- package/dist/line-grid-pattern/line-grid-pattern.d.ts.map +1 -0
- package/dist/line-grid-pattern/line-grid-pattern.js +71 -0
- package/dist/line-grid-pattern/line-grid-pattern.js.map +1 -0
- package/dist/nodes.d.ts +19 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +9 -0
- package/dist/nodes.js.map +1 -0
- package/package.json +73 -3
- package/registry.json +26 -0
- package/src/dot-grid-pattern/dot-grid-pattern.ts +155 -0
- package/src/dot-grid-pattern/index.ts +1 -0
- package/src/engine.ts +11 -0
- package/src/grid-pattern/grid-pattern.ts +176 -0
- package/src/grid-pattern/index.ts +1 -0
- package/src/index.ts +5 -0
- package/src/kit/grid-lines.ts +223 -0
- package/src/kit/index.ts +2 -0
- package/src/kit/viewport-pattern.ts +109 -0
- package/src/line-grid-pattern/index.ts +1 -0
- package/src/line-grid-pattern/line-grid-pattern.ts +117 -0
- package/src/nodes.ts +27 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @motionscript/patterns
|
|
2
|
+
|
|
3
|
+
## 0.1.0-alpha.10
|
|
4
|
+
|
|
5
|
+
## 0.1.0-alpha.9
|
|
6
|
+
|
|
7
|
+
## 0.1.0-alpha.8
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.7
|
|
10
|
+
|
|
11
|
+
## 0.1.0-alpha.6
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 163b708: Node types are components: one spec object handed to `component2d`, `component3d` or `componentAudio`, with no classes, decorators or JSX.
|
|
16
|
+
|
|
17
|
+
- **Writing a node type.** A component is one object literal: `key`, `state` (literals and `Types`), `defaults`, `commands`, `children`, `allowedChildren`/`allowedParents`, `provide`, `load`, and its tree's own fields (`measure`, `layout`, `render` for 2D). Behaviour comes from modules you spread in and call: `Paint`, `Flow`, `Shapes`, `Typeface`, `TextLayout`, `Aim`, `Material`, `View3D`. ADR 0007 and the custom-node docs cover it.
|
|
18
|
+
- **Building nodes in code** uses calls: `Rect({ fill: 'tomato', children: [Text({ text: 'Hi' })] })`, or `new Rect({...})` for the node itself.
|
|
19
|
+
- **Every built-in and every kit node is a component**, under the same document key. Code that tested `instanceof` a class now uses the component's `.is`, or `instanceof X.node`. Changed members:
|
|
20
|
+
- `SurfacePlot3d.valueAt` and `FunctionPlot.valueAt` are now the functions `surfaceValueAt` and `curveValue`.
|
|
21
|
+
- A system's `coordinates` is replaced by `planeMap`/`axesMap`/`systemMap`.
|
|
22
|
+
- `PieChart.isSelected` is replaced by `isSliceSelected`.
|
|
23
|
+
- `ItemGrid` is a kit module (`ItemGrid.isGrid`, `ItemGrid.define`), not a base class.
|
|
24
|
+
- **The sdk no longer exports the class surface:**
|
|
25
|
+
- the decorators: `node`, `property` and every `*Property`, `command`, `withdraw`, `driveCommand`;
|
|
26
|
+
- the authoring bases: `PaintNode`, `ShapeNode`, `TextBase`, `Mesh3DBase`, `Canvas3DBase` and the `*Base` geometry classes;
|
|
27
|
+
- `asCommand`, `compose`, `drive` and `declarePaints` from `@motionscript/sdk/component`;
|
|
28
|
+
- the `jsx-runtime` and `jsx-dev-runtime` subpaths.
|
|
29
|
+
- `Node`, `Node2D`, `Node3D` and `NodeAudio` remain as types.
|
|
30
|
+
- **Editor metadata leaves the engine.** The kits no longer declare `parentKey`, `forkable`, `layout`, `seed`, `within`, `beside` or `closed`; a host keeps those in its own configs. `describe()` now reports `holds`, the trees a type takes children from, and the placement checks use it, so a 2D viewport of your own that takes 3D children places them.
|
|
31
|
+
- A command called from code with no argument runs, and a refused child is told what its parent takes (`allowedChildren`) or where it goes (`allowedParents`).
|
|
32
|
+
|
|
33
|
+
## 0.1.0-alpha.5
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- da6f97a: Every package ships a `NOTICE`, and a browser build lists what it bundles.
|
|
38
|
+
|
|
39
|
+
- Each tarball carries the repository `NOTICE`: the copyright line and the MIT attributions for the noise functions in `skia-render`'s fractal-noise fill (David Hoskins' "Hash without Sine", Inigo Quilez's 2D simplex noise).
|
|
40
|
+
- `@motionscript/canvaskit` ships `THIRD_PARTY_NOTICES.txt` with the licences of the libraries compiled into the binary: FreeType, HarfBuzz, ICU 74, zlib, libpng, Brotli, WOFF2, Emscripten and musl.
|
|
41
|
+
- `dist/browser/manifest.json` gains `thirdParty`, the packages the browser build bundled (`name`, `version`, `license`), and their licence and NOTICE files are written to `dist/browser/THIRD_PARTY_LICENSES.txt`. `@motionscript/browser` bundles mediabunny (MPL-2.0, unmodified; source at https://github.com/Vanilagy/mediabunny), esbuild-wasm and three; `@motionscript/math` bundles MathJax.
|
|
42
|
+
|
|
43
|
+
## 0.1.0-alpha.4
|
|
44
|
+
|
|
45
|
+
### Minor Changes
|
|
46
|
+
|
|
47
|
+
- 3eefc7e: Package reshuffle.
|
|
48
|
+
|
|
49
|
+
- `@motionscript/layout-grid` is now `@motionscript/grids` (`@motionscript/grids/kit`, and `packages/components/grids`), and its `LayoutGrid` base class is `ItemGrid` (`ItemGridProps`, `ITEM_GRID_TYPES`). `RectangularGrid`, `RadialGrid`, `PathGrid` and `SphereGrid` keep their names and document keys. Update the dependency, the imports, and any `@motionscript/layout-grid/kit` specifier a copied component carries.
|
|
50
|
+
- `@motionscript/geo-data` is now `@motionscript/geography`. The data format on disk (`data/v1/…`) is unchanged, so `@motionscript/geo` reads it as before and a host that serves `@motionscript/geo-data/data` serves `@motionscript/geography/data` the same way.
|
|
51
|
+
- `@motionscript/ui` is removed: its `Switch`, `Button`, `Window` and `Cursor` nodes, and the `ControlNode` base class, no longer ship. They are plain nodes over `@motionscript/sdk`, so a project that needs one writes its own and shapes it to taste.
|
|
52
|
+
- `@motionscript/patterns` is new. It holds the pattern nodes (`LineGridPattern`, `DotGridPattern`, `GridPattern`, `ViewportPattern`) that `@motionscript/core` and `@motionscript/sdk` no longer ship.
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- a6c042d: `LineGridPattern` and `DotGridPattern` now put a line (or a dot column and row) on every edge of their box, whatever the number of cells. This changes how existing scenes with an odd `divisions × subdivisions` look: the lattice was centred on the box, so `divisions: 1` drew a single line through the middle and `divisions: 3` drew three lines with none on the edges, where a grid of `divisions: 4` has always drawn five. The lattice now starts at the near edge, and with an odd `divisions` and an even `subdivisions` (such as `3` and `2`) the major lines are the division lines, edges included, rather than the middle ones. A grid with an even `divisions`, and `GridPattern`'s world-anchored lattice, are drawn exactly as before.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Motionscript
|
|
2
|
+
Copyright 2026 Motionscript LLC
|
|
3
|
+
|
|
4
|
+
This product includes the third-party code below, each part under the MIT
|
|
5
|
+
License reproduced at the end of this file.
|
|
6
|
+
|
|
7
|
+
- packages/renderer/crates/renderer/src/shaders/prim.wgsl (`fn_hash2`):
|
|
8
|
+
"Hash without Sine" by David Hoskins (https://www.shadertoy.com/view/4djSRW).
|
|
9
|
+
Copyright (c) 2014 David Hoskins.
|
|
10
|
+
|
|
11
|
+
- packages/renderer/crates/renderer/src/shaders/prim.wgsl (`simplex_noise`): "Noise - simplex - 2D" by Inigo Quilez
|
|
12
|
+
(https://www.shadertoy.com/view/Msf3WH). Copyright (c) 2013 Inigo Quilez.
|
|
13
|
+
|
|
14
|
+
- packages/renderer/crates/render3d (in @motionscript/renderer's WebAssembly):
|
|
15
|
+
its shaders (src/shaders/mesh.wgsl) port three.js r185's mesh programs and
|
|
16
|
+
src/geometry.rs its primitive generators (https://threejs.org).
|
|
17
|
+
Copyright (c) 2010-2026 three.js authors.
|
|
18
|
+
|
|
19
|
+
@motionscript/renderer's WebAssembly (dist/ms_renderer_bg.wasm) compiles in
|
|
20
|
+
Rust crates under MIT, Apache-2.0, Zlib and Unicode-3.0 terms (wgpu, naga,
|
|
21
|
+
harfrust, read-fonts, kurbo, wasm-bindgen and others); their notices are in
|
|
22
|
+
packages/renderer/THIRD_PARTY_NOTICES.txt.
|
|
23
|
+
|
|
24
|
+
MP3 export loads @mediabunny/mp3-encoder (MPL-2.0), a WebAssembly build of
|
|
25
|
+
the LAME MP3 encoder (LGPL, https://lame.sourceforge.io), on first use.
|
|
26
|
+
|
|
27
|
+
The browser builds under dist/browser/ bundle each package's npm dependencies;
|
|
28
|
+
dist/browser/THIRD_PARTY_LICENSES.txt in each package lists them with their
|
|
29
|
+
licences.
|
|
30
|
+
|
|
31
|
+
MIT License
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
34
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
35
|
+
in the Software without restriction, including without limitation the rights
|
|
36
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
37
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
38
|
+
furnished to do so, subject to the following conditions:
|
|
39
|
+
|
|
40
|
+
The above copyright notice and this permission notice shall be included in all
|
|
41
|
+
copies or substantial portions of the Software.
|
|
42
|
+
|
|
43
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
44
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
46
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
47
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
48
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
49
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @motionscript/patterns
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Grid backgrounds for [Motion Script](https://motionscript.dev): `LineGridPattern`
|
|
4
|
+
and `DotGridPattern` fill a box of their own, and `GridPattern` is an infinite
|
|
5
|
+
grid that fills whatever a `Camera` can currently see.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { NODES } from '@motionscript/patterns';
|
|
9
|
+
|
|
10
|
+
// hand them to an engine: new Engine(platform, { nodes: NODES })
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Documents name them `lineGridPattern`, `dotGridPattern` and `gridPattern`.
|
|
14
|
+
The engine does not know these keys on its own: a document that names one needs
|
|
15
|
+
the engine given `NODES`.
|
|
16
|
+
|
|
17
|
+
## Laid together
|
|
18
|
+
|
|
19
|
+
`DotGridPattern` shares `divisions`, `subdivisions` and `offset` with
|
|
20
|
+
`LineGridPattern`, and both tile through the same function, so a dot grid laid
|
|
21
|
+
over a line grid with the same numbers keeps its dots on the intersections while
|
|
22
|
+
both scroll. `GridPattern` is built from `ViewportPattern`, a module exported for
|
|
23
|
+
a pattern of your own: spread its `state` and `commands` into a `component2d`,
|
|
24
|
+
pass its `measure` and `layout`, and draw with `ViewportPattern.draw(ctx, (bounds) => …)`,
|
|
25
|
+
which hands over the region the camera sees so only what is on screen is generated.
|
|
26
|
+
|
|
27
|
+
Core's `grid` and `dotGrid` **fills** are a different thing: paints over any
|
|
28
|
+
shape, built into the engine.
|
|
29
|
+
|
|
30
|
+
## Nodes and props
|
|
31
|
+
|
|
32
|
+
All three are shapes, built with a shape's paint and layout (`Paint`, `Flow`), so
|
|
33
|
+
they take a shape's paint props (`fill`, `stroke`, `shadow`, ...) and children,
|
|
34
|
+
and the paint commands, and declare no commands of their own: `to` on `offset`
|
|
35
|
+
(all three) and on `cellSize` (`gridPattern`) animates them.
|
|
36
|
+
|
|
37
|
+
| Key | Own props | Space |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `lineGridPattern` | `divisions` (4), `subdivisions` (1), `subStroke`, `offset` | the node's box, in pixels |
|
|
40
|
+
| `dotGridPattern` | `divisions` (4), `subdivisions` (1), `radius` (3), `subScale` (0.5), `offset` | the node's box, in pixels |
|
|
41
|
+
| `gridPattern` | `cellSize` (100; a number or `{ x, y }`), `subdivisions` (1), `subStroke`, `offset` | world units |
|
|
42
|
+
|
|
43
|
+
`stroke` paints the major lines and `subStroke` the minor ones (drawn when
|
|
44
|
+
`subdivisions > 1`); when a pattern is built with a `stroke` and no `subStroke`, the
|
|
45
|
+
minor stroke is the major one at half opacity: the stroke it was built with, so a
|
|
46
|
+
later change to `stroke` leaves it as it was.
|
|
47
|
+
|
|
48
|
+
- **One tiling.** Every mark of every pattern comes from `addTiledLines`
|
|
49
|
+
(`src/kit/grid-lines.ts`), so patterns with the same `divisions`, `subdivisions` and
|
|
50
|
+
`offset` agree on every intersection. A mark is major by its tile index against the
|
|
51
|
+
un-panned grid, so panning never changes a mark's class.
|
|
52
|
+
- **`gridPattern` is world-locked and has no box of its own.** `ViewportPattern.draw`
|
|
53
|
+
covers `ViewportPattern.visibleBounds(ctx)`: the world rect the nearest `Camera`
|
|
54
|
+
ancestor sees (`ctx.ancestor(Camera)`)
|
|
55
|
+
(widened to the bounding box of the turned viewport when it has a `heading`), or,
|
|
56
|
+
with no camera, the node's own layout rect centred on its origin. Nothing is kept
|
|
57
|
+
between frames, so a pan or zoom regenerates the marks for the region; only
|
|
58
|
+
`offset` moves it relative to the world. A dashed stroke is drawn line by line with
|
|
59
|
+
its dash phase locked to the world, and each line's span snapped to whole dash
|
|
60
|
+
cycles, so dashes do not crawl as the camera moves.
|
|
61
|
+
- **Lines are centred.** A line has no inside, so stroke `align` is ignored. A
|
|
62
|
+
`lineGridPattern` insets its extent by half the thickest stroke so the outer lines
|
|
63
|
+
are not cut by the box, and `dotGridPattern` by the dot radius.
|
|
64
|
+
- **A degenerate step or an empty box draws nothing**; none of them throws.
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install @motionscript/patterns @motionscript/sdk
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
A copy of `line-grid-pattern`, `dot-grid-pattern` or `grid-pattern`
|
|
73
|
+
(`registry.json`) keeps importing `ViewportPattern` and the tiling
|
|
74
|
+
helpers from `@motionscript/patterns/kit`.
|
|
75
|
+
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
From the monorepo root:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm --filter @motionscript/patterns build
|
|
82
|
+
pnpm --filter @motionscript/patterns test
|
|
83
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var L=Object.defineProperty;var S=(o,t)=>{for(var n in t)L(o,n,{get:t[n],enumerable:!0})};import{strokeOps as b}from"@motionscript/sdk";function j(o,t,n,r,e=0){let s=[],a=[],i=[],f=[],p=m(t.min-r,t.step,t.offset,e,Math.floor),u=m(t.max+r,t.step,t.offset,e,Math.ceil),h=m(o.min-r,o.step,o.offset,e,Math.floor),l=m(o.max+r,o.step,o.offset,e,Math.ceil);return g(o.min,o.max,o.step,o.offset,n,r,(c,d)=>{(d?s:a).push(c)},o.anchor),g(t.min,t.max,t.step,t.offset,n,r,(c,d)=>{(d?i:f).push(c)},t.anchor),{top:p,bottom:u,left:h,right:l,verticalMajor:s,verticalMinor:a,horizontalMajor:i,horizontalMinor:f}}function E(o,t,n,r){let e=j(o,t,n,r),s=[],a=[];for(let i of e.verticalMajor)s.push({type:"M",x:i,y:e.top},{type:"L",x:i,y:e.bottom});for(let i of e.verticalMinor)a.push({type:"M",x:i,y:e.top},{type:"L",x:i,y:e.bottom});for(let i of e.horizontalMajor)s.push({type:"M",x:e.left,y:i},{type:"L",x:e.right,y:i});for(let i of e.horizontalMinor)a.push({type:"M",x:e.left,y:i},{type:"L",x:e.right,y:i});return{major:s,minor:a}}function m(o,t,n,r,e){return r>0?e(o/r)*r:t<=0?o:e((o-n)/t)*t+n}function g(o,t,n,r,e,s,a,i=0){if(n<=0)return;let f=n*1e-6,p=Math.ceil((o-s-r-i-f)/n),u=Math.floor((t+s-r-i+f)/n);for(let h=p;h<=u;h++){let l=i+h*n+r,c=(h%e+e)%e===0;a(l,c)}}function G(o){let t=0;for(let n of o)n.weight>t&&(t=n.weight);return t}function I(o){return o.map(t=>t.align===0?t:{...t,align:0})}function P(o,t){return b.resolve(o.map(n=>({...n,fill:n.fill.map(r=>({...r,opacity:(r.opacity??1)*t}))})))}var w=new WeakMap;function K(o){let t=w.get(o);if(!t){let n=y(o.stroke),r=y(o.subdivisions)??1;t=n!==void 0&&r>1?P(b.resolve(n),.5):[],w.set(o,t)}return t}function y(o){return typeof o=="function"?o():o}var k={};S(k,{commands:()=>F,draw:()=>W,layout:()=>T,measure:()=>N,state:()=>B,visibleBounds:()=>z});import{Camera as O,Flow as x,Graphics2D as A,Paint as M}from"@motionscript/sdk";var B={...M.state,...x.state},F={...M.commands};function N(o,t,n){return x.measure(o,t,n,M.inset(t))}function T(o,t,n){return x.layout(o,t,n,M.inset(t))}function z(o){let t=o.ancestor(O);if(!t)return{x:0,y:0,width:o.size.width,height:o.size.height};let{width:n,height:r}=t.size,e=t.state.zoom||1,s=t.state.heading,a=n/2/e,i=r/2/e,f=a,p=i;if(s!==0){let h=s*Math.PI/180,l=Math.abs(Math.cos(h)),c=Math.abs(Math.sin(h));f=a*l+i*c,p=a*c+i*l}let u=t.state.lookAt;return{x:u.x,y:u.y,width:f*2,height:p*2}}function W(o,t){let n=z(o),r=new A().rect({x:n.x,y:n.y,width:n.width,height:n.height});o.inFront(()=>o.clip(r,()=>t(n))),o.children()}export{j as a,E as b,g as c,G as d,I as e,P as f,K as g,k as h};
|
|
2
|
+
//# sourceMappingURL=chunk-FXDYEY4R.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/kit/grid-lines.ts", "../../../src/kit/viewport-pattern.ts"],
|
|
4
|
+
"sourcesContent": ["import { strokeOps, type PathCommand, type Stroke, type StrokeProp, type StrokeResolved } from \"@motionscript/sdk\";\n\n/**\n * Shared geometry for line grids. Both {@link LineGridPattern} (a fixed grid filling\n * its layout rect) and {@link GridPattern} (an infinite grid tiled across the\n * camera's visible region) build the same multi-subpath line paths from these\n * helpers — they differ only in how the extent and step are chosen.\n *\n * Lines are tiled by the minor step and panned by an origin offset: every\n * position within the extent (grown by `overscan` so thick lines clip out\n * smoothly) is emitted regardless of the offset, so the area always stays full\n * and animating the offset scrolls the grid. The lattice starts at the axis's\n * `anchor` (the world origin unless it says otherwise). A tile whose index\n * aligns to the division grid is major; the rest are minor. Each is built as a\n * single multi-subpath path so the trailing stroke paints every line as one\n * union with no destructive boolean op (which would erase the open lines).\n */\n\n/** A grid extent on one axis: lines tile within `[min, max]`, on a lattice that starts at `anchor`. */\nexport interface GridAxis {\n /** Minimum coordinate (typically negative). */\n min: number;\n /** Maximum coordinate. */\n max: number;\n /** Spacing between adjacent (minor) lines. */\n step: number;\n /** Pan offset in pixels along this axis. */\n offset: number;\n /**\n * Where the lattice starts: a line sits at `anchor + n * step`, and the tile\n * index `n` that decides which lines are major counts from there. Omitted it is 0, the\n * world origin, which is what a grid that follows a camera keeps. A grid with a box of its\n * own sets it to `min`, so the box's edges are lines whatever the count of cells.\n */\n anchor?: number;\n}\n\n/** The resolved grid: where each line sits and how far it runs. Vertical lines\n * sit at x = `verticalX[i]` and run from `top` to `bottom`; horizontal lines sit\n * at y = `horizontalY[i]` and run from `left` to `right`. Positions are split\n * into major (division) and minor (subdivision) lines. */\nexport interface GridLines {\n /** y-extent every vertical line spans. */\n top: number;\n bottom: number;\n /** x-extent every horizontal line spans. */\n left: number;\n right: number;\n verticalMajor: number[];\n verticalMinor: number[];\n horizontalMajor: number[];\n horizontalMinor: number[];\n}\n\n/**\n * Resolve the grid for the given per-axis extents: the cross-axis span and the\n * major/minor line positions on each axis. Vertical lines span the full y\n * extent; horizontal lines span the full x extent. Both spans are grown by\n * `overscan` so a thick line slides out under the clip instead of popping, and\n * snapped outward to the grid so the endpoints sit on stable world positions\n * (a line's start stays fixed as the camera pans, so a dashed stroke anchored to\n * it doesn't crawl).\n *\n * `cycle` (the dash period, when dashed) snaps the cross-axis span to a whole\n * number of dash cycles too, so each parallel line is the same dash-aligned\n * length and the renderer's per-path dash-fit becomes a no-op (no per-frame\n * resizing of the dashes as lines enter and leave view).\n */\nexport function gridLines(\n x: GridAxis,\n y: GridAxis,\n subdivisions: number,\n overscan: number,\n cycle = 0,\n): GridLines {\n const verticalMajor: number[] = [];\n const verticalMinor: number[] = [];\n const horizontalMajor: number[] = [];\n const horizontalMinor: number[] = [];\n\n // Span each line across the cross axis, snapped outward to the grid (and to\n // the dash cycle when dashed) so the endpoints sit on stable world positions.\n const top = snapSpan(y.min - overscan, y.step, y.offset, cycle, Math.floor);\n const bottom = snapSpan(y.max + overscan, y.step, y.offset, cycle, Math.ceil);\n const left = snapSpan(x.min - overscan, x.step, x.offset, cycle, Math.floor);\n const right = snapSpan(x.max + overscan, x.step, x.offset, cycle, Math.ceil);\n\n addTiledLines(x.min, x.max, x.step, x.offset, subdivisions, overscan, (px, isMajor) => {\n (isMajor ? verticalMajor : verticalMinor).push(px);\n }, x.anchor);\n addTiledLines(y.min, y.max, y.step, y.offset, subdivisions, overscan, (py, isMajor) => {\n (isMajor ? horizontalMajor : horizontalMinor).push(py);\n }, y.anchor);\n\n return { top, bottom, left, right, verticalMajor, verticalMinor, horizontalMajor, horizontalMinor };\n}\n\n/**\n * Build the grid lines as multi-subpath path commands, split into the major\n * (division) lines and the minor (subdivision) lines, for the given per-axis\n * extents. Every line in a group shares one stroke (drawn as one union path), so\n * this is the path for solid strokes; dashed strokes that must stay world-locked\n * draw per line from {@link gridLines} instead.\n */\nexport function gridLinePaths(\n x: GridAxis,\n y: GridAxis,\n subdivisions: number,\n overscan: number,\n): { major: PathCommand[]; minor: PathCommand[] } {\n const g = gridLines(x, y, subdivisions, overscan);\n const major: PathCommand[] = [];\n const minor: PathCommand[] = [];\n for (const px of g.verticalMajor) major.push({ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom });\n for (const px of g.verticalMinor) minor.push({ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom });\n for (const py of g.horizontalMajor) major.push({ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py });\n for (const py of g.horizontalMinor) minor.push({ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py });\n return { major, minor };\n}\n\n// Snap `pos` outward to a stable world position so a dashed line's start stays\n// fixed as the viewport moves (the renderer anchors dash phase to the subpath\n// start). Snap to the grid line lattice (`n*step + offset`); when a dash `cycle`\n// is given, snap to the dash lattice instead (`n*cycle`, anchored to world 0) so\n// every parallel line is the same whole number of cycles long and the renderer's\n// per-path dash-fit stays a no-op. `round` is `Math.floor` to snap below, `ceil`\n// to snap above. The lattice is the one about 0 whatever an axis's `anchor`: a span\n// only has to reach past the edge, and a line's ends stay where they always were.\nfunction snapSpan(pos: number, step: number, offset: number, cycle: number, round: (n: number) => number): number {\n if (cycle > 0) return round(pos / cycle) * cycle;\n if (step <= 0) return pos;\n return round((pos - offset) / step) * step + offset;\n}\n\n/**\n * Emit every grid line position in `[min, max]` (grown by `overscan` on each\n * end) for a grid of spacing `step`, panned by `offset` px. Without panning the\n * lattice starts at `anchor` (0 unless given) and its tile indices count outward\n * from there; the line at tile index `n` is major when `n` is a multiple of\n * `subdivisions`. The pan shifts each position by `offset` while keeping the\n * area full, so `n` is taken relative to the un-panned lattice (offset folded\n * out) to keep classification stable as it scrolls.\n *\n * A fixed grid anchors at `min`, so its first line is on the box's edge and the\n * last is too whenever the extent is a whole number of steps. An infinite grid\n * keeps the default, so its lines stay on the world's lattice.\n */\nexport function addTiledLines(\n min: number,\n max: number,\n step: number,\n offset: number,\n subdivisions: number,\n overscan: number,\n emit: (pos: number, isMajor: boolean) => void,\n anchor = 0,\n): void {\n if (step <= 0) return;\n // First/last tile index whose panned position is within the overscanned\n // [min, max]. Positions are `anchor + n*step + offset` (n=0 sits on the\n // anchor). A small epsilon keeps a line that lands exactly on an edge (an\n // anchor at `min`, or a world lattice that reaches it) from being dropped by FP error.\n const eps = step * 1e-6;\n const startN = Math.ceil((min - overscan - offset - anchor - eps) / step);\n const endN = Math.floor((max + overscan - offset - anchor + eps) / step);\n for (let n = startN; n <= endN; n++) {\n const pos = anchor + n * step + offset;\n // mod that stays non-negative for negative n.\n const isMajor = ((n % subdivisions) + subdivisions) % subdivisions === 0;\n emit(pos, isMajor);\n }\n}\n\n/** Largest stroke weight across the layers of a resolved stroke array. Used to\n * overscan the tiling so a thick line stays drawn until fully off the area. */\nexport function maxWeight(strokes: StrokeResolved[]): number {\n let max = 0;\n for (const s of strokes) if (s.weight > max) max = s.weight;\n return max;\n}\n\n/** Force every layer of a resolved stroke array to centered alignment. Grid\n * lines are open paths, not a closed region, so inside/outside alignment is\n * meaningless — they always straddle their position. (Open paths are already\n * stroked centered by the renderer; this makes the intent explicit and ignores\n * any author `align`.) */\nexport function centered(strokes: StrokeResolved[]): StrokeResolved[] {\n return strokes.map(s => (s.align === 0 ? s : { ...s, align: 0 }));\n}\n\n/** Copy a resolved stroke array with every fill layer's opacity scaled by\n * `factor`. Used to derive the default minor-line stroke from the major one.\n * Every resolved fill carries an `opacity` field, so this is type-uniform. */\nexport function dimStroke(strokes: StrokeResolved[], factor: number): StrokeResolved[] {\n return strokeOps.resolve(strokes.map(s => ({\n ...s,\n fill: s.fill.map(f => ({ ...f, opacity: (f.opacity ?? 1) * factor })),\n })) as unknown as StrokeProp[]);\n}\n\nconst SUB_STROKES = new WeakMap<object, StrokeResolved[]>();\n\n/**\n * The minor-line stroke of a pattern built with a `stroke` and no `subStroke`:\n * the major one at half opacity, when it was built with minor lines. Read off\n * what the pattern was built with (`given`), so it is not kept in step with a\n * stroke written later.\n */\nexport function defaultSubStroke(given: Readonly<Record<string, unknown>>): StrokeResolved[] {\n let sub = SUB_STROKES.get(given);\n if (!sub) {\n const stroke = valueOf(given.stroke) as Stroke | undefined;\n const subdivisions = (valueOf(given.subdivisions) as number | undefined) ?? 1;\n sub = stroke !== undefined && subdivisions > 1 ? dimStroke(strokeOps.resolve(stroke), 0.5) : [];\n SUB_STROKES.set(given, sub);\n }\n return sub;\n}\n\n/** A prop as it stood when given: a binding read once. */\nfunction valueOf(prop: unknown): unknown {\n return typeof prop === \"function\" ? (prop as () => unknown)() : prop;\n}\n", "import {\n Camera,\n Flow,\n Graphics2D,\n Paint,\n type BoxBounds,\n type ChildView,\n type Measurer,\n type Placement2D,\n type RenderContext,\n type Size2D,\n type Values,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type Vector2 as _Vector2,\n} from \"@motionscript/sdk\";\n\n/**\n * What a background that fills whatever region is currently visible shares,\n * rather than a fixed rect: `GridPattern` is built from it, and so is a pattern\n * of your own. Spread `state` and `commands` in, pass `measure` and `layout`, and\n * draw with {@link draw}.\n *\n * Placed inside a `Camera`, the pattern is handed the world region the camera\n * can currently see (from its `zoom`/`lookAt`/`heading`), so it only ever\n * generates geometry for what's on screen, with no oversized node sized for the\n * worst-case pan and zoom. With no `Camera` above it, it fills its own box, so the\n * same pattern doubles as an ordinary full-bleed background.\n *\n * The pattern is itself a camera child, laid out at the camera's centre, so its\n * local draw space shares the world origin its siblings use. The visible region\n * is therefore expressed directly in that space: centred on the camera's\n * `lookAt`, sized to the inverse of the camera transform.\n */\n\n/** A pattern is a shape: paints, and children laid out like a rect's. */\nexport const state = { ...Paint.state, ...Flow.state };\n\nexport const commands = { ...Paint.commands };\n\ntype ShapeState = Flow.FlowState & Values<typeof Paint.state>;\n\nexport function measure(measurer: Measurer, s: ShapeState, children: readonly ChildView[]): Size2D {\n return Flow.measure(measurer, s, children, Paint.inset(s));\n}\n\nexport function layout(box: BoxBounds, s: ShapeState, children: readonly ChildView[]): readonly Placement2D[] {\n return Flow.layout(box, s, children, Paint.inset(s));\n}\n\n/**\n * The region the pattern covers, in its own draw space: the world rect the\n * nearest `Camera` above it sees, or its own box when there is none.\n */\nexport function visibleBounds(ctx: RenderContext): BoxBounds {\n const camera = ctx.ancestor(Camera);\n if (!camera) return { x: 0, y: 0, width: ctx.size.width, height: ctx.size.height };\n\n const { width: vw, height: vh } = camera.size;\n const zoom = camera.state.zoom || 1;\n const heading = camera.state.heading;\n\n // Inverse of the camera scale: a viewport `vw×vh` shows `vw/zoom × vh/zoom` of the world.\n const hw = vw / 2 / zoom;\n const hh = vh / 2 / zoom;\n\n // With a heading the visible world rect is rotated; take its axis-aligned\n // bounding box so the pattern covers the rotated viewport's full extent.\n let bw = hw;\n let bh = hh;\n if (heading !== 0) {\n const rad = (heading * Math.PI) / 180;\n const cos = Math.abs(Math.cos(rad));\n const sin = Math.abs(Math.sin(rad));\n bw = hw * cos + hh * sin;\n bh = hw * sin + hh * cos;\n }\n\n // Centred on the camera's `lookAt`, in y-up world space (the descriptor\n // convention; the renderer applies the single y-up→canvas flip when the\n // pattern's shapes are drawn).\n const lookAt = camera.state.lookAt;\n return { x: lookAt.x, y: lookAt.y, width: bw * 2, height: bh * 2 };\n}\n\n/**\n * Paint `pattern` over the visible region, once per render, then the children.\n *\n * The pattern is clipped to the region, so geometry overscanned past the edge\n * (so thick lines slide out instead of popping) trims cleanly. Inside a camera\n * the viewport already clips, but this keeps edge strokes clean and bounds the\n * work with no camera too. A `centerBounds` for a path drawn here is\n * `[bounds.x - w/2, bounds.y - h/2, bounds.x + w/2, bounds.y + h/2]`.\n */\nexport function draw(ctx: RenderContext, pattern: (bounds: BoxBounds) => void): void {\n const bounds = visibleBounds(ctx);\n const region = new Graphics2D().rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });\n ctx.inFront(() => ctx.clip(region, () => pattern(bounds)));\n ctx.children();\n}\n"],
|
|
5
|
+
"mappings": "0FAAA,OAAS,aAAAA,MAAsF,oBAoEzF,SAAUC,EACZC,EACAC,EACAC,EACAC,EACAC,EAAQ,EAAC,CAET,IAAMC,EAA0B,CAAA,EAC1BC,EAA0B,CAAA,EAC1BC,EAA4B,CAAA,EAC5BC,EAA4B,CAAA,EAI5BC,EAAMC,EAAST,EAAE,IAAME,EAAUF,EAAE,KAAMA,EAAE,OAAQG,EAAO,KAAK,KAAK,EACpEO,EAASD,EAAST,EAAE,IAAME,EAAUF,EAAE,KAAMA,EAAE,OAAQG,EAAO,KAAK,IAAI,EACtEQ,EAAOF,EAASV,EAAE,IAAMG,EAAUH,EAAE,KAAMA,EAAE,OAAQI,EAAO,KAAK,KAAK,EACrES,EAAQH,EAASV,EAAE,IAAMG,EAAUH,EAAE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AQ,EAC5BI,EAAUJ,EAAO,MAAM,QAGvBK,EAAKJ,EAAK,EAAIE,EACdG,EAAKJ,EAAK,EAAIC,EAIhBI,EAAKF,EACLG,EAAKF,EACT,GAAIF,IAAY,EAAG,CACf,IAAMK,EAAOL,EAAU,KAAK,GAAM,IAC5BM,EAAM,KAAK,IAAI,KAAK,IAAID,CAAG,CAAC,EAC5BE,EAAM,KAAK,IAAI,KAAK,IAAIF,CAAG,CAAC,EAClCF,EAAKF,EAAKK,EAAMJ,EAAKK,EACrBH,EAAKH,EAAKM,EAAML,EAAKI,CACzB,CAKA,IAAME,EAASZ,EAAO,MAAM,OAC5B,MAAO,CAAE,EAAGY,EAAO,EAAG,EAAGA,EAAO,EAAG,MAAOL,EAAK,EAAG,OAAQC,EAAK,CAAC,CACpE,CAWM,SAAUtB,EAAKa,EAAoBc,EAAoC,CACzE,IAAMC,EAASxB,EAAcS,CAAG,EAC1BgB,EAAS,IAAItB,EAAU,EAAG,KAAK,CAAE,EAAGqB,EAAO,EAAG,EAAGA,EAAO,EAAG,MAAOA,EAAO,MAAO,OAAQA,EAAO,MAAM,CAAE,EAC7Gf,EAAI,QAAQ,IAAMA,EAAI,KAAKgB,EAAQ,IAAMF,EAAQC,CAAM,CAAC,CAAC,EACzDf,EAAI,SAAQ,CAChB",
|
|
6
|
+
"names": ["strokeOps", "gridLines", "x", "y", "subdivisions", "overscan", "cycle", "verticalMajor", "verticalMinor", "horizontalMajor", "horizontalMinor", "top", "snapSpan", "bottom", "left", "right", "addTiledLines", "px", "isMajor", "py", "gridLinePaths", "g", "major", "minor", "pos", "step", "offset", "round", "min", "max", "emit", "anchor", "eps", "startN", "endN", "n", "maxWeight", "strokes", "s", "centered", "dimStroke", "factor", "f", "SUB_STROKES", "defaultSubStroke", "given", "sub", "stroke", "valueOf", "prop", "viewport_pattern_exports", "__export", "commands", "draw", "layout", "measure", "state", "visibleBounds", "Camera", "Flow", "Graphics2D", "Paint", "measurer", "s", "children", "box", "ctx", "camera", "vw", "vh", "zoom", "heading", "hw", "hh", "bw", "bh", "rad", "cos", "sin", "lookAt", "pattern", "bounds", "region"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as O,b as T,c as V,d as x,e as w,f as nt,g as k,h as M}from"./chunks/chunk-FXDYEY4R.js";import{Flow as G,Graphics2D as v,Paint as g,Types as W,component2d as H,lerpVector2 as _}from"@motionscript/sdk";var X=H({key:"lineGridPattern",state:{...g.state,...G.state,divisions:4,subdivisions:1,subStroke:W.stroke,offset:W.custom({x:0,y:0},{lerp:_})},defaults:{subStroke:(o,t)=>k(t)},commands:{...g.commands},measure:(o,t,e)=>G.measure(o,t,e,g.inset(t)),layout:(o,t,e)=>G.layout(o,t,e,g.inset(t)),render:(o,t)=>{let{width:e,height:r}=o.size,a=new v().rect({width:e,height:r});o.inFront(()=>{o.draw(new v().rect({width:e,height:r,start:t.start,end:t.end}).shadow(t.shadow).fill(t.fill));let c=Math.max(1,Math.floor(t.divisions)),i=Math.max(1,Math.floor(t.subdivisions)),f=w(t.stroke),n=w(t.subStroke),l=Math.max(x(f),x(n))/2,s=q(e,r,c,i,l,t.offset),m=[-e/2,-r/2,e/2,r/2];o.clip(a,()=>{i>1&&n.length>0&&s.minor.length>0&&o.draw(new v().path({data:s.minor,centerBounds:m}).stroke(n)),s.major.length>0&&o.draw(new v().path({data:s.major,centerBounds:m}).stroke(f))})}),g.draw(o,t,null,{clipShape:a})}});function q(o,t,e,r,a,c){let i=e*r,f=Math.max(0,o-2*a),n=Math.max(0,t-2*a),l=o/2-a,s=t/2-a;return T({min:-l,max:l,step:f/i,offset:c.x,anchor:-l},{min:-s,max:s,step:n/i,offset:c.y,anchor:-s},r,a)}import{Flow as z,Graphics2D as F,Paint as b,Types as I,component2d as J,lerpVector2 as K}from"@motionscript/sdk";function Y(o,t,e,r,a,c){let i=[];return V(o,t,e,r,a,c,(f,n)=>{i.push({pos:f,isMajor:n})},o),i}var Q={...b.state,...z.state,divisions:4,subdivisions:1,radius:3,subScale:.5,offset:I.custom({x:0,y:0},{lerp:K})},N=J({key:"dotGridPattern",state:Q,commands:{...b.commands},measure:(o,t,e)=>z.measure(o,t,e,b.inset(t)),layout:(o,t,e)=>z.layout(o,t,e,b.inset(t)),render:(o,t)=>{let e={fill:t.fill,stroke:t.stroke,shadow:t.shadow,overlay:t.overlay,start:0,end:1,clip:t.clip},r=new F().rect({width:o.size.width,height:o.size.height});b.draw(o,e,R(o.size,t),{clipShape:r})}});function R(o,t){let{width:e,height:r}=o;if(e<=0||r<=0)return null;let a=Math.max(1,Math.floor(t.divisions)),c=Math.max(1,Math.floor(t.subdivisions)),i=Math.max(0,t.radius),f=i*Math.max(0,t.subScale);if(i<=0&&f<=0)return null;let n=a*c,l=Math.max(0,e/2-i),s=Math.max(0,r/2-i),m=Y(-l,l,l*2/n,t.offset.x,c,i),d=Y(-s,s,s*2/n,t.offset.y,c,i),h=new F,S=!1;for(let p of m)for(let u of d){let y=p.isMajor&&u.isMajor?i:f;y<=0||(h.ellipse({x:p.pos,y:u.pos,width:y*2,height:y*2}),S=!0)}return S?h:null}import{Graphics2D as P,Types as L,component2d as U,lerpNumber as Z,lerpVector2 as C}from"@motionscript/sdk";var E=U({key:"gridPattern",state:{...M.state,cellSize:L.custom(100,{lerp:ot}),subdivisions:1,subStroke:L.stroke,offset:L.custom({x:0,y:0},{lerp:C})},defaults:{subStroke:(o,t)=>k(t)},commands:{...M.commands},measure:M.measure,layout:M.layout,render:(o,t)=>M.draw(o,e=>$(o,t,e))});function $(o,t,e){let r=e.width/2,a=e.height/2,c=e.x-r,i=e.x+r,f=e.y-a,n=e.y+a;o.draw(new P().rect({x:e.x,y:e.y,width:e.width,height:e.height,start:t.start,end:t.end}).shadow(t.shadow).fill(t.fill));let l=Math.max(1,Math.floor(t.subdivisions)),s=t.cellSize,m=Math.max(.001,typeof s=="number"?s:s.x),d=Math.max(.001,typeof s=="number"?s:s.y),h=m/l,S=d/l,p=w(t.stroke),u=w(t.subStroke),y=Math.max(x(p),x(u))/2,j={min:c,max:i,step:h,offset:t.offset.x},D={min:f,max:n,step:S,offset:t.offset.y};l>1&&u.length>0&&A(o,j,D,l,y,u,!1),p.length>0&&A(o,j,D,l,y,p,!0)}function A(o,t,e,r,a,c,i){let f=tt(c),n=O(t,e,r,a,f),l=i?n.verticalMajor:n.verticalMinor,s=i?n.horizontalMajor:n.horizontalMinor,m=[-1,-1,1,1];if(f<=0){let d=[];for(let h of l)d.push({type:"M",x:h,y:n.top},{type:"L",x:h,y:n.bottom});for(let h of s)d.push({type:"M",x:n.left,y:h},{type:"L",x:n.right,y:h});d.length>0&&o.draw(new P().path({data:d,centerBounds:m}).stroke(c));return}for(let d of l){let h=[{type:"M",x:d,y:n.top},{type:"L",x:d,y:n.bottom}];o.draw(new P().path({data:h,centerBounds:m}).stroke(B(c,n.top)))}for(let d of s){let h=[{type:"M",x:n.left,y:d},{type:"L",x:n.right,y:d}];o.draw(new P().path({data:h,centerBounds:m}).stroke(B(c,n.left)))}}function tt(o){let t=0;for(let e of o)if(e.dash&&e.dash.length>0){let r=e.dash.reduce((a,c)=>a+c,0);r>t&&(t=r)}return t}function B(o,t){return o.map(e=>e.dash&&e.dash.length>0?{...e,dashOffset:(e.dashOffset??0)-t}:e)}function ot(o,t,e){return typeof o=="number"&&typeof t=="number"?Z(o,t,e):C(typeof o=="number"?{x:o,y:o}:o,typeof t=="number"?{x:t,y:t}:t,e)}var et=[X,N,E];export{N as DotGridPattern,E as GridPattern,X as LineGridPattern,et as NODES,M as ViewportPattern,V as addTiledLines,w as centered,k as defaultSubStroke,nt as dimStroke,T as gridLinePaths,O as gridLines,x as maxWeight};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/line-grid-pattern/line-grid-pattern.ts", "../../src/dot-grid-pattern/dot-grid-pattern.ts", "../../src/grid-pattern/grid-pattern.ts", "../../src/nodes.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n Flow,\n Graphics2D,\n Paint,\n Types,\n component2d,\n lerpVector2,\n type NodeOf,\n type PathBounds,\n type PathCommand,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\n\nimport { centered, defaultSubStroke, gridLinePaths, maxWeight } from \"../kit\";\n\n/**\n * A rectangular grid of lines filling the node's layout rect.\n *\n * `stroke` paints the major lines and `subStroke` the minor ones, each as a\n * single union path. `fill` and `shadow` cover the whole rect, behind the lines.\n */\nexport const LineGridPattern = component2d({\n key: \"lineGridPattern\",\n state: {\n ...Paint.state,\n ...Flow.state,\n /** Cells along each axis: `divisions` of 4 draws 5 major lines per axis. */\n divisions: 4,\n /** Finer cells each division is split into. 1 draws no minor lines; 2 adds one per division. */\n subdivisions: 1,\n /** Stroke for the minor lines. Unset, the major `stroke` at half opacity when `subdivisions > 1`. */\n subStroke: Types.stroke,\n /** Pans the grid. Lines wrap and tile, so the rect stays full while `offset` scrolls it. */\n offset: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2 }),\n },\n defaults: { subStroke: (_state, given) => defaultSubStroke(given) },\n commands: { ...Paint.commands },\n measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),\n layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),\n render: (ctx, state) => {\n const { width, height } = ctx.size;\n const box = new Graphics2D().rect({ width, height });\n ctx.inFront(() => {\n ctx.draw(new Graphics2D()\n .rect({ width, height, start: state.start, end: state.end })\n .shadow(state.shadow)\n .fill(state.fill));\n\n const divisions = Math.max(1, Math.floor(state.divisions));\n const subdivisions = Math.max(1, Math.floor(state.subdivisions));\n\n // Lines overscan the rect by half the thickest stroke and are clipped to it, so a\n // thick line slides out under the clip instead of popping at the boundary.\n const major = centered(state.stroke);\n const minorStroke = centered(state.subStroke);\n const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;\n const lines = gridPaths(width, height, divisions, subdivisions, overscan, state.offset);\n const centerBounds: PathBounds = [-width / 2, -height / 2, width / 2, height / 2];\n\n ctx.clip(box, () => {\n // Minor lines first so the major lines sit on top.\n if (subdivisions > 1 && minorStroke.length > 0 && lines.minor.length > 0) {\n ctx.draw(new Graphics2D().path({ data: lines.minor, centerBounds }).stroke(minorStroke));\n }\n if (lines.major.length > 0) {\n ctx.draw(new Graphics2D().path({ data: lines.major, centerBounds }).stroke(major));\n }\n });\n });\n // The rect is what `clip` confines the children to and what picking tests; it paints nothing more.\n Paint.draw(ctx, state, null, { clipShape: box });\n },\n});\n\nexport type LineGridPattern = NodeOf<typeof LineGridPattern>;\n/** What a call or a document row may set. */\nexport type LineGridPatternProps = NonNullable<Parameters<typeof LineGridPattern>[0]>;\n\n// One multi-subpath path per group, so each stroke paints its lines as a union with no\n// destructive boolean op (which would erase open lines).\nfunction gridPaths(\n width: number,\n height: number,\n divisions: number,\n subdivisions: number,\n overscan: number,\n offset: Vector2,\n): { major: PathCommand[]; minor: PathCommand[] } {\n // Inset by `overscan` so the outermost lines sit fully inside the rect and are not\n // trimmed to half weight by the clip.\n const cols = divisions * subdivisions;\n const innerW = Math.max(0, width - 2 * overscan);\n const innerH = Math.max(0, height - 2 * overscan);\n const insetX = width / 2 - overscan;\n const insetY = height / 2 - overscan;\n\n // Anchored at the near edge, so a line sits on each edge of the box for any count of cells.\n return gridLinePaths(\n { min: -insetX, max: insetX, step: innerW / cols, offset: offset.x, anchor: -insetX },\n { min: -insetY, max: insetY, step: innerH / cols, offset: offset.y, anchor: -insetY },\n subdivisions,\n overscan,\n );\n}\n", "import {\n Flow,\n Graphics2D,\n Paint,\n Types,\n component2d,\n lerpVector2,\n type NodeOf,\n type Size2D,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\"\n\nimport { addTiledLines } from \"../kit\"\n\n/** One mark's place on an axis, and whether it lands on the coarse grid. */\ninterface GridPosition {\n pos: number\n isMajor: boolean\n}\n\n// Calls the tiling `LineGridPattern` uses, so dots stay on its intersections at every offset.\nfunction gridPositions(\n min: number,\n max: number,\n step: number,\n offset: number,\n subdivisions: number,\n overscan: number\n): GridPosition[] {\n const out: GridPosition[] = []\n // Anchored at the near edge, so a column or row sits on each edge of the box for any count of cells.\n addTiledLines(min, max, step, offset, subdivisions, overscan, (pos, isMajor) => {\n out.push({ pos, isMajor })\n }, min)\n return out\n}\n\nconst state = {\n ...Paint.state,\n ...Flow.state,\n /** Cells along each axis, as in `LineGridPattern.divisions`: 4 puts 5 major dots on each axis. */\n divisions: 4,\n /** Splits each division again. `1` draws only the major dots; `2` puts one minor dot between each pair. */\n subdivisions: 1,\n /** Radius of a major dot. */\n radius: 3,\n /**\n * A minor dot's radius as a fraction of a major one's. A fraction rather than a\n * second paint stack, so the whole field stays one fill and a gradient crosses\n * every dot in it.\n */\n subScale: 0.5,\n /** Pans the field, as `LineGridPattern.offset` does, so the two stay aligned while both scroll. */\n offset: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2 }),\n}\n\ninterface DotField {\n readonly divisions: number\n readonly subdivisions: number\n readonly radius: number\n readonly subScale: number\n readonly offset: Vector2\n}\n\n/**\n * A field of dots on the same `divisions` / `subdivisions` / `offset` as\n * `LineGridPattern`, so laid over one the dots sit on its intersections.\n *\n * The silhouette is the dots, which `Paint.draw` paints with `shadow`, `fill`,\n * `overlay` and `stroke`. A dot grid has no \"paper\": a rectangle behind it is how\n * it gets a background.\n *\n * What `clip` confines the children to, and what picking tests, is the node's\n * box rather than the silhouette, which clips outer dots as they pan out and\n * keeps the node selectable between dots. `start` / `end` act on nothing:\n * trimming a disc leaves a crescent, not a partial grid.\n */\nexport const DotGridPattern = component2d({\n key: \"dotGridPattern\",\n state,\n commands: { ...Paint.commands },\n measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),\n layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),\n render: (ctx, state) => {\n const untrimmed = {\n fill: state.fill, stroke: state.stroke, shadow: state.shadow, overlay: state.overlay, start: 0, end: 1, clip: state.clip,\n }\n const box = new Graphics2D().rect({ width: ctx.size.width, height: ctx.size.height })\n Paint.draw(ctx, untrimmed, dots(ctx.size, state), { clipShape: box })\n },\n})\n\nexport type DotGridPattern = NodeOf<typeof DotGridPattern>\n/** What a call or a document row may set. */\nexport type DotGridPatternProps = NonNullable<Parameters<typeof DotGridPattern>[0]>\n\n/** Every dot in the field as one un-painted union: the paint stacks belong to the grid, not to a dot. */\nfunction dots(size: Size2D, s: DotField): Graphics2D | null {\n const { width, height } = size\n if (width <= 0 || height <= 0) return null\n\n const divisions = Math.max(1, Math.floor(s.divisions))\n const subdivisions = Math.max(1, Math.floor(s.subdivisions))\n const major = Math.max(0, s.radius)\n const minor = major * Math.max(0, s.subScale)\n if (major <= 0 && minor <= 0) return null\n\n // Inset by a dot's radius so an edge dot sits inside the box rather than being halved by the clip.\n const cols = divisions * subdivisions\n const insetX = Math.max(0, width / 2 - major)\n const insetY = Math.max(0, height / 2 - major)\n const xs = gridPositions(\n -insetX,\n insetX,\n (insetX * 2) / cols,\n s.offset.x,\n subdivisions,\n major\n )\n const ys = gridPositions(\n -insetY,\n insetY,\n (insetY * 2) / cols,\n s.offset.y,\n subdivisions,\n major\n )\n\n const field = new Graphics2D()\n let drew = false\n for (const column of xs) {\n for (const row of ys) {\n // A dot is major only where *both* axes are — an intersection of two\n // major rules, which is exactly the point a line grid draws heaviest.\n const size = column.isMajor && row.isMajor ? major : minor\n if (size <= 0) continue\n field.ellipse({ x: column.pos, y: row.pos, width: size * 2, height: size * 2 })\n drew = true\n }\n }\n return drew ? field : null\n}\n", "import {\n Graphics2D,\n Types,\n component2d,\n lerpNumber,\n lerpVector2,\n type BoxBounds,\n type NodeOf,\n type PathCommand,\n type RenderContext,\n type ShadowResolved,\n type FillResolved,\n type StrokeResolved,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type Fill as _Fill,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type Stroke as _Stroke,\n} from \"@motionscript/sdk\";\n\nimport { centered, defaultSubStroke, gridLines, maxWeight, ViewportPattern, type GridAxis } from \"../kit\";\n\n/**\n * An infinite line grid that fills the camera's visible region. Like\n * `LineGridPattern` it draws major and minor strokes over a fill and pans\n * with `offset`, but it tiles a world-anchored grid (spacing `cellSize`) across\n * what the nearest `Camera` above it can see, regenerated each frame. With no\n * camera it fills its own layout rect.\n */\nexport const GridPattern = component2d({\n key: \"gridPattern\",\n state: {\n ...ViewportPattern.state,\n /** Spacing between grid lines in world units: one number for both axes, or `{ x, y }`. */\n cellSize: Types.custom<number | Vector2>(100, { lerp: lerpCellSize }),\n /** Finer cells each cell is split into, as in `LineGridPattern.subdivisions`. */\n subdivisions: 1,\n /** Stroke for the minor lines. Unset, the major `stroke` at half opacity when `subdivisions > 1`. */\n subStroke: Types.stroke,\n /** Scrolls the pattern relative to the world, which it is otherwise anchored to. */\n offset: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2 }),\n },\n defaults: { subStroke: (_state, given) => defaultSubStroke(given) },\n commands: { ...ViewportPattern.commands },\n measure: ViewportPattern.measure,\n layout: ViewportPattern.layout,\n render: (ctx, state) => ViewportPattern.draw(ctx, (bounds) => drawGrid(ctx, state, bounds)),\n});\n\nexport type GridPattern = NodeOf<typeof GridPattern>;\n/** What a call or a document row may set. */\nexport type GridPatternProps = NonNullable<Parameters<typeof GridPattern>[0]>;\n\ninterface GridState {\n readonly fill: FillResolved[];\n readonly stroke: StrokeResolved[];\n readonly shadow: ShadowResolved[];\n readonly start: number;\n readonly end: number;\n readonly cellSize: number | Vector2;\n readonly subdivisions: number;\n readonly subStroke: StrokeResolved[];\n readonly offset: Vector2;\n}\n\nfunction drawGrid(ctx: RenderContext, s: GridState, bounds: BoxBounds): void {\n const halfW = bounds.width / 2;\n const halfH = bounds.height / 2;\n // `bounds` is centred on (x, y) in y-up world space: descriptor coordinates are y-up\n // and the renderer applies the single flip.\n const left = bounds.x - halfW;\n const right = bounds.x + halfW;\n const top = bounds.y - halfH;\n const bottom = bounds.y + halfH;\n\n ctx.draw(new Graphics2D()\n .rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height, start: s.start, end: s.end })\n .shadow(s.shadow)\n .fill(s.fill));\n\n const subdivisions = Math.max(1, Math.floor(s.subdivisions));\n const cell = s.cellSize;\n const cellX = Math.max(1e-3, typeof cell === \"number\" ? cell : cell.x);\n const cellY = Math.max(1e-3, typeof cell === \"number\" ? cell : cell.y);\n const stepX = cellX / subdivisions;\n const stepY = cellY / subdivisions;\n\n const major = centered(s.stroke);\n const minorStroke = centered(s.subStroke);\n const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;\n\n const xAxis: GridAxis = { min: left, max: right, step: stepX, offset: s.offset.x };\n const yAxis: GridAxis = { min: top, max: bottom, step: stepY, offset: s.offset.y };\n\n // Minor lines first so the major lines sit on top.\n if (subdivisions > 1 && minorStroke.length > 0) {\n drawGroup(ctx, xAxis, yAxis, subdivisions, overscan, minorStroke, false);\n }\n if (major.length > 0) {\n drawGroup(ctx, xAxis, yAxis, subdivisions, overscan, major, true);\n }\n}\n\n// A solid stroke paints the group as one union path. A dashed one draws each line on\n// its own with its dash phase anchored to the line's world coordinate, so dashes never\n// crawl as the camera pans or new lines scroll in.\nfunction drawGroup(\n ctx: RenderContext,\n xAxis: GridAxis,\n yAxis: GridAxis,\n subdivisions: number,\n overscan: number,\n stroke: StrokeResolved[],\n isMajor: boolean,\n): void {\n // Each line spans a whole number of dash cycles, so the renderer's per-path dash-fit\n // is a no-op and every line dashes identically.\n const cycle = dashCycle(stroke);\n const g = gridLines(xAxis, yAxis, subdivisions, overscan, cycle);\n const verticals = isMajor ? g.verticalMajor : g.verticalMinor;\n const horizontals = isMajor ? g.horizontalMajor : g.horizontalMinor;\n\n // Symmetric centerBounds give a zero recentre offset, so local coordinates draw verbatim.\n const centerBounds = [-1, -1, 1, 1] as const;\n\n if (cycle <= 0) {\n const data: PathCommand[] = [];\n for (const px of verticals) data.push({ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom });\n for (const py of horizontals) data.push({ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py });\n if (data.length > 0) ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(stroke));\n return;\n }\n\n for (const px of verticals) {\n const data: PathCommand[] = [{ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom }];\n ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.top)));\n }\n for (const py of horizontals) {\n const data: PathCommand[] = [{ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py }];\n ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.left)));\n }\n}\n\n// The largest dash-array sum across the layers, or 0 when none is dashed.\nfunction dashCycle(strokes: StrokeResolved[]): number {\n let cycle = 0;\n for (const s of strokes) {\n if (s.dash && s.dash.length > 0) {\n const sum = s.dash.reduce((a, b) => a + b, 0);\n if (sum > cycle) cycle = sum;\n }\n }\n return cycle;\n}\n\n// `dashOffset` advances the pattern, so it is negated to put the \"on\" run at the phase one\n// infinite line would have at this world coordinate.\nfunction phaseShift(strokes: StrokeResolved[], worldStart: number): StrokeResolved[] {\n return strokes.map(s => (s.dash && s.dash.length > 0)\n ? { ...s, dashOffset: (s.dashOffset ?? 0) - worldStart }\n : s);\n}\n\n// A number and a vector tween by promoting the number to a uniform vector.\nfunction lerpCellSize(from: number | Vector2, to: number | Vector2, t: number): number | Vector2 {\n if (typeof from === \"number\" && typeof to === \"number\") return lerpNumber(from, to, t);\n const a = typeof from === \"number\" ? { x: from, y: from } : from;\n const b = typeof to === \"number\" ? { x: to, y: to } : to;\n return lerpVector2(a, b, t);\n}\n", "import { DotGridPattern } from \"./dot-grid-pattern\"\nimport { GridPattern } from \"./grid-pattern\"\nimport { LineGridPattern } from \"./line-grid-pattern\"\n\n/**\n * Every node type this package publishes.\n *\n * A host registers these by handing the array to an engine —\n * `new Engine(platform, { nodes: NODES })` — which reads each component's key.\n * Defining a component only *declares* that key: nothing is registered by\n * importing a module, so a registry holds exactly what its owner asked for.\n *\n * Listing the component **values** is also what survives bundling: this package\n * declares `sideEffects: false`, and a document names a node type by string, so\n * an import kept only for its side effect is exactly what gets shaken out.\n */\n// Typed by name, so the declaration names each component rather than spelling out its type through core.\ntype KitNode =\n | typeof LineGridPattern\n | typeof DotGridPattern\n | typeof GridPattern\n\nexport const NODES: KitNode[] = [\n LineGridPattern,\n DotGridPattern,\n GridPattern,\n]\n"],
|
|
5
|
+
"mappings": "iGAAA,OACI,QAAAA,EACA,cAAAC,EACA,SAAAC,EACA,SAAAC,EACA,eAAAC,EACA,eAAAC,MAkBG,oBAUA,IAAMC,EAAkBC,EAAY,CACvC,IAAK,kBACL,MAAO,CACH,GAAGC,EAAM,MACT,GAAGC,EAAK,MAER,UAAW,EAEX,aAAc,EAEd,UAAWC,EAAM,OAEjB,OAAQA,EAAM,OAAgB,CAAE,EAA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CAAE,KAAM,IAAK,EAAGP,EAAE,MAAO,EAAGO,CAAE,CAAE,EAC9FrC,EAAI,KAAK,IAAIW,EAAU,EAAG,KAAK,CAAE,KAAAwB,EAAM,aAAAD,CAAY,CAAE,EAAE,OAAOI,EAAWZ,EAAQI,EAAE,IAAI,CAAC,CAAC,CAC7F,CACJ,CAGA,SAASD,GAAUU,EAAyB,CACxC,IAAIX,EAAQ,EACZ,QAAWxB,KAAKmC,EACZ,GAAInC,EAAE,MAAQA,EAAE,KAAK,OAAS,EAAG,CAC7B,IAAMoC,EAAMpC,EAAE,KAAK,OAAO,CAAC,EAAGqC,IAAM,EAAIA,EAAG,CAAC,EACxCD,EAAMZ,IAAOA,EAAQY,EAC7B,CAEJ,OAAOZ,CACX,CAIA,SAASU,EAAWC,EAA2BG,EAAkB,CAC7D,OAAOH,EAAQ,IAAInC,GAAMA,EAAE,MAAQA,EAAE,KAAK,OAAS,EAC7C,CAAE,GAAGA,EAAG,YAAaA,EAAE,YAAc,GAAKsC,CAAU,EACpDtC,CAAC,CACX,CAGA,SAAST,GAAagD,EAAwBC,EAAsBC,EAAS,CACzE,OAAI,OAAOF,GAAS,UAAY,OAAOC,GAAO,SAAiBE,EAAWH,EAAMC,EAAIC,CAAC,EAG9EjD,EAFG,OAAO+C,GAAS,SAAW,CAAE,EAAGA,EAAM,EAAGA,CAAI,EAAKA,EAClD,OAAOC,GAAO,SAAW,CAAE,EAAGA,EAAI,EAAGA,CAAE,EAAKA,EAC7BC,CAAC,CAC9B,CCzJO,IAAME,GAAmB,CAC5BC,EACAC,EACAC",
|
|
6
|
+
"names": ["Flow", "Graphics2D", "Paint", "Types", "component2d", "lerpVector2", "LineGridPattern", "component2d", "Paint", "Flow", "Types", "lerpVector2", "_state", "given", "defaultSubStroke", "measurer", "state", "children", "box", "ctx", "width", "height", "Graphics2D", "divisions", "subdivisions", "major", "centered", "minorStroke", "overscan", "maxWeight", "lines", "gridPaths", "centerBounds", "offset", "cols", "innerW", "innerH", "insetX", "insetY", "gridLinePaths", "Flow", "Graphics2D", "Paint", "Types", "component2d", "lerpVector2", "gridPositions", "min", "max", "step", "offset", "subdivisions", "overscan", "out", "addTiledLines", "pos", "isMajor", "state", "Paint", "Flow", "Types", "lerpVector2", "DotGridPattern", "component2d", "measurer", "children", "box", "ctx", "untrimmed", "Graphics2D", "dots", "size", "s", "width", "height", "divisions", "major", "minor", "cols", "insetX", "insetY", "xs", "ys", "field", "drew", "column", "row", "Graphics2D", "Types", "component2d", "lerpNumber", "lerpVector2", "GridPattern", "component2d", "viewport_pattern_exports", "Types", "lerpCellSize", "lerpVector2", "_state", "given", "defaultSubStroke", "ctx", "state", "bounds", "drawGrid", "s", "halfW", "halfH", "left", "right", "top", "bottom", "Graphics2D", "subdivisions", "cell", "cellX", "cellY", "stepX", "stepY", "major", "centered", "minorStroke", "overscan", "maxWeight", "xAxis", "yAxis", "drawGroup", "stroke", "isMajor", "cycle", "dashCycle", "g", "gridLines", "verticals", "horizontals", "centerBounds", "data", "px", "py", "phaseShift", "strokes", "sum", "b", "worldStart", "from", "to", "t", "lerpNumber", "NODES", "LineGridPattern", "DotGridPattern", "GridPattern"]
|
|
7
|
+
}
|