@blinkorb/rcx 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/canvas/context.d.ts +11 -0
- package/components/canvas/context.js +4 -0
- package/components/canvas/context.js.map +1 -0
- package/components/canvas/index.d.ts +7 -0
- package/components/canvas/index.js +62 -0
- package/components/canvas/index.js.map +1 -0
- package/components/index.js +6 -0
- package/components/index.js.map +1 -0
- package/components/paths/arc-to.d.ts +12 -0
- package/components/paths/arc-to.js +24 -0
- package/components/paths/arc-to.js.map +1 -0
- package/components/paths/clip.d.ts +6 -0
- package/components/paths/clip.js +19 -0
- package/components/paths/clip.js.map +1 -0
- package/components/paths/index.js +6 -0
- package/components/paths/index.js.map +1 -0
- package/components/paths/line.d.ts +11 -0
- package/components/paths/line.js +25 -0
- package/components/paths/line.js.map +1 -0
- package/components/paths/path.d.ts +8 -0
- package/components/paths/path.js +33 -0
- package/components/paths/path.js.map +1 -0
- package/components/paths/point.d.ts +7 -0
- package/components/paths/point.js +15 -0
- package/components/paths/point.js.map +1 -0
- package/components/shapes/circle.d.ts +14 -0
- package/components/shapes/circle.js +8 -0
- package/components/shapes/circle.js.map +1 -0
- package/components/shapes/ellipse.d.ts +15 -0
- package/components/shapes/ellipse.js +24 -0
- package/components/shapes/ellipse.js.map +1 -0
- package/components/shapes/index.js +4 -0
- package/components/shapes/index.js.map +1 -0
- package/components/shapes/rectangle.d.ts +10 -0
- package/components/shapes/rectangle.js +20 -0
- package/components/shapes/rectangle.js.map +1 -0
- package/components/text/index.js +2 -0
- package/components/text/index.js.map +1 -0
- package/components/text/text.d.ts +13 -0
- package/components/text/text.js +78 -0
- package/components/text/text.js.map +1 -0
- package/components/transform/index.js +4 -0
- package/components/transform/index.js.map +1 -0
- package/components/transform/rotate.d.ts +5 -0
- package/components/transform/rotate.js +14 -0
- package/components/transform/rotate.js.map +1 -0
- package/components/transform/scale.d.ts +11 -0
- package/components/transform/scale.js +14 -0
- package/components/transform/scale.js.map +1 -0
- package/components/transform/translate.d.ts +6 -0
- package/components/transform/translate.js +14 -0
- package/components/transform/translate.js.map +1 -0
- package/context/create-context.d.ts +9 -0
- package/context/create-context.js +29 -0
- package/context/create-context.js.map +1 -0
- package/context/index.js +2 -0
- package/context/index.js.map +1 -0
- package/hooks/index.js +9 -0
- package/hooks/index.js.map +1 -0
- package/hooks/use-canvas-context.d.ts +1 -0
- package/hooks/use-canvas-context.js +9 -0
- package/hooks/use-canvas-context.js.map +1 -0
- package/hooks/use-linear-gradient.d.ts +9 -0
- package/hooks/use-linear-gradient.js +13 -0
- package/hooks/use-linear-gradient.js.map +1 -0
- package/hooks/use-loop.d.ts +1 -0
- package/hooks/use-loop.js +9 -0
- package/hooks/use-loop.js.map +1 -0
- package/hooks/use-on.d.ts +2 -0
- package/hooks/use-on.js +16 -0
- package/hooks/use-on.js.map +1 -0
- package/hooks/use-radial-gradient.d.ts +11 -0
- package/hooks/use-radial-gradient.js +13 -0
- package/hooks/use-radial-gradient.js.map +1 -0
- package/hooks/use-render.d.ts +3 -0
- package/hooks/use-render.js +8 -0
- package/hooks/use-render.js.map +1 -0
- package/hooks/use-state.d.ts +3 -0
- package/hooks/use-state.js +5 -0
- package/hooks/use-state.js.map +1 -0
- package/hooks/use-window-size.d.ts +4 -0
- package/hooks/use-window-size.js +20 -0
- package/hooks/use-window-size.js.map +1 -0
- package/index.js +7 -0
- package/index.js.map +1 -0
- package/internal/emitter.d.ts +15 -0
- package/internal/emitter.js +19 -0
- package/internal/emitter.js.map +1 -0
- package/internal/global.d.ts +2 -0
- package/internal/global.js +4 -0
- package/internal/global.js.map +1 -0
- package/internal/hooks.d.ts +2 -0
- package/internal/hooks.js +17 -0
- package/internal/hooks.js.map +1 -0
- package/internal/reactive.d.ts +2 -0
- package/internal/reactive.js +16 -0
- package/internal/reactive.js.map +1 -0
- package/jsx-runtime.d.ts +4 -0
- package/jsx-runtime.js +8 -0
- package/jsx-runtime.js.map +1 -0
- package/package.json +11 -23
- package/render.d.ts +4 -0
- package/render.js +198 -0
- package/render.js.map +1 -0
- package/types.d.ts +108 -0
- package/types.js +1 -0
- package/types.js.map +1 -0
- package/utils/apply-fill-and-stroke-style.d.ts +2 -0
- package/utils/apply-fill-and-stroke-style.js +24 -0
- package/utils/apply-fill-and-stroke-style.js.map +1 -0
- package/utils/get-recommended-pixel-ratio.d.ts +1 -0
- package/utils/get-recommended-pixel-ratio.js +2 -0
- package/utils/get-recommended-pixel-ratio.js.map +1 -0
- package/utils/index.js +9 -0
- package/utils/index.js.map +1 -0
- package/utils/is-own-property-of.d.ts +2 -0
- package/utils/is-own-property-of.js +2 -0
- package/utils/is-own-property-of.js.map +1 -0
- package/utils/is-valid-fill-or-stroke-style.d.ts +1 -0
- package/utils/is-valid-fill-or-stroke-style.js +3 -0
- package/utils/is-valid-fill-or-stroke-style.js.map +1 -0
- package/utils/is-valid-stroke-cap.d.ts +1 -0
- package/utils/is-valid-stroke-cap.js +8 -0
- package/utils/is-valid-stroke-cap.js.map +1 -0
- package/utils/is-valid-stroke-join.d.ts +1 -0
- package/utils/is-valid-stroke-join.js +8 -0
- package/utils/is-valid-stroke-join.js.map +1 -0
- package/utils/resolve-styles.d.ts +2 -0
- package/utils/resolve-styles.js +16 -0
- package/utils/resolve-styles.js.map +1 -0
- package/utils/type-guards.d.ts +2 -0
- package/utils/type-guards.js +2 -0
- package/utils/type-guards.js.map +1 -0
- package/utils/with-px.d.ts +1 -0
- package/utils/with-px.js +2 -0
- package/utils/with-px.js.map +1 -0
- package/.eslintignore +0 -4
- package/.eslintrc.json +0 -286
- package/.gitattributes +0 -2
- package/.github/CODEOWNERS +0 -1
- package/.github/workflows/ci.yml +0 -19
- package/.nvmrc +0 -1
- package/.prettierignore +0 -28
- package/.prettierrc.json +0 -4
- package/demo/index.html +0 -29
- package/demo/index.tsx +0 -316
- package/demo/tsconfig.json +0 -12
- package/jest.config.ts +0 -21
- package/scripts/prep-package.js +0 -29
- package/src/components/canvas/context.ts +0 -6
- package/src/components/canvas/index.ts +0 -98
- package/src/components/paths/arc-to.ts +0 -66
- package/src/components/paths/clip.ts +0 -32
- package/src/components/paths/line.ts +0 -53
- package/src/components/paths/path.ts +0 -59
- package/src/components/paths/point.ts +0 -24
- package/src/components/shapes/circle.tsx +0 -32
- package/src/components/shapes/ellipse.ts +0 -75
- package/src/components/shapes/rectangle.ts +0 -45
- package/src/components/text/text.ts +0 -137
- package/src/components/transform/rotate.ts +0 -26
- package/src/components/transform/scale.ts +0 -34
- package/src/components/transform/translate.ts +0 -27
- package/src/context/create-context.ts +0 -49
- package/src/hooks/use-canvas-context.ts +0 -11
- package/src/hooks/use-linear-gradient.ts +0 -39
- package/src/hooks/use-loop.ts +0 -11
- package/src/hooks/use-on.ts +0 -18
- package/src/hooks/use-radial-gradient.ts +0 -45
- package/src/hooks/use-render.ts +0 -14
- package/src/hooks/use-state.ts +0 -9
- package/src/hooks/use-window-size.ts +0 -24
- package/src/internal/emitter.ts +0 -39
- package/src/internal/global.ts +0 -5
- package/src/internal/hooks.ts +0 -32
- package/src/internal/reactive.test.ts +0 -20
- package/src/internal/reactive.ts +0 -20
- package/src/jsx-runtime.ts +0 -21
- package/src/render.ts +0 -299
- package/src/types.ts +0 -151
- package/src/utils/apply-fill-and-stroke-style.ts +0 -33
- package/src/utils/get-recommended-pixel-ratio.ts +0 -2
- package/src/utils/is-own-property-of.ts +0 -6
- package/src/utils/is-valid-fill-or-stroke-style.ts +0 -5
- package/src/utils/is-valid-stroke-cap.ts +0 -10
- package/src/utils/is-valid-stroke-join.ts +0 -10
- package/src/utils/resolve-styles.ts +0 -21
- package/src/utils/type-guards.ts +0 -4
- package/src/utils/with-px.ts +0 -4
- package/tsb.config.ts +0 -11
- package/tsconfig.dist.json +0 -13
- package/tsconfig.json +0 -25
- /package/{src/components/index.ts → components/index.d.ts} +0 -0
- /package/{src/components/paths/index.ts → components/paths/index.d.ts} +0 -0
- /package/{src/components/shapes/index.ts → components/shapes/index.d.ts} +0 -0
- /package/{src/components/text/index.ts → components/text/index.d.ts} +0 -0
- /package/{src/components/transform/index.ts → components/transform/index.d.ts} +0 -0
- /package/{src/context/index.ts → context/index.d.ts} +0 -0
- /package/{src/hooks/index.ts → hooks/index.d.ts} +0 -0
- /package/{src/index.ts → index.d.ts} +0 -0
- /package/{src/utils/index.ts → utils/index.d.ts} +0 -0
package/.eslintrc.json
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"eslint:recommended",
|
|
4
|
-
"plugin:prettier/recommended",
|
|
5
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
6
|
-
"plugin:@typescript-eslint/recommended"
|
|
7
|
-
],
|
|
8
|
-
"plugins": ["prettier", "simple-import-sort"],
|
|
9
|
-
"env": {
|
|
10
|
-
"es6": true,
|
|
11
|
-
"commonjs": true
|
|
12
|
-
},
|
|
13
|
-
"parser": "@typescript-eslint/parser",
|
|
14
|
-
"parserOptions": {
|
|
15
|
-
"sourceType": "module",
|
|
16
|
-
"ecmaVersion": 9
|
|
17
|
-
},
|
|
18
|
-
"globals": {
|
|
19
|
-
"window": false,
|
|
20
|
-
"performance": false,
|
|
21
|
-
"document": false,
|
|
22
|
-
"navigator": false,
|
|
23
|
-
"location": false,
|
|
24
|
-
"console": false,
|
|
25
|
-
"setTimeout": false,
|
|
26
|
-
"clearTimeout": false,
|
|
27
|
-
"setInterval": false,
|
|
28
|
-
"clearInterval": false,
|
|
29
|
-
"alert": false,
|
|
30
|
-
"requestAnimationFrame": false,
|
|
31
|
-
"cancelAnimationFrame": false,
|
|
32
|
-
"localStorage": false,
|
|
33
|
-
"sessionStorage": false,
|
|
34
|
-
"FormData": false,
|
|
35
|
-
"Node": false,
|
|
36
|
-
"Image": false,
|
|
37
|
-
"CanvasRenderingContext2D": false
|
|
38
|
-
},
|
|
39
|
-
"rules": {
|
|
40
|
-
"strict": [2, "global"],
|
|
41
|
-
"no-duplicate-imports": [2, { "includeExports": true }],
|
|
42
|
-
|
|
43
|
-
"eqeqeq": 2,
|
|
44
|
-
"block-scoped-var": 2,
|
|
45
|
-
"no-constant-condition": 2,
|
|
46
|
-
"no-console": 2,
|
|
47
|
-
"no-debugger": 2,
|
|
48
|
-
"no-lonely-if": 2,
|
|
49
|
-
"no-lone-blocks": 2,
|
|
50
|
-
"no-nested-ternary": 2,
|
|
51
|
-
"no-dupe-keys": 2,
|
|
52
|
-
"no-extra-boolean-cast": 2,
|
|
53
|
-
"no-irregular-whitespace": 2,
|
|
54
|
-
"no-else-return": 2,
|
|
55
|
-
"no-eval": 2,
|
|
56
|
-
"no-multi-str": 2,
|
|
57
|
-
"no-self-compare": 2,
|
|
58
|
-
"no-useless-call": 2,
|
|
59
|
-
"no-shadow-restricted-names": 2,
|
|
60
|
-
"no-shadow": 0,
|
|
61
|
-
"no-undef": 2,
|
|
62
|
-
"no-undef-init": 2,
|
|
63
|
-
"no-unreachable": 2,
|
|
64
|
-
"no-unused-vars": [2, { "varsIgnorePattern": "^_\\w" }],
|
|
65
|
-
"no-use-before-define": 2,
|
|
66
|
-
|
|
67
|
-
"radix": 2,
|
|
68
|
-
"curly": 2,
|
|
69
|
-
"no-fallthrough": 2,
|
|
70
|
-
"default-case": 2,
|
|
71
|
-
|
|
72
|
-
"no-var": 2,
|
|
73
|
-
"no-unused-expressions": 2,
|
|
74
|
-
"camelcase": [
|
|
75
|
-
2,
|
|
76
|
-
{
|
|
77
|
-
"properties": "always",
|
|
78
|
-
"allow": ["^UNSAFE_", "call_id"]
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"@typescript-eslint/no-explicit-any": 2,
|
|
82
|
-
"@typescript-eslint/explicit-function-return-type": 0,
|
|
83
|
-
"@typescript-eslint/member-delimiter-style": 0,
|
|
84
|
-
"@typescript-eslint/type-annotation-spacing": 0,
|
|
85
|
-
"@typescript-eslint/no-unused-vars": 2,
|
|
86
|
-
"@typescript-eslint/no-use-before-define": 2,
|
|
87
|
-
"@typescript-eslint/no-shadow": 2,
|
|
88
|
-
"no-restricted-globals": [
|
|
89
|
-
"error",
|
|
90
|
-
"URL",
|
|
91
|
-
"history",
|
|
92
|
-
"dispatchEvent",
|
|
93
|
-
"require",
|
|
94
|
-
"postMessage",
|
|
95
|
-
"blur",
|
|
96
|
-
"focus",
|
|
97
|
-
"close",
|
|
98
|
-
"frames",
|
|
99
|
-
"self",
|
|
100
|
-
"parent",
|
|
101
|
-
"opener",
|
|
102
|
-
"top",
|
|
103
|
-
"length",
|
|
104
|
-
"closed",
|
|
105
|
-
"location",
|
|
106
|
-
"origin",
|
|
107
|
-
"name",
|
|
108
|
-
"locationbar",
|
|
109
|
-
"menubar",
|
|
110
|
-
"personalbar",
|
|
111
|
-
"scrollbars",
|
|
112
|
-
"statusbar",
|
|
113
|
-
"toolbar",
|
|
114
|
-
"status",
|
|
115
|
-
"frameElement",
|
|
116
|
-
"navigator",
|
|
117
|
-
"customElements",
|
|
118
|
-
"external",
|
|
119
|
-
"screen",
|
|
120
|
-
"innerWidth",
|
|
121
|
-
"innerHeight",
|
|
122
|
-
"scrollX",
|
|
123
|
-
"pageXOffset",
|
|
124
|
-
"scrollY",
|
|
125
|
-
"pageYOffset",
|
|
126
|
-
"screenX",
|
|
127
|
-
"screenY",
|
|
128
|
-
"outerWidth",
|
|
129
|
-
"outerHeight",
|
|
130
|
-
"devicePixelRatio",
|
|
131
|
-
"clientInformation",
|
|
132
|
-
"screenLeft",
|
|
133
|
-
"screenTop",
|
|
134
|
-
"defaultStatus",
|
|
135
|
-
"defaultstatus",
|
|
136
|
-
"styleMedia",
|
|
137
|
-
"onanimationend",
|
|
138
|
-
"onanimationiteration",
|
|
139
|
-
"onanimationstart",
|
|
140
|
-
"onsearch",
|
|
141
|
-
"ontransitionend",
|
|
142
|
-
"onwebkitanimationend",
|
|
143
|
-
"onwebkitanimationiteration",
|
|
144
|
-
"onwebkitanimationstart",
|
|
145
|
-
"onwebkittransitionend",
|
|
146
|
-
"isSecureContext",
|
|
147
|
-
"onabort",
|
|
148
|
-
"onblur",
|
|
149
|
-
"oncancel",
|
|
150
|
-
"oncanplay",
|
|
151
|
-
"oncanplaythrough",
|
|
152
|
-
"onchange",
|
|
153
|
-
"onclick",
|
|
154
|
-
"onclose",
|
|
155
|
-
"oncontextmenu",
|
|
156
|
-
"oncuechange",
|
|
157
|
-
"ondblclick",
|
|
158
|
-
"ondrag",
|
|
159
|
-
"ondragend",
|
|
160
|
-
"ondragenter",
|
|
161
|
-
"ondragleave",
|
|
162
|
-
"ondragover",
|
|
163
|
-
"ondragstart",
|
|
164
|
-
"ondrop",
|
|
165
|
-
"ondurationchange",
|
|
166
|
-
"onemptied",
|
|
167
|
-
"onended",
|
|
168
|
-
"onerror",
|
|
169
|
-
"onfocus",
|
|
170
|
-
"oninput",
|
|
171
|
-
"oninvalid",
|
|
172
|
-
"onkeydown",
|
|
173
|
-
"onkeypress",
|
|
174
|
-
"onkeyup",
|
|
175
|
-
"onload",
|
|
176
|
-
"onloadeddata",
|
|
177
|
-
"onloadedmetadata",
|
|
178
|
-
"onloadstart",
|
|
179
|
-
"onmousedown",
|
|
180
|
-
"onmouseenter",
|
|
181
|
-
"onmouseleave",
|
|
182
|
-
"onmousemove",
|
|
183
|
-
"onmouseout",
|
|
184
|
-
"onmouseover",
|
|
185
|
-
"onmouseup",
|
|
186
|
-
"onmousewheel",
|
|
187
|
-
"onpause",
|
|
188
|
-
"onplay",
|
|
189
|
-
"onplaying",
|
|
190
|
-
"onprogress",
|
|
191
|
-
"onratechange",
|
|
192
|
-
"onreset",
|
|
193
|
-
"onresize",
|
|
194
|
-
"onscroll",
|
|
195
|
-
"onseeked",
|
|
196
|
-
"onseeking",
|
|
197
|
-
"onselect",
|
|
198
|
-
"onstalled",
|
|
199
|
-
"onsubmit",
|
|
200
|
-
"onsuspend",
|
|
201
|
-
"ontimeupdate",
|
|
202
|
-
"ontoggle",
|
|
203
|
-
"onvolumechange",
|
|
204
|
-
"onwaiting",
|
|
205
|
-
"onwheel",
|
|
206
|
-
"onauxclick",
|
|
207
|
-
"ongotpointercapture",
|
|
208
|
-
"onlostpointercapture",
|
|
209
|
-
"onpointerdown",
|
|
210
|
-
"onpointermove",
|
|
211
|
-
"onpointerup",
|
|
212
|
-
"onpointercancel",
|
|
213
|
-
"onpointerover",
|
|
214
|
-
"onpointerout",
|
|
215
|
-
"onpointerenter",
|
|
216
|
-
"onpointerleave",
|
|
217
|
-
"onafterprint",
|
|
218
|
-
"onbeforeprint",
|
|
219
|
-
"onbeforeunload",
|
|
220
|
-
"onhashchange",
|
|
221
|
-
"onlanguagechange",
|
|
222
|
-
"onmessage",
|
|
223
|
-
"onmessageerror",
|
|
224
|
-
"onoffline",
|
|
225
|
-
"ononline",
|
|
226
|
-
"onpagehide",
|
|
227
|
-
"onpageshow",
|
|
228
|
-
"onpopstate",
|
|
229
|
-
"onrejectionhandled",
|
|
230
|
-
"onstorage",
|
|
231
|
-
"onunhandledrejection",
|
|
232
|
-
"onunload",
|
|
233
|
-
"performance",
|
|
234
|
-
"stop",
|
|
235
|
-
"open",
|
|
236
|
-
"print",
|
|
237
|
-
"captureEvents",
|
|
238
|
-
"releaseEvents",
|
|
239
|
-
"getComputedStyle",
|
|
240
|
-
"matchMedia",
|
|
241
|
-
"moveTo",
|
|
242
|
-
"moveBy",
|
|
243
|
-
"resizeTo",
|
|
244
|
-
"resizeBy",
|
|
245
|
-
"getSelection",
|
|
246
|
-
"find",
|
|
247
|
-
"createImageBitmap",
|
|
248
|
-
"scroll",
|
|
249
|
-
"scrollTo",
|
|
250
|
-
"scrollBy",
|
|
251
|
-
"onappinstalled",
|
|
252
|
-
"onbeforeinstallprompt",
|
|
253
|
-
"crypto",
|
|
254
|
-
"ondevicemotion",
|
|
255
|
-
"ondeviceorientation",
|
|
256
|
-
"ondeviceorientationabsolute",
|
|
257
|
-
"indexedDB",
|
|
258
|
-
"webkitStorageInfo",
|
|
259
|
-
"chrome",
|
|
260
|
-
"visualViewport",
|
|
261
|
-
"speechSynthesis",
|
|
262
|
-
"webkitRequestFileSystem",
|
|
263
|
-
"webkitResolveLocalFileSystemURL",
|
|
264
|
-
"openDatabase",
|
|
265
|
-
"setTimeout",
|
|
266
|
-
"clearTimeout",
|
|
267
|
-
"setInterval",
|
|
268
|
-
"clearInterval",
|
|
269
|
-
"requestAnimationFrame",
|
|
270
|
-
"cancelAnimationFrame",
|
|
271
|
-
"addEventListener",
|
|
272
|
-
"removeEventListener"
|
|
273
|
-
],
|
|
274
|
-
"simple-import-sort/imports": "error"
|
|
275
|
-
},
|
|
276
|
-
"overrides": [
|
|
277
|
-
{
|
|
278
|
-
"files": ["*.ts", "*.tsx"],
|
|
279
|
-
"rules": {
|
|
280
|
-
"no-undef": 0,
|
|
281
|
-
"no-unused-vars": 0,
|
|
282
|
-
"no-use-before-define": 0
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
]
|
|
286
|
-
}
|
package/.gitattributes
DELETED
package/.github/CODEOWNERS
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* @jakesidsmith
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on: [pull_request]
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
test:
|
|
6
|
-
runs-on: ubuntu-latest
|
|
7
|
-
steps:
|
|
8
|
-
- uses: actions/checkout@v4
|
|
9
|
-
- uses: actions/cache@v4
|
|
10
|
-
with:
|
|
11
|
-
path: ~/.npm
|
|
12
|
-
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
|
|
13
|
-
- uses: actions/setup-node@v4
|
|
14
|
-
with:
|
|
15
|
-
node-version-file: '.nvmrc'
|
|
16
|
-
- name: Install dependencies
|
|
17
|
-
run: npm ci
|
|
18
|
-
- name: Run tests
|
|
19
|
-
run: npm test
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
22.14.0
|
package/.prettierignore
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/coverage/*
|
|
2
|
-
/build/*
|
|
3
|
-
/dist/*
|
|
4
|
-
/packages/*/coverage/*
|
|
5
|
-
/packages/*/static/*
|
|
6
|
-
/packages/*/server/*
|
|
7
|
-
/packages/*/build/*
|
|
8
|
-
/packages/*/dist/*
|
|
9
|
-
/.vscode/*
|
|
10
|
-
**/*.txt
|
|
11
|
-
**/*.snap
|
|
12
|
-
*.toml
|
|
13
|
-
*.png
|
|
14
|
-
*.svg
|
|
15
|
-
*.jpg
|
|
16
|
-
*.jpeg
|
|
17
|
-
*.gif
|
|
18
|
-
|
|
19
|
-
.DS_Store
|
|
20
|
-
.eslintignore
|
|
21
|
-
.prettierignore
|
|
22
|
-
.gitignore
|
|
23
|
-
.gitattributes
|
|
24
|
-
.npmignore
|
|
25
|
-
.nvmrc
|
|
26
|
-
.browserslistrc
|
|
27
|
-
.env
|
|
28
|
-
LICENSE.txt
|
package/.prettierrc.json
DELETED
package/demo/index.html
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta
|
|
6
|
-
name="viewport"
|
|
7
|
-
content="width=device-width, initial-scale=1, maximum-scale=1"
|
|
8
|
-
/>
|
|
9
|
-
<title>
|
|
10
|
-
RCX - Reactive JSX-based library for creating HTML5 canvas applications
|
|
11
|
-
</title>
|
|
12
|
-
<style type="text/css">
|
|
13
|
-
html,
|
|
14
|
-
body {
|
|
15
|
-
margin: 0;
|
|
16
|
-
padding: 0;
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
canvas {
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 100%;
|
|
25
|
-
}
|
|
26
|
-
</style>
|
|
27
|
-
</head>
|
|
28
|
-
<body></body>
|
|
29
|
-
</html>
|
package/demo/index.tsx
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ArcTo,
|
|
3
|
-
Canvas,
|
|
4
|
-
Circle,
|
|
5
|
-
Clip,
|
|
6
|
-
Ellipse,
|
|
7
|
-
Line,
|
|
8
|
-
Path,
|
|
9
|
-
Point,
|
|
10
|
-
RCXComponent,
|
|
11
|
-
Rectangle,
|
|
12
|
-
render,
|
|
13
|
-
Rotate,
|
|
14
|
-
Scale,
|
|
15
|
-
Text,
|
|
16
|
-
Translate,
|
|
17
|
-
useCanvasContext,
|
|
18
|
-
useLinearGradient,
|
|
19
|
-
useLoop,
|
|
20
|
-
useOnMount,
|
|
21
|
-
useRadialGradient,
|
|
22
|
-
useReactive,
|
|
23
|
-
} from '@blinkorb/rcx';
|
|
24
|
-
|
|
25
|
-
const RendersChildren: RCXComponent = ({ children }) => children;
|
|
26
|
-
|
|
27
|
-
const Unmounts: RCXComponent = () => {
|
|
28
|
-
// eslint-disable-next-line no-console
|
|
29
|
-
console.log('rendered');
|
|
30
|
-
|
|
31
|
-
useOnMount(() => {
|
|
32
|
-
// eslint-disable-next-line no-console
|
|
33
|
-
console.log('mounted');
|
|
34
|
-
|
|
35
|
-
return () => {
|
|
36
|
-
// eslint-disable-next-line no-console
|
|
37
|
-
console.log('unmounted');
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Rectangle x={0} y={0} width={10} height={10} style={{ fill: 'black' }} />
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const Gradients: RCXComponent = () => {
|
|
47
|
-
const stroke = useLinearGradient({
|
|
48
|
-
startX: 10,
|
|
49
|
-
startY: 480,
|
|
50
|
-
endX: 10 + 50,
|
|
51
|
-
endY: 480 + 50,
|
|
52
|
-
stops: [
|
|
53
|
-
{
|
|
54
|
-
offset: 0,
|
|
55
|
-
color: '#f00',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
offset: 1,
|
|
59
|
-
color: '#000',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const fill = useRadialGradient({
|
|
65
|
-
startX: 10 + 25,
|
|
66
|
-
startY: 480 + 25,
|
|
67
|
-
startRadius: 0,
|
|
68
|
-
endX: 10 + 25,
|
|
69
|
-
endY: 480 + 25,
|
|
70
|
-
endRadius: 25,
|
|
71
|
-
stops: [
|
|
72
|
-
{
|
|
73
|
-
offset: 0,
|
|
74
|
-
color: '#000',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
offset: 1,
|
|
78
|
-
color: 'cyan',
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<Rectangle
|
|
85
|
-
x={10}
|
|
86
|
-
y={480}
|
|
87
|
-
width={50}
|
|
88
|
-
height={50}
|
|
89
|
-
style={{ fill, stroke, strokeWidth: 5, strokeCap: 'round' }}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const Page: RCXComponent = () => {
|
|
95
|
-
const canvasContext = useCanvasContext();
|
|
96
|
-
const getOffset = () => Math.cos(Date.now() * 0.001) * 10;
|
|
97
|
-
const reactive = useReactive({ isMounted: true, offset: getOffset() });
|
|
98
|
-
|
|
99
|
-
useLoop(() => {
|
|
100
|
-
reactive.offset = getOffset();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
useOnMount(() => {
|
|
104
|
-
window.setTimeout(() => {
|
|
105
|
-
reactive.isMounted = false;
|
|
106
|
-
}, 1000);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<>
|
|
111
|
-
<Rectangle
|
|
112
|
-
x={canvasContext.width * 0.25}
|
|
113
|
-
y={canvasContext.height * 0.25 + reactive.offset}
|
|
114
|
-
width={canvasContext.width * 0.5}
|
|
115
|
-
height={canvasContext.height * 0.5}
|
|
116
|
-
style={{ fill: 'red' }}
|
|
117
|
-
/>
|
|
118
|
-
<Ellipse
|
|
119
|
-
x={canvasContext.width * 0.5}
|
|
120
|
-
y={canvasContext.height * 0.5}
|
|
121
|
-
radiusX={canvasContext.width * 0.2}
|
|
122
|
-
radiusY={canvasContext.width * 0.1}
|
|
123
|
-
style={{ fill: 'black' }}
|
|
124
|
-
rotation={((Date.now() % 5000) / 5000) * Math.PI * 2}
|
|
125
|
-
/>
|
|
126
|
-
<Circle
|
|
127
|
-
x={canvasContext.width * 0.5}
|
|
128
|
-
y={canvasContext.height * 0.5}
|
|
129
|
-
radius={canvasContext.width * 0.05}
|
|
130
|
-
endAngle={
|
|
131
|
-
Math.PI +
|
|
132
|
-
Math.cos(((Date.now() % 5000) / 5000) * Math.PI * 2) * Math.PI
|
|
133
|
-
}
|
|
134
|
-
style={{ fill: 'white' }}
|
|
135
|
-
>
|
|
136
|
-
<Point x={canvasContext.width * 0.5} y={canvasContext.height * 0.5} />
|
|
137
|
-
</Circle>
|
|
138
|
-
<Line
|
|
139
|
-
startX={10}
|
|
140
|
-
startY={10}
|
|
141
|
-
endX={20}
|
|
142
|
-
endY={20}
|
|
143
|
-
style={{ stroke: 'green', strokeWidth: 5, strokeJoin: 'bevel' }}
|
|
144
|
-
>
|
|
145
|
-
<Point x={30} y={10} />
|
|
146
|
-
</Line>
|
|
147
|
-
<Path
|
|
148
|
-
points={[
|
|
149
|
-
[0, 20],
|
|
150
|
-
[5, 50],
|
|
151
|
-
[10, 0],
|
|
152
|
-
[15, 20],
|
|
153
|
-
[20, 5],
|
|
154
|
-
]}
|
|
155
|
-
style={{ stroke: 'black' }}
|
|
156
|
-
/>
|
|
157
|
-
<Path style={{ stroke: 'black' }} closePath>
|
|
158
|
-
<Point x={0} y={50} />
|
|
159
|
-
<Point x={5} y={55} />
|
|
160
|
-
<Point x={10} y={50} />
|
|
161
|
-
<Point x={15} y={55} />
|
|
162
|
-
<Point x={20} y={50} />
|
|
163
|
-
<Point x={20} y={75} />
|
|
164
|
-
<Point x={0} y={75} />
|
|
165
|
-
</Path>
|
|
166
|
-
<Path style={{ stroke: 'blue', strokeWidth: 5, strokeCap: 'round' }}>
|
|
167
|
-
<Point x={200} y={200} />
|
|
168
|
-
<ArcTo
|
|
169
|
-
startControlX={200}
|
|
170
|
-
startControlY={100}
|
|
171
|
-
endControlX={300}
|
|
172
|
-
endControlY={100}
|
|
173
|
-
radius={50}
|
|
174
|
-
/>
|
|
175
|
-
<Point x={300} y={100} />
|
|
176
|
-
</Path>
|
|
177
|
-
<Text x={305} y={102} style={{ fill: 'red', stroke: 'black' }}>
|
|
178
|
-
The offset is {reactive.offset.toFixed(2)} {[1, 2, 3].map((n) => n)}{' '}
|
|
179
|
-
<RendersChildren>Children</RendersChildren>
|
|
180
|
-
</Text>
|
|
181
|
-
<Translate x={100} y={100}>
|
|
182
|
-
<Rotate rotation={Math.PI * 0.25}>
|
|
183
|
-
<Scale scale={0.5}>
|
|
184
|
-
<Rectangle
|
|
185
|
-
x={0}
|
|
186
|
-
y={0}
|
|
187
|
-
width={100}
|
|
188
|
-
height={50}
|
|
189
|
-
style={{ fill: 'cyan' }}
|
|
190
|
-
/>
|
|
191
|
-
</Scale>
|
|
192
|
-
</Rotate>
|
|
193
|
-
</Translate>
|
|
194
|
-
<Rectangle x={0} y={100} width={50} height={50}>
|
|
195
|
-
<Clip>
|
|
196
|
-
<Circle x={25} y={125} radius={30} style={{ fill: '#d5d5d5' }} />
|
|
197
|
-
<Text x={10} y={125} style={{ fill: 'red' }}>
|
|
198
|
-
This text is clipped by a rectangle
|
|
199
|
-
</Text>
|
|
200
|
-
</Clip>
|
|
201
|
-
</Rectangle>
|
|
202
|
-
|
|
203
|
-
<Line
|
|
204
|
-
startX={100}
|
|
205
|
-
endX={100}
|
|
206
|
-
startY={190}
|
|
207
|
-
endY={290}
|
|
208
|
-
style={{ stroke: '#d5d5d5' }}
|
|
209
|
-
/>
|
|
210
|
-
<Text x={100} y={200} style={{ fill: 'black' }}>
|
|
211
|
-
Left (default)
|
|
212
|
-
</Text>
|
|
213
|
-
<Text x={100} y={220} style={{ fill: 'black', align: 'right' }}>
|
|
214
|
-
Right
|
|
215
|
-
</Text>
|
|
216
|
-
<Text x={100} y={240} style={{ fill: 'black', align: 'center' }}>
|
|
217
|
-
Center
|
|
218
|
-
</Text>
|
|
219
|
-
<Text x={100} y={260} style={{ fill: 'black', align: 'start' }}>
|
|
220
|
-
Start
|
|
221
|
-
</Text>
|
|
222
|
-
<Text x={100} y={280} style={{ fill: 'black', align: 'end' }}>
|
|
223
|
-
End
|
|
224
|
-
</Text>
|
|
225
|
-
|
|
226
|
-
<Line
|
|
227
|
-
startX={50}
|
|
228
|
-
endX={150}
|
|
229
|
-
startY={300}
|
|
230
|
-
endY={300}
|
|
231
|
-
style={{ stroke: '#d5d5d5' }}
|
|
232
|
-
/>
|
|
233
|
-
<Text x={100} y={300} style={{ fill: 'black', baseline: 'alphabetic' }}>
|
|
234
|
-
Alphabetic (default)
|
|
235
|
-
</Text>
|
|
236
|
-
<Line
|
|
237
|
-
startX={50}
|
|
238
|
-
endX={150}
|
|
239
|
-
startY={320}
|
|
240
|
-
endY={320}
|
|
241
|
-
style={{ stroke: '#d5d5d5' }}
|
|
242
|
-
/>
|
|
243
|
-
<Text x={100} y={320} style={{ fill: 'black', baseline: 'bottom' }}>
|
|
244
|
-
Bottom
|
|
245
|
-
</Text>
|
|
246
|
-
<Line
|
|
247
|
-
startX={50}
|
|
248
|
-
endX={150}
|
|
249
|
-
startY={340}
|
|
250
|
-
endY={340}
|
|
251
|
-
style={{ stroke: '#d5d5d5' }}
|
|
252
|
-
/>
|
|
253
|
-
<Text x={100} y={340} style={{ fill: 'black', baseline: 'hanging' }}>
|
|
254
|
-
Hanging
|
|
255
|
-
</Text>
|
|
256
|
-
<Line
|
|
257
|
-
startX={50}
|
|
258
|
-
endX={150}
|
|
259
|
-
startY={360}
|
|
260
|
-
endY={360}
|
|
261
|
-
style={{ stroke: '#d5d5d5' }}
|
|
262
|
-
/>
|
|
263
|
-
<Text x={100} y={360} style={{ fill: 'black', baseline: 'ideographic' }}>
|
|
264
|
-
Ideographic
|
|
265
|
-
</Text>
|
|
266
|
-
<Line
|
|
267
|
-
startX={50}
|
|
268
|
-
endX={150}
|
|
269
|
-
startY={380}
|
|
270
|
-
endY={380}
|
|
271
|
-
style={{ stroke: '#d5d5d5' }}
|
|
272
|
-
/>
|
|
273
|
-
<Text x={100} y={380} style={{ fill: 'black', baseline: 'middle' }}>
|
|
274
|
-
Middle
|
|
275
|
-
</Text>
|
|
276
|
-
<Line
|
|
277
|
-
startX={50}
|
|
278
|
-
endX={150}
|
|
279
|
-
startY={400}
|
|
280
|
-
endY={400}
|
|
281
|
-
style={{ stroke: '#d5d5d5' }}
|
|
282
|
-
/>
|
|
283
|
-
<Text x={100} y={400} style={{ fill: 'black', baseline: 'top' }}>
|
|
284
|
-
Top
|
|
285
|
-
</Text>
|
|
286
|
-
<Text
|
|
287
|
-
x={10}
|
|
288
|
-
y={450}
|
|
289
|
-
style={{
|
|
290
|
-
fill: 'black',
|
|
291
|
-
fontSize: 20,
|
|
292
|
-
fontFamily: 'serif',
|
|
293
|
-
fontWeight: 'bold',
|
|
294
|
-
fontStyle: 'italic',
|
|
295
|
-
fontVariant: 'small-caps',
|
|
296
|
-
}}
|
|
297
|
-
>
|
|
298
|
-
Styled font
|
|
299
|
-
</Text>
|
|
300
|
-
<Gradients />
|
|
301
|
-
{reactive.isMounted && <Unmounts />}
|
|
302
|
-
</>
|
|
303
|
-
);
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
Page.displayName = 'Page';
|
|
307
|
-
|
|
308
|
-
const App = () => {
|
|
309
|
-
return (
|
|
310
|
-
<Canvas>
|
|
311
|
-
<Page />
|
|
312
|
-
</Canvas>
|
|
313
|
-
);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
render(<App />, document.body);
|
package/demo/tsconfig.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"sourceMap": true,
|
|
5
|
-
"paths": {
|
|
6
|
-
"@blinkorb/rcx": ["../src/index.ts"],
|
|
7
|
-
"@blinkorb/rcx/canvas": ["../src/components/canvas/index.ts"],
|
|
8
|
-
"@blinkorb/rcx/*": ["../src/*"]
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"include": ["./*", "../src/*"]
|
|
12
|
-
}
|