@forge/react 1.1.0-next.0 → 1.1.0-next.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/CHANGELOG.md +6 -0
- package/out/__test__/styles.test.d.ts +2 -0
- package/out/__test__/styles.test.d.ts.map +1 -0
- package/out/__test__/styles.test.js +88 -0
- package/out/components.d.ts +44 -0
- package/out/components.d.ts.map +1 -0
- package/out/components.js +45 -0
- package/{src/index.ts → out/index.d.ts} +2 -1
- package/out/index.d.ts.map +1 -0
- package/out/index.js +7 -0
- package/out/reconciler.d.ts +5 -0
- package/out/reconciler.d.ts.map +1 -0
- package/out/reconciler.js +143 -0
- package/out/styles/index.d.ts +28 -0
- package/out/styles/index.d.ts.map +1 -0
- package/out/styles/index.js +152 -0
- package/out/types/components.d.ts +369 -0
- package/out/types/components.d.ts.map +1 -0
- package/out/types/components.js +2 -0
- package/out/types/effect.d.ts +57 -0
- package/out/types/effect.d.ts.map +1 -0
- package/out/types/effect.js +19 -0
- package/out/types/extension.d.ts +10 -0
- package/out/types/extension.d.ts.map +1 -0
- package/out/types/extension.js +2 -0
- package/out/types/forge.d.ts +146 -0
- package/out/types/forge.d.ts.map +1 -0
- package/out/types/forge.js +21 -0
- package/out/types/icons.d.ts +2 -0
- package/out/types/icons.d.ts.map +1 -0
- package/out/types/icons.js +2 -0
- package/out/types/index.d.ts +11 -0
- package/out/types/index.d.ts.map +1 -0
- package/out/types/index.js +27 -0
- package/out/types/legacy-effect.d.ts +40 -0
- package/out/types/legacy-effect.d.ts.map +1 -0
- package/out/types/legacy-effect.js +21 -0
- package/out/types/styles.d.ts +134 -0
- package/out/types/styles.d.ts.map +1 -0
- package/out/types/styles.js +2 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1078 -0
- package/build/bundle-types.sh +0 -21
- package/src/__test__/styles.test.tsx +0 -112
- package/src/globals.d.ts +0 -12
- package/src/reconciler.ts +0 -219
- package/src/styles/index.ts +0 -174
- package/tsconfig.json +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.test.d.ts","sourceRoot":"","sources":["../../src/__test__/styles.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const styles_1 = require("../styles");
|
|
4
|
+
describe('StyleSheet', () => {
|
|
5
|
+
it('should create valid basic styles object', () => {
|
|
6
|
+
expect(styles_1.StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
backgroundColor: '#fff',
|
|
9
|
+
backgroundImage: [
|
|
10
|
+
styles_1.url('/image.png'),
|
|
11
|
+
styles_1.linearGradient('90deg', styles_1.gradientStep('10%', 'red'), styles_1.gradientStep('30%', 'blue'))
|
|
12
|
+
],
|
|
13
|
+
backgroundSize: ['cover', ['50%', '50%']]
|
|
14
|
+
}
|
|
15
|
+
})).toEqual({
|
|
16
|
+
container: {
|
|
17
|
+
backgroundColor: '#fff',
|
|
18
|
+
backgroundImage: [
|
|
19
|
+
{ method: 'url', value: { path: '/image.png' } },
|
|
20
|
+
{
|
|
21
|
+
method: 'gradient',
|
|
22
|
+
value: {
|
|
23
|
+
colors: [
|
|
24
|
+
{ percent: '10%', value: 'red' },
|
|
25
|
+
{ percent: '30%', value: 'blue' }
|
|
26
|
+
],
|
|
27
|
+
degrees: '90deg',
|
|
28
|
+
type: 'linear'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
backgroundSize: ['cover', ['50%', '50%']]
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
it('should create valid composed styles object', () => {
|
|
37
|
+
expect(styles_1.StyleSheet.create({
|
|
38
|
+
container: (compose) => compose({
|
|
39
|
+
backgroundColor: 'red',
|
|
40
|
+
backgroundImage: styles_1.url('https://example.test/image.png'),
|
|
41
|
+
backgroundPosition: ['50px', '50px', '50px', '50px'],
|
|
42
|
+
transform: [
|
|
43
|
+
styles_1.translate('10px', '10px', '10px'),
|
|
44
|
+
styles_1.scale('2', '2', '2'),
|
|
45
|
+
styles_1.rotate('45deg', '45deg', '45deg'),
|
|
46
|
+
styles_1.skew('45deg', '45deg')
|
|
47
|
+
]
|
|
48
|
+
}, styles_1.active({
|
|
49
|
+
backgroundColor: styles_1.rgba(0, 0, 255, 1),
|
|
50
|
+
backgroundImage: styles_1.radialGradient(styles_1.gradientStep('10%', 'red'), styles_1.gradientStep('30%', 'blue')),
|
|
51
|
+
backgroundPosition: ['50px', '50px']
|
|
52
|
+
}), styles_1.hover({
|
|
53
|
+
backgroundPosition: 'center',
|
|
54
|
+
backgroundRepeat: 'no-repeat'
|
|
55
|
+
}), styles_1.focus({
|
|
56
|
+
backgroundRepeat: ['repeat', 'repeat']
|
|
57
|
+
}))
|
|
58
|
+
})).toEqual({
|
|
59
|
+
container: {
|
|
60
|
+
__active: {
|
|
61
|
+
backgroundColor: { method: 'rgba', value: { a: 1, b: 255, g: 0, r: 0 } },
|
|
62
|
+
backgroundImage: {
|
|
63
|
+
method: 'gradient',
|
|
64
|
+
value: {
|
|
65
|
+
colors: [
|
|
66
|
+
{ percent: '10%', value: 'red' },
|
|
67
|
+
{ percent: '30%', value: 'blue' }
|
|
68
|
+
],
|
|
69
|
+
type: 'radial'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
backgroundPosition: ['50px', '50px']
|
|
73
|
+
},
|
|
74
|
+
__focus: { backgroundRepeat: ['repeat', 'repeat'] },
|
|
75
|
+
__hover: { backgroundPosition: 'center', backgroundRepeat: 'no-repeat' },
|
|
76
|
+
backgroundColor: 'red',
|
|
77
|
+
backgroundImage: { method: 'url', value: { path: 'https://example.test/image.png' } },
|
|
78
|
+
backgroundPosition: ['50px', '50px', '50px', '50px'],
|
|
79
|
+
transform: [
|
|
80
|
+
{ method: 'translate', value: { x: '10px', y: '10px', z: '10px' } },
|
|
81
|
+
{ method: 'scale', value: { x: '2', y: '2', z: '2' } },
|
|
82
|
+
{ method: 'rotate', value: { x: '45deg', y: '45deg', z: '45deg' } },
|
|
83
|
+
{ method: 'skew', value: { x: '45deg', y: '45deg' } }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BadgeProps, ButtonSetProps, CellProps, CodeProps, DateLozengeProps, ForgeElement, FormProps, FrameProps, HeadProps, HeadingProps, InlineDialogProps, MarkupProps, ModalDialogProps, NativeBoxProps as BoxProps, NativeButtonProps as ButtonProps, NativeCheckboxGroupProps as CheckboxGroupProps, NativeCheckboxProps as CheckboxProps, NativeDatePickerProps as DatePickerProps, NativeImageProps as ImageProps, NativeLinkProps as LinkProps, NativeRadioGroupProps as RadioGroupProps, NativeRangeProps as RangeProps, NativeSelectProps as SelectProps, NativeTextAreaProps as TextAreaProps, NativeTextFieldProps as TextFieldProps, NativeTextProps as TextProps, NativeToggleProps as ToggleProps, NativeUserPickerProps as UserPickerProps, OptionProps, RadioProps, RowProps, SectionMessageProps, StatusLozengeProps, TabProps, TableProps, TabsProps, TagGroupProps, TagProps, TooltipProps, UserGroupProps, UserProps } from './types';
|
|
2
|
+
export declare const Box: (props: BoxProps) => ForgeElement;
|
|
3
|
+
export declare const Button: (props: ButtonProps) => ForgeElement;
|
|
4
|
+
export declare const Checkbox: (props: CheckboxProps) => ForgeElement;
|
|
5
|
+
export declare const CheckboxGroup: (props: CheckboxGroupProps) => ForgeElement;
|
|
6
|
+
export declare const DatePicker: (props: DatePickerProps) => ForgeElement;
|
|
7
|
+
export declare const Form: <T extends Record<string, any>>(props: FormProps<T>) => ForgeElement;
|
|
8
|
+
export declare const Frame: (props: FrameProps) => ForgeElement;
|
|
9
|
+
export declare const Image: (props: ImageProps) => ForgeElement;
|
|
10
|
+
export declare const Link: (props: LinkProps) => ForgeElement;
|
|
11
|
+
export declare const ModalDialog: (props: ModalDialogProps) => ForgeElement;
|
|
12
|
+
export declare const RadioGroup: (props: RadioGroupProps) => ForgeElement;
|
|
13
|
+
export declare const Range: (props: RangeProps) => ForgeElement;
|
|
14
|
+
export declare const Select: (props: SelectProps) => ForgeElement;
|
|
15
|
+
export declare const Text: (props: TextProps) => ForgeElement;
|
|
16
|
+
export declare const TextArea: (props: TextAreaProps) => ForgeElement;
|
|
17
|
+
export declare const TextField: (props: TextFieldProps) => ForgeElement;
|
|
18
|
+
export declare const Toggle: (props: ToggleProps) => ForgeElement;
|
|
19
|
+
export declare const UserPicker: (props: UserPickerProps) => ForgeElement;
|
|
20
|
+
export declare const Badge: (props: BadgeProps) => ForgeElement;
|
|
21
|
+
export declare const ButtonSet: (props: ButtonSetProps) => ForgeElement;
|
|
22
|
+
export declare const Code: (props: CodeProps) => ForgeElement;
|
|
23
|
+
export declare const DateLozenge: (props: DateLozengeProps) => ForgeElement;
|
|
24
|
+
export declare const Heading: (props: HeadingProps) => ForgeElement;
|
|
25
|
+
export declare const InlineDialog: (props: InlineDialogProps) => ForgeElement;
|
|
26
|
+
export declare const Option: (props: OptionProps) => ForgeElement;
|
|
27
|
+
export declare const Radio: (props: RadioProps) => ForgeElement;
|
|
28
|
+
export declare const SectionMessage: (props: SectionMessageProps) => ForgeElement;
|
|
29
|
+
export declare const StatusLozenge: (props: StatusLozengeProps) => ForgeElement;
|
|
30
|
+
export declare const Tooltip: (props: TooltipProps) => ForgeElement;
|
|
31
|
+
export declare const Em: (props: MarkupProps) => ForgeElement;
|
|
32
|
+
export declare const Strike: (props: MarkupProps) => ForgeElement;
|
|
33
|
+
export declare const Strong: (props: MarkupProps) => ForgeElement;
|
|
34
|
+
export declare const Tab: (props: TabProps) => ForgeElement;
|
|
35
|
+
export declare const Tabs: (props: TabsProps) => ForgeElement;
|
|
36
|
+
export declare const Cell: (props: CellProps) => ForgeElement;
|
|
37
|
+
export declare const Head: (props: HeadProps) => ForgeElement;
|
|
38
|
+
export declare const Row: (props: RowProps) => ForgeElement;
|
|
39
|
+
export declare const Table: (props: TableProps) => ForgeElement;
|
|
40
|
+
export declare const Tag: (props: TagProps) => ForgeElement;
|
|
41
|
+
export declare const TagGroup: (props: TagGroupProps) => ForgeElement;
|
|
42
|
+
export declare const User: (props: UserProps) => ForgeElement;
|
|
43
|
+
export declare const UserGroup: (props: UserGroupProps) => ForgeElement;
|
|
44
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,EAEZ,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,cAAc,IAAI,QAAQ,EAC1B,iBAAiB,IAAI,WAAW,EAChC,wBAAwB,IAAI,kBAAkB,EAC9C,mBAAmB,IAAI,aAAa,EACpC,qBAAqB,IAAI,eAAe,EACxC,gBAAgB,IAAI,UAAU,EAC9B,eAAe,IAAI,SAAS,EAC5B,qBAAqB,IAAI,eAAe,EACxC,gBAAgB,IAAI,UAAU,EAC9B,iBAAiB,IAAI,WAAW,EAChC,mBAAmB,IAAI,aAAa,EACpC,oBAAoB,IAAI,cAAc,EACtC,eAAe,IAAI,SAAS,EAC5B,iBAAiB,IAAI,WAAW,EAChC,qBAAqB,IAAI,eAAe,EACxC,WAAW,EACX,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,GAAG,UAAiC,QAAQ,KAAK,YAAY,CAAC;AAC3E,eAAO,MAAM,MAAM,UAAoC,WAAW,KAAK,Y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,CAAC;AACtG,eAAO,MAAM,MAAM,UAAoC,WAAW,KAAK,YAAY,CAAC;AACpF,eAAO,MAAM,KAAK,UAAmC,UAAU,KAAK,YAAY,CAAC;AACjF,eAAO,MAAM,cAAc,UAA4C,mBAAmB,KAAK,YAAY,CAAC;AAC5G,eAAO,MAAM,aAAa,UAA2C,kBAAkB,KAAK,YAAY,CAAC;AACzG,eAAO,MAAM,OAAO,UAAqC,YAAY,KAAK,YAAY,CAAC;AAEvF,eAAO,MAAM,EAAE,UAAgC,WAAW,KAAK,YAAY,CAAC;AAC5E,eAAO,MAAM,MAAM,UAAoC,WAAW,KAAK,YAAY,CAAC;AACpF,eAAO,MAAM,MAAM,UAAoC,WAAW,KAAK,YAAY,CAAC;AAEpF,eAAO,MAAM,GAAG,UAAiC,QAAQ,KAAK,YAAY,CAAC;AAC3E,eAAO,MAAM,IAAI,UAAkC,SAAS,KAAK,YAAY,CAAC;AAE9E,eAAO,MAAM,IAAI,UAAkC,SAAS,KAAK,YAAY,CAAC;AAC9E,eAAO,MAAM,IAAI,UAAkC,SAAS,KAAK,YAAY,CAAC;AAC9E,eAAO,MAAM,GAAG,UAAiC,QAAQ,KAAK,YAAY,CAAC;AAC3E,eAAO,MAAM,KAAK,UAAmC,UAAU,KAAK,YAAY,CAAC;AAEjF,eAAO,MAAM,GAAG,UAAiC,QAAQ,KAAK,YAAY,CAAC;AAC3E,eAAO,MAAM,QAAQ,UAAsC,aAAa,KAAK,YAAY,CAAC;AAE1F,eAAO,MAAM,IAAI,UAAkC,SAAS,KAAK,YAAY,CAAC;AAC9E,eAAO,MAAM,SAAS,UAAuC,cAAc,KAAK,YAAY,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserGroup = exports.User = exports.TagGroup = exports.Tag = exports.Table = exports.Row = exports.Head = exports.Cell = exports.Tabs = exports.Tab = exports.Strong = exports.Strike = exports.Em = exports.Tooltip = exports.StatusLozenge = exports.SectionMessage = exports.Radio = exports.Option = exports.InlineDialog = exports.Heading = exports.DateLozenge = exports.Code = exports.ButtonSet = exports.Badge = exports.UserPicker = exports.Toggle = exports.TextField = exports.TextArea = exports.Text = exports.Select = exports.Range = exports.RadioGroup = exports.ModalDialog = exports.Link = exports.Image = exports.Frame = exports.Form = exports.DatePicker = exports.CheckboxGroup = exports.Checkbox = exports.Button = exports.Box = void 0;
|
|
4
|
+
exports.Box = 'Box';
|
|
5
|
+
exports.Button = 'Button';
|
|
6
|
+
exports.Checkbox = 'Checkbox';
|
|
7
|
+
exports.CheckboxGroup = 'CheckboxGroup';
|
|
8
|
+
exports.DatePicker = 'DatePicker';
|
|
9
|
+
exports.Form = 'Form';
|
|
10
|
+
exports.Frame = 'Frame';
|
|
11
|
+
exports.Image = 'Image';
|
|
12
|
+
exports.Link = 'Link';
|
|
13
|
+
exports.ModalDialog = 'ModalDialog';
|
|
14
|
+
exports.RadioGroup = 'RadioGroup';
|
|
15
|
+
exports.Range = 'Range';
|
|
16
|
+
exports.Select = 'Select';
|
|
17
|
+
exports.Text = 'Text';
|
|
18
|
+
exports.TextArea = 'TextArea';
|
|
19
|
+
exports.TextField = 'TextField';
|
|
20
|
+
exports.Toggle = 'Toggle';
|
|
21
|
+
exports.UserPicker = 'UserPicker';
|
|
22
|
+
exports.Badge = 'Badge';
|
|
23
|
+
exports.ButtonSet = 'ButtonSet';
|
|
24
|
+
exports.Code = 'Code';
|
|
25
|
+
exports.DateLozenge = 'DateLozenge';
|
|
26
|
+
exports.Heading = 'Heading';
|
|
27
|
+
exports.InlineDialog = 'InlineDialog';
|
|
28
|
+
exports.Option = 'Option';
|
|
29
|
+
exports.Radio = 'Radio';
|
|
30
|
+
exports.SectionMessage = 'SectionMessage';
|
|
31
|
+
exports.StatusLozenge = 'StatusLozenge';
|
|
32
|
+
exports.Tooltip = 'Tooltip';
|
|
33
|
+
exports.Em = 'Em';
|
|
34
|
+
exports.Strike = 'Strike';
|
|
35
|
+
exports.Strong = 'Strong';
|
|
36
|
+
exports.Tab = 'Tab';
|
|
37
|
+
exports.Tabs = 'Tabs';
|
|
38
|
+
exports.Cell = 'Cell';
|
|
39
|
+
exports.Head = 'Head';
|
|
40
|
+
exports.Row = 'Row';
|
|
41
|
+
exports.Table = 'Table';
|
|
42
|
+
exports.Tag = 'Tag';
|
|
43
|
+
exports.TagGroup = 'TagGroup';
|
|
44
|
+
exports.User = 'User';
|
|
45
|
+
exports.UserGroup = 'UserGroup';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAE1D,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
package/out/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
var reconciler_1 = require("./reconciler");
|
|
5
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return reconciler_1.ForgeReconciler; } });
|
|
6
|
+
tslib_1.__exportStar(require("./styles"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./components"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconciler.d.ts","sourceRoot":"","sources":["../src/reconciler.ts"],"names":[],"mappings":"AAsMA,eAAO,MAAM,eAAe;sBACR,GAAG,KAAG,IAAI;CAiB7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForgeReconciler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_reconciler_1 = tslib_1.__importDefault(require("react-reconciler"));
|
|
6
|
+
const constants_1 = require("react-reconciler/constants");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
const callBridge = self.__bridge.callBridge;
|
|
9
|
+
const createElement = (type, props = {}) => {
|
|
10
|
+
const { children } = props, restProps = tslib_1.__rest(props, ["children"]);
|
|
11
|
+
return {
|
|
12
|
+
type,
|
|
13
|
+
children: [],
|
|
14
|
+
props: restProps,
|
|
15
|
+
key: uuid_1.v4()
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const appendChild = (parent, child) => {
|
|
19
|
+
if (parent.children.includes(child)) {
|
|
20
|
+
const removeIndex = parent.children.indexOf(child);
|
|
21
|
+
parent.children.splice(removeIndex, 1);
|
|
22
|
+
}
|
|
23
|
+
parent.children.push(child);
|
|
24
|
+
};
|
|
25
|
+
const insertBefore = (parent, child, beforeChild) => {
|
|
26
|
+
const insertIndex = parent.children.indexOf(beforeChild);
|
|
27
|
+
if (parent.children.includes(child)) {
|
|
28
|
+
const removeIndex = parent.children.indexOf(child);
|
|
29
|
+
parent.children.splice(removeIndex, 1);
|
|
30
|
+
}
|
|
31
|
+
parent.children.splice(insertIndex, 0, child);
|
|
32
|
+
};
|
|
33
|
+
const hostConfig = {
|
|
34
|
+
supportsMutation: true,
|
|
35
|
+
supportsPersistence: false,
|
|
36
|
+
noTimeout: -1,
|
|
37
|
+
isPrimaryRenderer: false,
|
|
38
|
+
supportsHydration: false,
|
|
39
|
+
resetAfterCommit(forgeDoc) {
|
|
40
|
+
callBridge('reconcile', { forgeDoc });
|
|
41
|
+
},
|
|
42
|
+
createInstance(type, props) {
|
|
43
|
+
const element = createElement(type, props);
|
|
44
|
+
return element;
|
|
45
|
+
},
|
|
46
|
+
createTextInstance(text) {
|
|
47
|
+
return {
|
|
48
|
+
type: 'String',
|
|
49
|
+
children: [],
|
|
50
|
+
props: {
|
|
51
|
+
text
|
|
52
|
+
},
|
|
53
|
+
key: uuid_1.v4()
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
appendInitialChild(parent, child) {
|
|
57
|
+
appendChild(parent, child);
|
|
58
|
+
},
|
|
59
|
+
appendChild(parent, child) {
|
|
60
|
+
appendChild(parent, child);
|
|
61
|
+
},
|
|
62
|
+
appendChildToContainer(container, child) {
|
|
63
|
+
appendChild(container, child);
|
|
64
|
+
},
|
|
65
|
+
finalizeInitialChildren() {
|
|
66
|
+
return false;
|
|
67
|
+
},
|
|
68
|
+
prepareUpdate(instance, type, oldProps, newProps) {
|
|
69
|
+
instance.props = newProps;
|
|
70
|
+
return newProps;
|
|
71
|
+
},
|
|
72
|
+
shouldSetTextContent() {
|
|
73
|
+
return false;
|
|
74
|
+
},
|
|
75
|
+
getRootHostContext() {
|
|
76
|
+
return {};
|
|
77
|
+
},
|
|
78
|
+
getChildHostContext(parentContext, fiberType) {
|
|
79
|
+
return null;
|
|
80
|
+
},
|
|
81
|
+
getPublicInstance(instance) {
|
|
82
|
+
return instance;
|
|
83
|
+
},
|
|
84
|
+
prepareForCommit() {
|
|
85
|
+
return null;
|
|
86
|
+
},
|
|
87
|
+
preparePortalMount() { },
|
|
88
|
+
scheduleTimeout(fn, delay) {
|
|
89
|
+
return setTimeout(fn, delay);
|
|
90
|
+
},
|
|
91
|
+
cancelTimeout(id) {
|
|
92
|
+
clearTimeout(id);
|
|
93
|
+
},
|
|
94
|
+
insertBefore(parent, child, beforeChild) {
|
|
95
|
+
insertBefore(parent, child, beforeChild);
|
|
96
|
+
},
|
|
97
|
+
insertInContainerBefore(container, child, beforeChild) {
|
|
98
|
+
insertBefore(container, child, beforeChild);
|
|
99
|
+
},
|
|
100
|
+
removeChild(parent, child) {
|
|
101
|
+
const removeIndex = parent.children.indexOf(child);
|
|
102
|
+
parent.children.splice(removeIndex, 1);
|
|
103
|
+
},
|
|
104
|
+
removeChildFromContainer(container, child) {
|
|
105
|
+
const removeIndex = container.children.indexOf(child);
|
|
106
|
+
container.children.splice(removeIndex, 1);
|
|
107
|
+
},
|
|
108
|
+
resetTextContent() { },
|
|
109
|
+
commitTextUpdate(textInstance, oldText, newText) {
|
|
110
|
+
textInstance.props.text = newText;
|
|
111
|
+
},
|
|
112
|
+
commitMount() { },
|
|
113
|
+
commitUpdate() { },
|
|
114
|
+
hideInstance() { },
|
|
115
|
+
hideTextInstance() { },
|
|
116
|
+
unhideInstance() { },
|
|
117
|
+
unhideTextInstance() { },
|
|
118
|
+
clearContainer() { },
|
|
119
|
+
detachDeletedInstance(instance) { },
|
|
120
|
+
getCurrentEventPriority() {
|
|
121
|
+
return constants_1.DefaultEventPriority;
|
|
122
|
+
},
|
|
123
|
+
getInstanceFromNode() {
|
|
124
|
+
return null;
|
|
125
|
+
},
|
|
126
|
+
beforeActiveInstanceBlur() { },
|
|
127
|
+
afterActiveInstanceBlur() { },
|
|
128
|
+
prepareScopeUpdate() { },
|
|
129
|
+
getInstanceFromScope() {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const reconciler = react_reconciler_1.default(hostConfig);
|
|
134
|
+
exports.ForgeReconciler = {
|
|
135
|
+
render: (element) => {
|
|
136
|
+
const rootElement = createElement('Root');
|
|
137
|
+
const container = reconciler.createContainer(rootElement, 0, null, false, null, 'root', (err) => {
|
|
138
|
+
console.log(err);
|
|
139
|
+
}, null);
|
|
140
|
+
reconciler.updateContainer(element, container, null, null);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
exports.default = exports.ForgeReconciler;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AllowedPrimitives, Definitions, GradientValue, RGBAColorValue, ShadowValue, TransformValue, ColorType, URLValue } from '../types';
|
|
2
|
+
export interface PreDefinitions {
|
|
3
|
+
[key: string]: AllowedPrimitives | ComposeProvider;
|
|
4
|
+
}
|
|
5
|
+
export declare type Compose = (...primitiveObjects: AllowedPrimitives[]) => AllowedPrimitives;
|
|
6
|
+
export declare type ComposeProvider = (compose: Compose) => AllowedPrimitives;
|
|
7
|
+
export declare const StyleSheet: {
|
|
8
|
+
create(definitions: PreDefinitions): Definitions;
|
|
9
|
+
};
|
|
10
|
+
export declare const rgba: (r: number, g: number, b: number, a: number) => RGBAColorValue;
|
|
11
|
+
export declare const rgb: (r: number, g: number, b: number) => RGBAColorValue;
|
|
12
|
+
export declare function shadow(offsets: string, color: string | RGBAColorValue): ShadowValue;
|
|
13
|
+
export interface GradientStep {
|
|
14
|
+
percent: string;
|
|
15
|
+
value: ColorType;
|
|
16
|
+
}
|
|
17
|
+
export declare function gradientStep(percent: string, value: ColorType): GradientStep;
|
|
18
|
+
export declare function linearGradient(degrees: string, ...steps: GradientStep[]): GradientValue;
|
|
19
|
+
export declare function radialGradient(...steps: GradientStep[]): GradientValue;
|
|
20
|
+
export declare function translate(x?: string, y?: string, z?: string): TransformValue;
|
|
21
|
+
export declare function scale(x?: string, y?: string, z?: string): TransformValue;
|
|
22
|
+
export declare function rotate(x?: string, y?: string, z?: string): TransformValue;
|
|
23
|
+
export declare function skew(x?: string, y?: string): TransformValue;
|
|
24
|
+
export declare function url(path: string): URLValue;
|
|
25
|
+
export declare function focus(primitives: AllowedPrimitives): AllowedPrimitives;
|
|
26
|
+
export declare function hover(primitives: AllowedPrimitives): AllowedPrimitives;
|
|
27
|
+
export declare function active(primitives: AllowedPrimitives): AllowedPrimitives;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,EACT,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,eAAe,CAAC;CACpD;AAED,oBAAY,OAAO,GAAG,CAAC,GAAG,gBAAgB,EAAE,iB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MAAM,GAAG,cAAc,CAQ3D;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAO1C;AAED,wBAAgB,KAAK,CAAC,UAAU,EAAE,iBAAiB,GAAG,iBAAiB,CAItE;AAED,wBAAgB,KAAK,CAAC,UAAU,EAAE,iBAAiB,GAAG,iBAAiB,CAItE;AAED,wBAAgB,MAAM,CAAC,UAAU,EAAE,iBAAiB,GAAG,iBAAiB,CAIvE"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.active = exports.hover = exports.focus = exports.url = exports.skew = exports.rotate = exports.scale = exports.translate = exports.radialGradient = exports.linearGradient = exports.gradientStep = exports.shadow = exports.rgb = exports.rgba = exports.StyleSheet = void 0;
|
|
4
|
+
exports.StyleSheet = {
|
|
5
|
+
create(definitions) {
|
|
6
|
+
const stylesheet = {};
|
|
7
|
+
for (const key in definitions) {
|
|
8
|
+
const definition = definitions[key];
|
|
9
|
+
if (typeof definition === 'function') {
|
|
10
|
+
const compose = (...primitivesDefinitions) => {
|
|
11
|
+
return primitivesDefinitions.reduce((acc, primitives) => {
|
|
12
|
+
return Object.assign(Object.assign({}, acc), primitives);
|
|
13
|
+
}, {});
|
|
14
|
+
};
|
|
15
|
+
stylesheet[key] = definition(compose);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
stylesheet[key] = definition;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return stylesheet;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.rgba = (r, g, b, a) => {
|
|
25
|
+
return {
|
|
26
|
+
method: 'rgba',
|
|
27
|
+
value: {
|
|
28
|
+
r,
|
|
29
|
+
g,
|
|
30
|
+
b,
|
|
31
|
+
a
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
exports.rgb = (r, g, b) => {
|
|
36
|
+
return {
|
|
37
|
+
method: 'rgb',
|
|
38
|
+
value: {
|
|
39
|
+
r,
|
|
40
|
+
g,
|
|
41
|
+
b
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
function shadow(offsets, color) {
|
|
46
|
+
return {
|
|
47
|
+
method: 'shadow',
|
|
48
|
+
value: {
|
|
49
|
+
offsets,
|
|
50
|
+
color
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.shadow = shadow;
|
|
55
|
+
function gradientStep(percent, value) {
|
|
56
|
+
return {
|
|
57
|
+
percent,
|
|
58
|
+
value
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.gradientStep = gradientStep;
|
|
62
|
+
function linearGradient(degrees, ...steps) {
|
|
63
|
+
return {
|
|
64
|
+
method: 'gradient',
|
|
65
|
+
value: {
|
|
66
|
+
type: 'linear',
|
|
67
|
+
colors: steps,
|
|
68
|
+
degrees
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.linearGradient = linearGradient;
|
|
73
|
+
function radialGradient(...steps) {
|
|
74
|
+
return {
|
|
75
|
+
method: 'gradient',
|
|
76
|
+
value: {
|
|
77
|
+
type: 'radial',
|
|
78
|
+
colors: steps
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
exports.radialGradient = radialGradient;
|
|
83
|
+
function translate(x, y, z) {
|
|
84
|
+
return {
|
|
85
|
+
method: 'translate',
|
|
86
|
+
value: {
|
|
87
|
+
x,
|
|
88
|
+
y,
|
|
89
|
+
z
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
exports.translate = translate;
|
|
94
|
+
function scale(x, y, z) {
|
|
95
|
+
return {
|
|
96
|
+
method: 'scale',
|
|
97
|
+
value: {
|
|
98
|
+
x,
|
|
99
|
+
y,
|
|
100
|
+
z
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
exports.scale = scale;
|
|
105
|
+
function rotate(x, y, z) {
|
|
106
|
+
return {
|
|
107
|
+
method: 'rotate',
|
|
108
|
+
value: {
|
|
109
|
+
x,
|
|
110
|
+
y,
|
|
111
|
+
z
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
exports.rotate = rotate;
|
|
116
|
+
function skew(x, y) {
|
|
117
|
+
return {
|
|
118
|
+
method: 'skew',
|
|
119
|
+
value: {
|
|
120
|
+
x,
|
|
121
|
+
y
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
exports.skew = skew;
|
|
126
|
+
function url(path) {
|
|
127
|
+
return {
|
|
128
|
+
method: 'url',
|
|
129
|
+
value: {
|
|
130
|
+
path
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
exports.url = url;
|
|
135
|
+
function focus(primitives) {
|
|
136
|
+
return {
|
|
137
|
+
__focus: primitives
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
exports.focus = focus;
|
|
141
|
+
function hover(primitives) {
|
|
142
|
+
return {
|
|
143
|
+
__hover: primitives
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
exports.hover = hover;
|
|
147
|
+
function active(primitives) {
|
|
148
|
+
return {
|
|
149
|
+
__active: primitives
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
exports.active = active;
|