@blinkorb/rcx 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.json +286 -0
  3. package/.gitattributes +2 -0
  4. package/.github/CODEOWNERS +1 -0
  5. package/.github/workflows/ci.yml +19 -0
  6. package/.nvmrc +1 -0
  7. package/.prettierignore +28 -0
  8. package/.prettierrc.json +4 -0
  9. package/demo/index.html +29 -0
  10. package/demo/index.tsx +316 -0
  11. package/demo/tsconfig.json +12 -0
  12. package/jest.config.ts +21 -0
  13. package/package.json +80 -0
  14. package/scripts/prep-package.js +29 -0
  15. package/src/components/canvas/context.ts +6 -0
  16. package/src/components/canvas/index.ts +98 -0
  17. package/src/components/index.ts +5 -0
  18. package/src/components/paths/arc-to.ts +66 -0
  19. package/src/components/paths/clip.ts +32 -0
  20. package/src/components/paths/index.ts +5 -0
  21. package/src/components/paths/line.ts +53 -0
  22. package/src/components/paths/path.ts +59 -0
  23. package/src/components/paths/point.ts +24 -0
  24. package/src/components/shapes/circle.tsx +32 -0
  25. package/src/components/shapes/ellipse.ts +75 -0
  26. package/src/components/shapes/index.ts +3 -0
  27. package/src/components/shapes/rectangle.ts +45 -0
  28. package/src/components/text/index.ts +1 -0
  29. package/src/components/text/text.ts +137 -0
  30. package/src/components/transform/index.ts +3 -0
  31. package/src/components/transform/rotate.ts +26 -0
  32. package/src/components/transform/scale.ts +34 -0
  33. package/src/components/transform/translate.ts +27 -0
  34. package/src/context/create-context.ts +49 -0
  35. package/src/context/index.ts +1 -0
  36. package/src/hooks/index.ts +8 -0
  37. package/src/hooks/use-canvas-context.ts +11 -0
  38. package/src/hooks/use-linear-gradient.ts +39 -0
  39. package/src/hooks/use-loop.ts +11 -0
  40. package/src/hooks/use-on.ts +18 -0
  41. package/src/hooks/use-radial-gradient.ts +45 -0
  42. package/src/hooks/use-render.ts +14 -0
  43. package/src/hooks/use-state.ts +9 -0
  44. package/src/hooks/use-window-size.ts +24 -0
  45. package/src/index.ts +6 -0
  46. package/src/internal/emitter.ts +39 -0
  47. package/src/internal/global.ts +5 -0
  48. package/src/internal/hooks.ts +32 -0
  49. package/src/internal/reactive.test.ts +20 -0
  50. package/src/internal/reactive.ts +20 -0
  51. package/src/jsx-runtime.ts +21 -0
  52. package/src/render.ts +299 -0
  53. package/src/types.ts +151 -0
  54. package/src/utils/apply-fill-and-stroke-style.ts +33 -0
  55. package/src/utils/get-recommended-pixel-ratio.ts +2 -0
  56. package/src/utils/index.ts +8 -0
  57. package/src/utils/is-own-property-of.ts +6 -0
  58. package/src/utils/is-valid-fill-or-stroke-style.ts +5 -0
  59. package/src/utils/is-valid-stroke-cap.ts +10 -0
  60. package/src/utils/is-valid-stroke-join.ts +10 -0
  61. package/src/utils/resolve-styles.ts +21 -0
  62. package/src/utils/type-guards.ts +4 -0
  63. package/src/utils/with-px.ts +4 -0
  64. package/tsb.config.ts +11 -0
  65. package/tsconfig.dist.json +13 -0
  66. package/tsconfig.json +25 -0
package/src/render.ts ADDED
@@ -0,0 +1,299 @@
1
+ import { renderingContext } from './components/canvas/context.ts';
2
+ import { emitter } from './internal/emitter.ts';
3
+ import { cxGlobal } from './internal/global.ts';
4
+ import type {
5
+ AnyObject,
6
+ NestedArray,
7
+ RCXChild,
8
+ RCXChildren,
9
+ RCXElementAny,
10
+ RCXNodeAny,
11
+ RCXRenderingContext,
12
+ } from './types.ts';
13
+ import { isArray } from './utils/type-guards.ts';
14
+
15
+ const getCanvasElement = (container: HTMLElement) => {
16
+ if (container instanceof HTMLCanvasElement) {
17
+ return container;
18
+ }
19
+
20
+ const canvasElement = document.createElement('canvas');
21
+ container.appendChild(canvasElement);
22
+
23
+ return canvasElement;
24
+ };
25
+
26
+ const unmountNodes = (
27
+ children: NestedArray<RCXNodeAny> | RCXNodeAny | undefined
28
+ ) => {
29
+ if (!!children && typeof children === 'object') {
30
+ if (isArray(children)) {
31
+ children.forEach((child) => unmountNodes(child));
32
+ } else {
33
+ children.hooks.forEach((hook) => {
34
+ if (hook.type === 'useOnMount') {
35
+ hook.value.onUnmount?.();
36
+ }
37
+
38
+ if (hook.type === 'useOnUnmount') {
39
+ hook.value();
40
+ }
41
+ });
42
+
43
+ unmountNodes(children.childNodes);
44
+ }
45
+ }
46
+ };
47
+
48
+ const updateNode = (
49
+ element: RCXElementAny,
50
+ prevNode: RCXNodeAny | undefined
51
+ ): RCXNodeAny => {
52
+ if (element.type === prevNode?.element.type) {
53
+ const nextPropsCopy = { ...element.props };
54
+
55
+ // Delete previous props
56
+ Object.keys(prevNode.element.props).forEach((key) => {
57
+ delete prevNode.element.props[key];
58
+ });
59
+
60
+ // Copy in new props
61
+ Object.entries(nextPropsCopy).forEach(([key, value]) => {
62
+ prevNode.element.props[key] = value;
63
+ });
64
+
65
+ return prevNode;
66
+ }
67
+
68
+ unmountNodes(prevNode);
69
+
70
+ return {
71
+ element,
72
+ hooks: [],
73
+ rendered: [],
74
+ childNodes: [],
75
+ context: {},
76
+ };
77
+ };
78
+
79
+ const getMatchingChildPrev = (
80
+ nextChild: RCXChildren,
81
+ nextChildIndex: number,
82
+ stillRendered: NestedArray<RCXNodeAny> | undefined
83
+ ) => {
84
+ if (!!nextChild && typeof nextChild === 'object' && !isArray(nextChild)) {
85
+ if (isArray(stillRendered)) {
86
+ if (typeof nextChild.props.$key !== 'undefined') {
87
+ return stillRendered.find(
88
+ (prev) =>
89
+ !!prev &&
90
+ typeof prev === 'object' &&
91
+ !isArray(prev) &&
92
+ prev.element.type === nextChild.type &&
93
+ prev.element.props.$key === nextChild.props.$key
94
+ );
95
+ }
96
+
97
+ const atIndex = stillRendered[nextChildIndex];
98
+
99
+ if (
100
+ !!atIndex &&
101
+ typeof atIndex === 'object' &&
102
+ !isArray(atIndex) &&
103
+ atIndex.element.type === nextChild.type &&
104
+ typeof atIndex.element.props.$key === 'undefined'
105
+ ) {
106
+ return atIndex;
107
+ }
108
+ }
109
+ }
110
+ };
111
+
112
+ const getMatchingChildNext = (
113
+ prevChild: NestedArray<RCXNodeAny>,
114
+ prevChildIndex: number,
115
+ nextRendered: NestedArray<RCXChild>
116
+ ) => {
117
+ if (!!prevChild && typeof prevChild === 'object' && !isArray(prevChild)) {
118
+ if (isArray(nextRendered)) {
119
+ if (typeof prevChild.element.props.$key !== 'undefined') {
120
+ return nextRendered.find(
121
+ (next) =>
122
+ !!next &&
123
+ typeof next === 'object' &&
124
+ !isArray(next) &&
125
+ next.type === prevChild.element.type &&
126
+ next.props.$key === prevChild.element.props.$key
127
+ );
128
+ }
129
+
130
+ const atIndex = nextRendered[prevChildIndex];
131
+
132
+ if (
133
+ !!atIndex &&
134
+ typeof atIndex === 'object' &&
135
+ !isArray(atIndex) &&
136
+ atIndex.type === prevChild.element.type &&
137
+ typeof atIndex.props.$key === 'undefined'
138
+ ) {
139
+ return atIndex;
140
+ }
141
+ }
142
+ }
143
+ };
144
+
145
+ const renderElement = (
146
+ element: RCXElementAny,
147
+ renderingContextState: RCXRenderingContext,
148
+ prevNode: RCXNodeAny | undefined,
149
+ parentContext?: AnyObject
150
+ ): RCXNodeAny => {
151
+ const node = updateNode(element, prevNode);
152
+
153
+ node.context = {
154
+ ...parentContext,
155
+ };
156
+
157
+ cxGlobal.currentNode = node;
158
+ cxGlobal.hookIndex = 0;
159
+
160
+ renderingContext.useProvide(renderingContextState);
161
+
162
+ node.rendered = element.type(element.props);
163
+
164
+ delete cxGlobal.currentNode;
165
+
166
+ const traverse = (
167
+ nextRendered: RCXChildren,
168
+ prevRendered: NestedArray<RCXNodeAny> | undefined
169
+ ): NestedArray<RCXNodeAny> => {
170
+ if (!!nextRendered && typeof nextRendered === 'object') {
171
+ if (isArray(nextRendered)) {
172
+ let stillRendered: NestedArray<RCXNodeAny> | undefined;
173
+
174
+ if (!isArray(prevRendered)) {
175
+ unmountNodes(prevRendered);
176
+ } else {
177
+ stillRendered = prevRendered.filter((prevChild, prevChildIndex) => {
178
+ const match = getMatchingChildNext(
179
+ prevChild,
180
+ prevChildIndex,
181
+ nextRendered
182
+ );
183
+
184
+ if (!match) {
185
+ unmountNodes(prevChild);
186
+ }
187
+
188
+ return !!match;
189
+ });
190
+ }
191
+
192
+ return nextRendered.map((nextChild, nextChildIndex) =>
193
+ traverse(
194
+ nextChild,
195
+ getMatchingChildPrev(nextChild, nextChildIndex, stillRendered)
196
+ )
197
+ );
198
+ }
199
+
200
+ if (!!prevRendered && typeof prevRendered === 'object') {
201
+ if (isArray(prevRendered)) {
202
+ unmountNodes(prevRendered);
203
+ } else if (prevRendered.element.type !== nextRendered.type) {
204
+ unmountNodes(prevRendered);
205
+ }
206
+ }
207
+
208
+ return renderElement(
209
+ nextRendered,
210
+ renderingContextState,
211
+ !!prevRendered &&
212
+ typeof prevRendered === 'object' &&
213
+ !isArray(prevRendered)
214
+ ? prevRendered
215
+ : undefined,
216
+ node.context
217
+ );
218
+ }
219
+
220
+ unmountNodes(prevRendered);
221
+
222
+ return [];
223
+ };
224
+
225
+ node.hooks.forEach((hook) => {
226
+ if (hook.type === 'useOnMount' && element.type !== prevNode?.element.type) {
227
+ hook.value.onMount();
228
+ }
229
+ });
230
+
231
+ node.hooks.forEach((hook) => {
232
+ if (hook.type === 'useRenderBeforeChildren') {
233
+ hook.value(renderingContextState);
234
+ }
235
+ });
236
+
237
+ node.childNodes = traverse(node.rendered, prevNode?.childNodes);
238
+
239
+ node.hooks.forEach((hook) => {
240
+ if (hook.type === 'useRenderAfterChildren') {
241
+ hook.value(renderingContextState);
242
+ }
243
+ });
244
+
245
+ return node;
246
+ };
247
+
248
+ export const render = (element: RCXElementAny, container: HTMLElement) => {
249
+ const canvas = getCanvasElement(container);
250
+ const ctx2d = canvas.getContext('2d');
251
+
252
+ if (!ctx2d) {
253
+ const errorMessage = 'CanvasRenderingContext2D not supported';
254
+
255
+ if (window.console && typeof window.console.error === 'function') {
256
+ // eslint-disable-next-line no-console
257
+ console.error(errorMessage);
258
+ }
259
+
260
+ return {
261
+ error: errorMessage,
262
+ };
263
+ }
264
+
265
+ const renderingContextState = { canvas, ctx2d };
266
+
267
+ let raf: number | undefined;
268
+ let rootNode: RCXNodeAny | undefined;
269
+
270
+ const renderRoot = () => {
271
+ if (typeof raf === 'number') {
272
+ window.cancelAnimationFrame(raf);
273
+ }
274
+
275
+ raf = window.requestAnimationFrame(() => {
276
+ // eslint-disable-next-line no-self-assign
277
+ canvas.width = canvas.width;
278
+ rootNode = renderElement(element, renderingContextState, rootNode);
279
+ });
280
+ };
281
+
282
+ renderRoot();
283
+
284
+ emitter.on('render', renderRoot);
285
+
286
+ const unmount = () => {
287
+ if (typeof raf === 'number') {
288
+ window.cancelAnimationFrame(raf);
289
+ }
290
+ // eslint-disable-next-line no-self-assign
291
+ canvas.width = canvas.width;
292
+
293
+ if (!(container instanceof HTMLCanvasElement)) {
294
+ container.removeChild(canvas);
295
+ }
296
+ };
297
+
298
+ return unmount;
299
+ };
package/src/types.ts ADDED
@@ -0,0 +1,151 @@
1
+ import type { CanvasProps } from './components/canvas/index.ts';
2
+
3
+ declare global {
4
+ // eslint-disable-next-line @typescript-eslint/no-namespace
5
+ namespace JSX {
6
+ export interface IntrinsicAttributes {
7
+ $key?: string | number;
8
+ }
9
+ }
10
+ }
11
+
12
+ export type Primitive = string | number | boolean | null | undefined;
13
+
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ export type AnyObject = Record<PropertyKey, any>;
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ export type AnyArray = readonly any[];
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ export type AnyFunction = (...args: any[]) => any;
20
+
21
+ export type NestedArray<T> = T | readonly NestedArray<T>[];
22
+
23
+ export interface RCXElement<C extends RCXComponent<P>, P extends AnyObject> {
24
+ type: C;
25
+ props: P;
26
+ }
27
+
28
+ export type RCXElementAny = RCXElement<RCXComponentAny, AnyObject>;
29
+
30
+ export type RCXChild = RCXElementAny | Primitive;
31
+
32
+ export type RCXChildren = NestedArray<RCXChild>;
33
+
34
+ export interface RCXOnMountHook {
35
+ onMount: () => void;
36
+ onUnmount?: () => void;
37
+ }
38
+
39
+ export interface RCXHookMap {
40
+ useReactive: AnyObject;
41
+ useUnreactive: AnyObject;
42
+ useRenderBeforeChildren: (renderingContext: RCXRenderingContext) => void;
43
+ useRenderAfterChildren: (renderingContext: RCXRenderingContext) => void;
44
+ useOnMount: RCXOnMountHook;
45
+ useOnUnmount: () => void;
46
+ }
47
+
48
+ export type RCXHook = {
49
+ [K in keyof RCXHookMap]: {
50
+ type: K;
51
+ value: RCXHookMap[K];
52
+ };
53
+ }[keyof RCXHookMap];
54
+
55
+ export interface RCXNode<C extends RCXComponent<P>, P extends AnyObject> {
56
+ element: RCXElement<C, P>;
57
+ rendered: RCXChildren;
58
+ hooks: RCXHook[];
59
+ childNodes: NestedArray<RCXNodeAny>;
60
+ context: AnyObject;
61
+ }
62
+
63
+ export type RCXNodeAny = RCXNode<RCXComponentAny, AnyObject>;
64
+
65
+ export interface RCXRenderingContext {
66
+ readonly canvas: HTMLCanvasElement;
67
+ readonly ctx2d: CanvasRenderingContext2D;
68
+ }
69
+
70
+ export interface RCXComponentInterface {
71
+ displayName?: string;
72
+ }
73
+
74
+ export type RCXComponent<P extends AnyObject = Record<PropertyKey, never>> = ((
75
+ props: Readonly<P>
76
+ ) => RCXChildren) &
77
+ RCXComponentInterface;
78
+
79
+ export type RCXComponentAny = RCXComponent<AnyObject>;
80
+
81
+ export type RCXPropsWithChildren<P extends AnyObject> = Omit<P, 'children'> & {
82
+ children?: RCXChildren;
83
+ };
84
+
85
+ export interface RCXCanvasContext {
86
+ readonly props: CanvasProps;
87
+ readonly width: number;
88
+ readonly height: number;
89
+ readonly pixelRatio: number;
90
+ readonly actualWidth: number;
91
+ readonly actualHeight: number;
92
+ readonly canvas: Omit<HTMLCanvasElement, 'width' | 'height'>;
93
+ readonly ctx2d: CanvasRenderingContext2D;
94
+ }
95
+
96
+ export interface RCXGlobal {
97
+ currentNode?: RCXNodeAny;
98
+ hookIndex: number;
99
+ }
100
+
101
+ export interface RCXFragmentProps {
102
+ children?: RCXChildren;
103
+ }
104
+
105
+ export type RCXPoint = [number, number] | { x: number; y: number };
106
+
107
+ export type RCXStyleProp<T extends AnyObject> = NestedArray<
108
+ false | null | undefined | T
109
+ >;
110
+
111
+ export interface RCXLineStyle {
112
+ stroke?: RCXFillOrStrokeStyle;
113
+ strokeWidth?: number;
114
+ strokeCap?: CanvasLineCap;
115
+ strokeJoin?: CanvasLineJoin;
116
+ }
117
+
118
+ export interface RCXShapeStyle extends RCXLineStyle {
119
+ fill?: RCXFillOrStrokeStyle;
120
+ }
121
+
122
+ export interface RCXFontStringStyle {
123
+ // font string
124
+ fontStyle?: RCXCanvasFontStyle;
125
+ fontWeight?: RCXCanvasFontWeight;
126
+ fontSize?: number;
127
+ fontFamily?: string;
128
+ }
129
+
130
+ export interface RCXFontStyle extends RCXFontStringStyle {
131
+ // other ctx2d properties
132
+ fontStretch?: CanvasFontStretch;
133
+ fontVariant?: RCXCanvasFontVariant;
134
+ fontKerning?: CanvasFontKerning;
135
+ }
136
+
137
+ export type RCXCanvasFontStyle = 'normal' | 'italic' | 'oblique';
138
+ export type RCXCanvasFontWeight =
139
+ | 'normal'
140
+ | 'bold'
141
+ | 'bolder'
142
+ | 'lighter'
143
+ | number;
144
+ export type RCXCanvasFontVariant = 'normal' | CanvasFontVariantCaps;
145
+
146
+ export interface RCXColorStop {
147
+ offset: number;
148
+ color: string;
149
+ }
150
+
151
+ export type RCXFillOrStrokeStyle = string | CanvasGradient;
@@ -0,0 +1,33 @@
1
+ import type { AnyObject, RCXRenderingContext } from '../types.ts';
2
+ import { isValidFillOrStrokeStyle } from './is-valid-fill-or-stroke-style.ts';
3
+ import { isValidStrokeCap } from './is-valid-stroke-cap.ts';
4
+ import { isValidStrokeJoin } from './is-valid-stroke-join.ts';
5
+
6
+ export const applyFillAndStrokeStyles = (
7
+ renderingContext: RCXRenderingContext,
8
+ style: Partial<AnyObject>
9
+ ) => {
10
+ const { fill, stroke, strokeWidth, strokeCap, strokeJoin } = style;
11
+
12
+ if (isValidFillOrStrokeStyle(fill)) {
13
+ renderingContext.ctx2d.fillStyle = fill;
14
+ renderingContext.ctx2d.fill();
15
+ }
16
+
17
+ if (typeof strokeWidth === 'number') {
18
+ renderingContext.ctx2d.lineWidth = strokeWidth;
19
+ }
20
+
21
+ if (isValidStrokeCap(strokeCap)) {
22
+ renderingContext.ctx2d.lineCap = strokeCap;
23
+ }
24
+
25
+ if (isValidStrokeJoin(strokeJoin)) {
26
+ renderingContext.ctx2d.lineJoin = strokeJoin;
27
+ }
28
+
29
+ if (isValidFillOrStrokeStyle(stroke)) {
30
+ renderingContext.ctx2d.strokeStyle = stroke;
31
+ renderingContext.ctx2d.stroke();
32
+ }
33
+ };
@@ -0,0 +1,2 @@
1
+ export const getRecommendedPixelRatio = () =>
2
+ window.devicePixelRatio >= 2 ? 2 : 1;
@@ -0,0 +1,8 @@
1
+ export * from './apply-fill-and-stroke-style.ts';
2
+ export * from './get-recommended-pixel-ratio.ts';
3
+ export * from './is-own-property-of.ts';
4
+ export * from './is-valid-stroke-cap.ts';
5
+ export * from './is-valid-stroke-join.ts';
6
+ export * from './resolve-styles.ts';
7
+ export * from './type-guards.ts';
8
+ export * from './is-valid-fill-or-stroke-style.ts';
@@ -0,0 +1,6 @@
1
+ import { AnyObject } from '../types.ts';
2
+
3
+ export const isOwnPropertyOf = <T extends AnyObject>(
4
+ obj: T,
5
+ key: PropertyKey
6
+ ): key is keyof T => Object.prototype.hasOwnProperty.call(obj, key);
@@ -0,0 +1,5 @@
1
+ export const isValidFillOrStrokeStyle = (
2
+ fillOrStrokeStyle: unknown
3
+ ): fillOrStrokeStyle is string | CanvasGradient =>
4
+ typeof fillOrStrokeStyle === 'string' ||
5
+ fillOrStrokeStyle instanceof CanvasGradient;
@@ -0,0 +1,10 @@
1
+ import { isOwnPropertyOf } from './is-own-property-of.ts';
2
+
3
+ const STROKE_CAPS = {
4
+ butt: true,
5
+ round: true,
6
+ square: true,
7
+ } satisfies Record<CanvasLineCap, true>;
8
+
9
+ export const isValidStrokeCap = (value: unknown): value is CanvasLineCap =>
10
+ typeof value === 'string' && isOwnPropertyOf(STROKE_CAPS, value as string);
@@ -0,0 +1,10 @@
1
+ import { isOwnPropertyOf } from './is-own-property-of.ts';
2
+
3
+ const STROKE_JOINS = {
4
+ bevel: true,
5
+ round: true,
6
+ miter: true,
7
+ } satisfies Record<CanvasLineJoin, true>;
8
+
9
+ export const isValidStrokeJoin = (value: unknown): value is CanvasLineJoin =>
10
+ typeof value === 'string' && isOwnPropertyOf(STROKE_JOINS, value as string);
@@ -0,0 +1,21 @@
1
+ import type { AnyObject, NestedArray } from '../types.ts';
2
+ import { isArray } from './type-guards.ts';
3
+
4
+ export const resolveStyles = <S extends AnyObject>(
5
+ styles: NestedArray<false | null | undefined | S>
6
+ ): Partial<S> => {
7
+ if (typeof styles === 'object' && !!styles) {
8
+ if (isArray(styles)) {
9
+ return styles.reduce((acc, style) => {
10
+ return {
11
+ ...acc,
12
+ ...resolveStyles(style),
13
+ };
14
+ }, {});
15
+ }
16
+
17
+ return styles;
18
+ }
19
+
20
+ return {};
21
+ };
@@ -0,0 +1,4 @@
1
+ import type { AnyArray } from '../types.ts';
2
+
3
+ export const isArray = <T>(input: T): input is Extract<T, AnyArray> =>
4
+ Array.isArray(input);
@@ -0,0 +1,4 @@
1
+ export const withPx = <T extends string | number>(value: T) =>
2
+ (typeof value === 'number' ? `${value}px` : value) as T extends number
3
+ ? `${T}px`
4
+ : T;
package/tsb.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { Config } from '@jakesidsmith/tsb';
2
+
3
+ const config: Config = {
4
+ indexHTMLPath: 'demo/index.html',
5
+ main: 'demo/index.tsx',
6
+ outDir: 'build',
7
+ tsconfigPath: 'demo/tsconfig.json',
8
+ host: 'localhost',
9
+ };
10
+
11
+ export default config;
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "declaration": true,
6
+ "sourceMap": true,
7
+ "inlineSources": true,
8
+ "outDir": "./dist",
9
+ "rootDir": "./src"
10
+ },
11
+ "include": ["src/*"],
12
+ "exclude": ["**/*.test.*", "**/*.spec.*"]
13
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "noErrorTruncation": true,
5
+ "noFallthroughCasesInSwitch": true,
6
+ "noImplicitAny": true,
7
+ "noImplicitThis": true,
8
+ "noUncheckedIndexedAccess": true,
9
+ "noUnusedLocals": true,
10
+ "noUnusedParameters": true,
11
+ "esModuleInterop": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "skipLibCheck": true,
17
+ "allowImportingTsExtensions": true,
18
+ "target": "ESNext",
19
+ "module": "Preserve",
20
+ "moduleResolution": "Bundler",
21
+ "jsx": "react-jsx",
22
+ "jsxImportSource": "@blinkorb/rcx"
23
+ },
24
+ "include": ["demo/*", "src/*", "jest.config.ts"]
25
+ }