mathbox-react 0.0.10 → 0.0.11-rc
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/.github/renovate.json +13 -0
- package/.github/workflows/lint.yaml +2 -2
- package/build/cjs/{types/components → components}/ContainedMathbox.d.ts +0 -0
- package/build/cjs/{types/components → components}/Mathbox.d.ts +0 -0
- package/build/cjs/components/MathboxNodeContext.d.ts +4 -0
- package/build/{esm/types → cjs}/components/components.d.ts +6 -1
- package/build/cjs/{types/components → components}/components.spec.d.ts +0 -0
- package/build/cjs/{types/components → components}/index.d.ts +0 -0
- package/build/cjs/{types/components → components}/types.d.ts +0 -0
- package/build/cjs/{types/components → components}/util.d.ts +0 -0
- package/build/cjs/{types/index.d.ts → index.d.ts} +0 -0
- package/build/cjs/index.js +1 -24
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/{types/stories → stories}/utils.d.ts +0 -0
- package/build/cjs/{types/testSetup.d.ts → testSetup.d.ts} +0 -0
- package/build/cjs/{types/testUtils.d.ts → testUtils.d.ts} +0 -0
- package/build/esm/{types/components → components}/ContainedMathbox.d.ts +0 -0
- package/build/esm/{types/components → components}/Mathbox.d.ts +0 -0
- package/build/esm/components/MathboxNodeContext.d.ts +4 -0
- package/build/{cjs/types → esm}/components/components.d.ts +6 -1
- package/build/esm/{types/components → components}/components.spec.d.ts +0 -0
- package/build/esm/{types/components → components}/index.d.ts +0 -0
- package/build/esm/{types/components → components}/types.d.ts +0 -0
- package/build/esm/{types/components → components}/util.d.ts +0 -0
- package/build/esm/{types/index.d.ts → index.d.ts} +0 -0
- package/build/esm/index.js +1 -24
- package/build/esm/index.js.map +1 -1
- package/build/esm/{types/stories → stories}/utils.d.ts +0 -0
- package/build/esm/{types/testSetup.d.ts → testSetup.d.ts} +0 -0
- package/build/esm/{types/testUtils.d.ts → testUtils.d.ts} +0 -0
- package/build/index.d.ts +6 -1
- package/package.json +38 -38
- package/rollup.config.js +1 -1
- package/src/components/components.spec.tsx +36 -1
- package/src/components/components.tsx +30 -6
- package/src/components/util.ts +1 -1
- package/src/stories/Point.stories.tsx +8 -1
- package/build/cjs/types/components/MathboxNodeContext.d.ts +0 -4
- package/build/esm/types/components/MathboxNodeContext.d.ts +0 -4
- package/scratch.js +0 -149
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/build/index.d.ts
CHANGED
|
@@ -8,7 +8,12 @@ declare type WithChildren<T> = {
|
|
|
8
8
|
declare const CAN_HAVE_CHILDREN: readonly ["view", "cartesian", "cartesian4", "polar", "spherical", "stereographic", "stereographic4", "transform", "transform4", "vertex", "fragment", "layer", "mask", "group", "inherit", "root", "unit", "rtt", "clock", "now", "move", "present", "reveal", "slide"];
|
|
9
9
|
declare type ParentNodeTypes = typeof CAN_HAVE_CHILDREN[number];
|
|
10
10
|
|
|
11
|
-
declare type
|
|
11
|
+
declare type LiveProps<P> = {
|
|
12
|
+
[K in keyof P]: (t: number, dt: number) => P[K];
|
|
13
|
+
};
|
|
14
|
+
declare type MathboxComponent<T extends NodeType> = React.ForwardRefExoticComponent<(T extends ParentNodeTypes ? WithChildren<Props[T]> : Props[T]) & React.RefAttributes<MathboxSelection<T>> & {
|
|
15
|
+
liveProps?: LiveProps<Props[T]>;
|
|
16
|
+
}>;
|
|
12
17
|
/**
|
|
13
18
|
* Component wrapper for mathbox [`area`](https://gitgud.io/unconed/mathbox/-/blob/master/docs/primitives.md#dataarea).
|
|
14
19
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mathbox-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11-rc",
|
|
4
4
|
"description": "React wrapper for Mathbox",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Chris Chudzicki",
|
|
@@ -18,45 +18,45 @@
|
|
|
18
18
|
"test": "jest"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@babel/core": "
|
|
22
|
-
"@babel/preset-env": "
|
|
23
|
-
"@rollup/plugin-commonjs": "
|
|
24
|
-
"@rollup/plugin-node-resolve": "
|
|
25
|
-
"@rollup/plugin-typescript": "
|
|
26
|
-
"@storybook/addon-actions": "
|
|
27
|
-
"@storybook/addon-essentials": "
|
|
28
|
-
"@storybook/addon-interactions": "
|
|
29
|
-
"@storybook/addon-links": "
|
|
30
|
-
"@storybook/react": "
|
|
31
|
-
"@storybook/testing-library": "
|
|
32
|
-
"@testing-library/react": "
|
|
33
|
-
"@types/jest": "
|
|
34
|
-
"@types/lodash": "
|
|
35
|
-
"@types/react": "
|
|
36
|
-
"@types/three": "
|
|
37
|
-
"babel-jest": "
|
|
38
|
-
"babel-loader": "
|
|
39
|
-
"eslint-config-airbnb": "
|
|
40
|
-
"eslint-config-airbnb-typescript": "
|
|
41
|
-
"eslint-config-prettier": "
|
|
42
|
-
"eslint-config-react-app": "
|
|
43
|
-
"eslint-import-resolver-typescript": "
|
|
44
|
-
"eslint-plugin-prettier": "
|
|
45
|
-
"jest": "
|
|
46
|
-
"mathbox": "
|
|
47
|
-
"prettier": "
|
|
48
|
-
"react": "
|
|
49
|
-
"react-dom": "
|
|
50
|
-
"rollup": "
|
|
51
|
-
"rollup-plugin-dts": "
|
|
52
|
-
"rollup-plugin-peer-deps-external": "
|
|
53
|
-
"rollup-plugin-terser": "
|
|
54
|
-
"three": "
|
|
55
|
-
"ts-jest": "
|
|
56
|
-
"typescript": "
|
|
21
|
+
"@babel/core": "7.19.3",
|
|
22
|
+
"@babel/preset-env": "7.19.4",
|
|
23
|
+
"@rollup/plugin-commonjs": "23.0.0",
|
|
24
|
+
"@rollup/plugin-node-resolve": "15.0.0",
|
|
25
|
+
"@rollup/plugin-typescript": "9.0.1",
|
|
26
|
+
"@storybook/addon-actions": "6.5.12",
|
|
27
|
+
"@storybook/addon-essentials": "6.5.12",
|
|
28
|
+
"@storybook/addon-interactions": "6.5.12",
|
|
29
|
+
"@storybook/addon-links": "6.5.12",
|
|
30
|
+
"@storybook/react": "6.5.12",
|
|
31
|
+
"@storybook/testing-library": "0.0.13",
|
|
32
|
+
"@testing-library/react": "12.1.5",
|
|
33
|
+
"@types/jest": "27.5.2",
|
|
34
|
+
"@types/lodash": "4.14.186",
|
|
35
|
+
"@types/react": "18.0.21",
|
|
36
|
+
"@types/three": "0.140.0",
|
|
37
|
+
"babel-jest": "27.5.1",
|
|
38
|
+
"babel-loader": "8.2.5",
|
|
39
|
+
"eslint-config-airbnb": "19.0.4",
|
|
40
|
+
"eslint-config-airbnb-typescript": "17.0.0",
|
|
41
|
+
"eslint-config-prettier": "8.5.0",
|
|
42
|
+
"eslint-config-react-app": "7.0.1",
|
|
43
|
+
"eslint-import-resolver-typescript": "3.5.1",
|
|
44
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
45
|
+
"jest": "27.5.1",
|
|
46
|
+
"mathbox": "2.2.1",
|
|
47
|
+
"prettier": "2.7.1",
|
|
48
|
+
"react": "17.0.2",
|
|
49
|
+
"react-dom": "17.0.2",
|
|
50
|
+
"rollup": "2.79.1",
|
|
51
|
+
"rollup-plugin-dts": "4.2.3",
|
|
52
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
53
|
+
"rollup-plugin-terser": "7.0.2",
|
|
54
|
+
"three": "0.140.0",
|
|
55
|
+
"ts-jest": "27.1.5",
|
|
56
|
+
"typescript": "4.8.4"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"mathbox": "^2.1
|
|
59
|
+
"mathbox": "^2.2.1",
|
|
60
60
|
"react": "^17.0.2 || ^18.0.0",
|
|
61
61
|
"three": ">=0.118.0"
|
|
62
62
|
},
|
package/rollup.config.js
CHANGED
|
@@ -134,6 +134,41 @@ describe("Cartesian", () => {
|
|
|
134
134
|
expect(cartesian.get("visible")).toBe(false)
|
|
135
135
|
})
|
|
136
136
|
|
|
137
|
+
it("updates liveProps on its mathbox instance when rerendered", async () => {
|
|
138
|
+
const mbRef: MathboxRef<"root"> = { current: null }
|
|
139
|
+
const { rerender } = render(
|
|
140
|
+
<ContainedMathbox ref={mbRef}>
|
|
141
|
+
<Cartesian>
|
|
142
|
+
<Grid
|
|
143
|
+
liveProps={{
|
|
144
|
+
width: (t) => 1 + t,
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
147
|
+
</Cartesian>
|
|
148
|
+
</ContainedMathbox>
|
|
149
|
+
)
|
|
150
|
+
const grid = mbRef.current?.select<"grid">("grid")
|
|
151
|
+
assertNotNil(grid)
|
|
152
|
+
|
|
153
|
+
const w1 = grid.get("width")
|
|
154
|
+
await new Promise((resolve) => {
|
|
155
|
+
setTimeout(resolve, 500)
|
|
156
|
+
})
|
|
157
|
+
const w2 = grid.get("width")
|
|
158
|
+
expect(w1).toBe(1)
|
|
159
|
+
// Mathbox uses seconds
|
|
160
|
+
expect(w2 - w1).toBeGreaterThan(0.45)
|
|
161
|
+
expect(w2 - w1).toBeLessThanOrEqual(0.5)
|
|
162
|
+
rerender(
|
|
163
|
+
<ContainedMathbox ref={mbRef}>
|
|
164
|
+
<Cartesian>
|
|
165
|
+
<Grid width={10} />
|
|
166
|
+
</Cartesian>
|
|
167
|
+
</ContainedMathbox>
|
|
168
|
+
)
|
|
169
|
+
expect(grid.get("width")).toBe(10)
|
|
170
|
+
})
|
|
171
|
+
|
|
137
172
|
it("re-renders inside new instance when root changes", () => {
|
|
138
173
|
const mbRef: MathboxRef<"root"> = { current: null }
|
|
139
174
|
const cartesianRef: MathboxRef<"cartesian"> = { current: null }
|
|
@@ -264,7 +299,7 @@ describe("<Voxel />", () => {
|
|
|
264
299
|
<ContainedMathbox>
|
|
265
300
|
<Cartesian>
|
|
266
301
|
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
|
267
|
-
{/* @ts-
|
|
302
|
+
{/* @ts-expect-error */}
|
|
268
303
|
<Voxel>
|
|
269
304
|
<Grid />
|
|
270
305
|
</Voxel>
|
|
@@ -17,9 +17,14 @@ import {
|
|
|
17
17
|
capitalize,
|
|
18
18
|
} from "./util"
|
|
19
19
|
|
|
20
|
+
type LiveProps<P> = {
|
|
21
|
+
[K in keyof P]: (t: number, dt: number) => P[K]
|
|
22
|
+
}
|
|
20
23
|
type MathboxComponent<T extends NodeType> = React.ForwardRefExoticComponent<
|
|
21
24
|
(T extends ParentNodeTypes ? WithChildren<Props[T]> : Props[T]) &
|
|
22
|
-
React.RefAttributes<MathboxSelection<T>>
|
|
25
|
+
React.RefAttributes<MathboxSelection<T>> & {
|
|
26
|
+
liveProps?: LiveProps<Props[T]>
|
|
27
|
+
}
|
|
23
28
|
>
|
|
24
29
|
|
|
25
30
|
const mathboxComponentFactory = <T extends NodeType>(
|
|
@@ -28,12 +33,13 @@ const mathboxComponentFactory = <T extends NodeType>(
|
|
|
28
33
|
const canHaveChildren = canNodeHaveChildren(type)
|
|
29
34
|
const componentName = capitalize(type)
|
|
30
35
|
const Comp = (
|
|
31
|
-
props: WithChildren<Props[T]
|
|
36
|
+
props: WithChildren<Props[T]> & { liveProps?: LiveProps<Props[T]> },
|
|
32
37
|
ref: React.Ref<MathboxSelection<T> | null>
|
|
33
38
|
) => {
|
|
34
39
|
const [_ignored, forceUpdate] = useReducer((x) => x + 1, 0)
|
|
35
40
|
const parent = useContext(MathboxAPIContext)
|
|
36
41
|
const selection = useRef<MathboxSelection<T> | null>(null)
|
|
42
|
+
const prevLiveProps = useRef<LiveProps<Props[T]> | undefined>(undefined)
|
|
37
43
|
useEffect(
|
|
38
44
|
() => () => {
|
|
39
45
|
if (selection.current) {
|
|
@@ -45,7 +51,7 @@ const mathboxComponentFactory = <T extends NodeType>(
|
|
|
45
51
|
)
|
|
46
52
|
useImperativeHandle(ref, () => selection.current)
|
|
47
53
|
|
|
48
|
-
const { children, ...others } = props
|
|
54
|
+
const { children, liveProps, ...others } = props
|
|
49
55
|
useEffect(() => {
|
|
50
56
|
if (!parent) return
|
|
51
57
|
if (isRootDestroyed(parent)) {
|
|
@@ -61,13 +67,31 @@ const mathboxComponentFactory = <T extends NodeType>(
|
|
|
61
67
|
}
|
|
62
68
|
if (!selection.current) {
|
|
63
69
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
|
-
// @ts-
|
|
65
|
-
selection.current = parent[type](others)
|
|
70
|
+
// @ts-expect-error
|
|
71
|
+
selection.current = parent[type](others, liveProps)
|
|
66
72
|
forceUpdate()
|
|
67
73
|
} else {
|
|
74
|
+
/**
|
|
75
|
+
* If liveProps have changed, remove all the old liveProps.
|
|
76
|
+
* (The same prop cannot be re-assigned live without being un-assigned
|
|
77
|
+
* first.)
|
|
78
|
+
*
|
|
79
|
+
* We could unbind just the ones that have changed, but simpler to
|
|
80
|
+
* unbind them all.
|
|
81
|
+
*/
|
|
82
|
+
if (prevLiveProps.current && liveProps !== prevLiveProps.current) {
|
|
83
|
+
Object.keys(prevLiveProps.current).forEach((key) => {
|
|
84
|
+
// @ts-expect-error this is not in ts yet
|
|
85
|
+
selection.current.unbind(key)
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
if (liveProps && liveProps !== prevLiveProps.current) {
|
|
89
|
+
selection.current.bind(liveProps)
|
|
90
|
+
}
|
|
68
91
|
selection.current.set(others)
|
|
69
92
|
}
|
|
70
|
-
|
|
93
|
+
prevLiveProps.current = liveProps
|
|
94
|
+
}, [parent, others, liveProps])
|
|
71
95
|
if (!canHaveChildren) {
|
|
72
96
|
if (props.children) {
|
|
73
97
|
throw new Error(`Component <${componentName} /> cannot have children.`)
|
package/src/components/util.ts
CHANGED
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
|
|
30
30
|
const Template: Story<React.ComponentProps<typeof Point>> = (args) => {
|
|
31
31
|
const { points, ...otherArgs } = args
|
|
32
|
-
const [data, setData] = useState<MathboxSelection<"array"
|
|
32
|
+
const [data, setData] = useState<MathboxSelection<"array"> | null>(null)
|
|
33
33
|
return (
|
|
34
34
|
<Mathbox containerStyle={{ height: 450 }}>
|
|
35
35
|
<Cartesian
|
|
@@ -66,3 +66,10 @@ const Template: Story<React.ComponentProps<typeof Point>> = (args) => {
|
|
|
66
66
|
|
|
67
67
|
export const DefaultPoint = Template.bind({})
|
|
68
68
|
DefaultPoint.args = {}
|
|
69
|
+
|
|
70
|
+
export const LiveProps = Template.bind({})
|
|
71
|
+
LiveProps.args = {
|
|
72
|
+
liveProps: {
|
|
73
|
+
size: (t: number) => 20 * (1 + 0.5 * Math.sin(t)),
|
|
74
|
+
},
|
|
75
|
+
}
|
package/scratch.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
const classDescriptions = {
|
|
2
|
-
axis: ["draw", "Draw an axis", {}, { end: "true", zBias: "-1" }],
|
|
3
|
-
face: ["draw", "Draw polygon faces"],
|
|
4
|
-
grid: ["draw", "Draw a 2D line grid", {}, { width: "1", zBias: "-2" }],
|
|
5
|
-
line: ["draw", "Draw lines"],
|
|
6
|
-
point: ["draw", "Draw points"],
|
|
7
|
-
strip: ["draw", "Draw triangle strips"],
|
|
8
|
-
surface: ["draw", "Draw surfaces", {}, { lineX: "false", lineY: "false" }],
|
|
9
|
-
ticks: ["draw", "Draw ticks"],
|
|
10
|
-
vector: ["draw", "Draw vectors"],
|
|
11
|
-
|
|
12
|
-
view: ["view", "Adjust view range"],
|
|
13
|
-
cartesian: ["view", "Apply cartesian view"],
|
|
14
|
-
cartesian4: ["view", "Apply 4D cartesian view"],
|
|
15
|
-
polar: ["view", "Apply polar view"],
|
|
16
|
-
spherical: ["view", "Apply spherical view"],
|
|
17
|
-
stereographic: ["view", "Apply stereographic projection"],
|
|
18
|
-
stereographic4: ["view", "Apply 4D stereographic projection"],
|
|
19
|
-
|
|
20
|
-
transform: ["transform", "Transform geometry in 3D"],
|
|
21
|
-
transform4: ["transform", "Transform geometry in 4D"],
|
|
22
|
-
vertex: ["transform", "Apply custom vertex shader pass"],
|
|
23
|
-
fragment: ["transform", "Apply custom fragment shader pass"],
|
|
24
|
-
layer: ["transform", "Independent 2D layer/overlay"],
|
|
25
|
-
mask: ["transform", "Apply custom mask pass"],
|
|
26
|
-
|
|
27
|
-
array: [
|
|
28
|
-
"data",
|
|
29
|
-
"1D array",
|
|
30
|
-
{ expr: "function (emit, i, time, delta) { ... }" },
|
|
31
|
-
],
|
|
32
|
-
interval: [
|
|
33
|
-
"data",
|
|
34
|
-
"1D sampled array",
|
|
35
|
-
{ expr: "function (emit, x, i, time, delta) { ... }" },
|
|
36
|
-
],
|
|
37
|
-
matrix: [
|
|
38
|
-
"data",
|
|
39
|
-
"2D matrix",
|
|
40
|
-
{ expr: "function (emit, i, j, time, delta) { ... }" },
|
|
41
|
-
],
|
|
42
|
-
area: [
|
|
43
|
-
"data",
|
|
44
|
-
"2D sampled matrix",
|
|
45
|
-
{ expr: "function (emit, x, y, i, j, time, delta) { ... }" },
|
|
46
|
-
],
|
|
47
|
-
voxel: [
|
|
48
|
-
"data",
|
|
49
|
-
"3D voxels",
|
|
50
|
-
{ expr: "function (emit, i, j, k, time, delta) { ... }" },
|
|
51
|
-
],
|
|
52
|
-
volume: [
|
|
53
|
-
"data",
|
|
54
|
-
"3D sampled voxels",
|
|
55
|
-
{ expr: "function (emit, x, y, z, i, j, k, time, delta) { ... }" },
|
|
56
|
-
],
|
|
57
|
-
scale: ["data", "Human-friendly divisions on an axis, subdivided as needed"],
|
|
58
|
-
|
|
59
|
-
html: ["overlay", "HTML element source"],
|
|
60
|
-
dom: ["overlay", "HTML DOM injector"],
|
|
61
|
-
|
|
62
|
-
text: [
|
|
63
|
-
"text",
|
|
64
|
-
"GL text source",
|
|
65
|
-
{},
|
|
66
|
-
{ minFilter: '"linear"', magFilter: '"linear"' },
|
|
67
|
-
],
|
|
68
|
-
format: [
|
|
69
|
-
"text",
|
|
70
|
-
"Text formatter",
|
|
71
|
-
{ expr: "function (x, y, z, w, i, j, k, l, time, delta) { ... }" },
|
|
72
|
-
{ minFilter: '"linear"', magFilter: '"linear"' },
|
|
73
|
-
],
|
|
74
|
-
retext: ["text", "Text atlas resampler"],
|
|
75
|
-
label: ["text", "Draw GL labels"],
|
|
76
|
-
|
|
77
|
-
clamp: ["operator", "Clamp out-of-bounds samples to the nearest data point"],
|
|
78
|
-
grow: ["operator", "Scale data relative to reference data point"],
|
|
79
|
-
join: [
|
|
80
|
-
"operator",
|
|
81
|
-
"Join two array dimensions into one by concatenating rows/columns/stacks",
|
|
82
|
-
],
|
|
83
|
-
lerp: ["operator", "Linear interpolation of data"],
|
|
84
|
-
memo: ["operator", "Memoize data to an array/texture"],
|
|
85
|
-
readback: [
|
|
86
|
-
"operator",
|
|
87
|
-
"Read data back to a binary JavaScript array",
|
|
88
|
-
{ expr: "function (x, y, z, w, i, j, k, l) { ... }" },
|
|
89
|
-
],
|
|
90
|
-
resample: ["operator", "Resample data to new dimensions with a shader"],
|
|
91
|
-
repeat: ["operator", "Repeat data in one or more dimensions"],
|
|
92
|
-
swizzle: ["operator", "Swizzle data values"],
|
|
93
|
-
spread: ["operator", "Spread data values according to array indices"],
|
|
94
|
-
split: [
|
|
95
|
-
"operator",
|
|
96
|
-
"Split one array dimension into two by splitting rows/columns/etc",
|
|
97
|
-
],
|
|
98
|
-
slice: ["operator", "Select one or more rows/columns/stacks"],
|
|
99
|
-
subdivide: ["operator", "Subdivide data points evenly or with a bevel"],
|
|
100
|
-
transpose: ["operator", "Transpose array dimensions"],
|
|
101
|
-
|
|
102
|
-
group: ["base", "Group elements for visibility and activity"],
|
|
103
|
-
inherit: ["base", "Inherit and inject a trait from another element"],
|
|
104
|
-
root: ["base", "Tree root"],
|
|
105
|
-
unit: ["base", "Change unit sizing for drawing ops"],
|
|
106
|
-
|
|
107
|
-
shader: ["shader", "Custom shader snippet"],
|
|
108
|
-
|
|
109
|
-
camera: ["camera", "Camera instance or proxy"],
|
|
110
|
-
|
|
111
|
-
rtt: [
|
|
112
|
-
"rtt",
|
|
113
|
-
"Render objects to a texture",
|
|
114
|
-
{},
|
|
115
|
-
{ minFilter: '"linear"', magFilter: '"linear"', type: '"unsignedByte"' },
|
|
116
|
-
],
|
|
117
|
-
compose: [
|
|
118
|
-
"rtt",
|
|
119
|
-
"Full-screen render pass",
|
|
120
|
-
{},
|
|
121
|
-
{ zWrite: "false", zTest: "false", color: '"white"' },
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
clock: ["time", "Relative clock that starts from zero."],
|
|
125
|
-
now: ["time", "Absolute UNIX time in seconds since 01/01/1970"],
|
|
126
|
-
|
|
127
|
-
move: ["present", "Move elements in/out on transition"],
|
|
128
|
-
play: ["present", "Play a sequenced animation"],
|
|
129
|
-
present: ["present", "Present a tree of slides"],
|
|
130
|
-
reveal: ["present", "Reveal/hide elements on transition"],
|
|
131
|
-
slide: ["present", "Presentation slide"],
|
|
132
|
-
step: ["present", "Step through a sequenced animation"],
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const capitalize = (s) => `${s[0].toUpperCase()}${s.slice(1)}`
|
|
136
|
-
|
|
137
|
-
const makeDef = (name) => {
|
|
138
|
-
const [group] = classDescriptions[name]
|
|
139
|
-
const Name = capitalize(name)
|
|
140
|
-
const dest = `https://gitgud.io/unconed/mathbox/-/blob/master/docs/primitives.md#${group}${name}`
|
|
141
|
-
const def = `
|
|
142
|
-
/**
|
|
143
|
-
* Component wrapper for mathbox [\`${name}\`](${dest}).
|
|
144
|
-
*/
|
|
145
|
-
export const ${Name} = mathboxComponentFactory('${name}');`
|
|
146
|
-
console.log(def)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
Object.keys(classDescriptions).sort().forEach(makeDef)
|