anu-verzum 1.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.
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _elements = require("../elements");
8
+ var _Context = require("./Context");
9
+ const _Intl = (0, _Context.createContext)({});
10
+ let __messagesContext = {
11
+ locale: undefined,
12
+ messages: {}
13
+ };
14
+ const IntlProvider = ({
15
+ locale,
16
+ messages,
17
+ defaultLocale,
18
+ children
19
+ }) => {
20
+ let selectedMessage;
21
+ try {
22
+ if (locale === null) {
23
+ throw new Error('Property "locale" must be defined and must not be a string reference to the selected language in "messages"!');
24
+ }
25
+ if (!messages) {
26
+ throw new Error('Property "messages" must be defined!');
27
+ }
28
+ if (messages[locale]) {
29
+ selectedMessage = messages[locale];
30
+ } else if (messages[defaultLocale]) {
31
+ selectedMessage = messages[defaultLocale];
32
+ }
33
+ if (!selectedMessage) {
34
+ throw new Error('No messages can be found in "messages" by the value of "locale" or "defaultLocale"!');
35
+ } else {
36
+ __messagesContext = {
37
+ locale,
38
+ messages: {
39
+ ...selectedMessage
40
+ }
41
+ };
42
+ return (0, _elements.createElement)(_Intl.ContextProvider, {
43
+ locale,
44
+ messages: selectedMessage
45
+ }, children);
46
+ }
47
+ } catch (err) {
48
+ console.error(err);
49
+ }
50
+ };
51
+ const FormattedMessage = ({
52
+ id,
53
+ values,
54
+ defaultMessage
55
+ }) => (0, _elements.createElement)(_Intl.ContextConsumer, {}, ({
56
+ value: {
57
+ messages
58
+ }
59
+ }) => {
60
+ let textValue = '';
61
+ try {
62
+ if (messages && messages[id]) {
63
+ textValue = messages[id];
64
+ } else if (defaultMessage) {
65
+ textValue = defaultMessage;
66
+ } else {
67
+ textValue = id;
68
+ }
69
+ if (textValue.length === 0) {
70
+ throw new Error('No text or fallback value to return.');
71
+ } else {
72
+ if (values && typeof values === 'object' && values !== null) {
73
+ Object.keys(values).forEach(key => {
74
+ const variablePattern = `{${key}}`;
75
+ if (textValue.indexOf(variablePattern) > -1) {
76
+ textValue = textValue.replace(variablePattern, values[key]);
77
+ }
78
+ });
79
+ }
80
+ return (0, _elements.createElement)(_elements.TEXT_ELEMENT, {
81
+ nodeValue: textValue
82
+ });
83
+ }
84
+ } catch (err) {
85
+ console.error(err);
86
+ }
87
+ });
88
+ const formatMessage = (id, values, defaultMessage) => {
89
+ let textValue = '';
90
+ try {
91
+ if (__messagesContext.messages[id]) {
92
+ textValue = __messagesContext.messages[id];
93
+ } else if (defaultMessage) {
94
+ textValue = defaultMessage;
95
+ } else {
96
+ textValue = id;
97
+ }
98
+ if (textValue.length === 0) {
99
+ throw new Error('No text or fallback value to return.');
100
+ }
101
+ } catch (err) {
102
+ console.error(err);
103
+ }
104
+ if (values && typeof values === 'object' && values !== null) {
105
+ Object.keys(values).forEach(key => {
106
+ const variablePattern = `{${key}}`;
107
+ if (textValue.indexOf(variablePattern) > -1) {
108
+ textValue = textValue.replace(variablePattern, values[key]);
109
+ }
110
+ });
111
+ }
112
+ return textValue;
113
+ };
114
+ const abbreviateNumber = (value, options = {}) => {
115
+ const getByLocale = values => values[__messagesContext.locale] || values['default'];
116
+ const UNITS = {
117
+ 'hu': ['E', 'm', 'M', 'b'],
118
+ 'default': ['K', 'M', 'B', 'T']
119
+ };
120
+ const DECIMAL_SIGN = {
121
+ 'hu': ',',
122
+ 'default': '.'
123
+ };
124
+ if (typeof value === 'number' && !isNaN(value)) {
125
+ const defaultAbbreviateNumberOptions = {
126
+ units: getByLocale(UNITS),
127
+ decimalPlaces: 2,
128
+ decimalSign: getByLocale(DECIMAL_SIGN)
129
+ };
130
+ const isNegative = value < 0;
131
+ const opts = {
132
+ ...defaultAbbreviateNumberOptions,
133
+ ...options
134
+ };
135
+ const {
136
+ units,
137
+ decimalPlaces,
138
+ decimalSign
139
+ } = opts;
140
+ const decPlaces = Math.pow(10, decimalPlaces);
141
+ let unit = '';
142
+ let result = Math.abs(value);
143
+ for (let i = units.length - 1; i >= 0; i--) {
144
+ const size = Math.pow(10, (i + 1) * 3);
145
+ if (size <= result) {
146
+ result = Math.round(result * decPlaces / size) / decPlaces;
147
+ if (result === 1000 && i < units.length - 1) {
148
+ result = 1;
149
+ i++;
150
+ }
151
+ unit = units[i];
152
+ break;
153
+ }
154
+ }
155
+ if (decimalSign) {
156
+ result = `${result}`.replace('.', decimalSign);
157
+ }
158
+ return `${isNegative ? '-' : ''}${result}${unit}`;
159
+ }
160
+ return value;
161
+ };
162
+ const Intl = {
163
+ abbreviateNumber,
164
+ FormattedMessage,
165
+ formatMessage,
166
+ Provider: IntlProvider
167
+ };
168
+ var _default = exports.default = Intl;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.updateDomProperties = exports.createDomElement = exports.SVG_ELEMENT_LIST = void 0;
7
+ var _elements = require("./elements");
8
+ const getHTMLValidSvgTag = fiberType => {
9
+ switch (fiberType) {
10
+ case 'anchor':
11
+ {
12
+ return 'a';
13
+ }
14
+ case 'svgStyle':
15
+ {
16
+ return 'style';
17
+ }
18
+ case 'svgTitle':
19
+ {
20
+ return 'title';
21
+ }
22
+ default:
23
+ {
24
+ return fiberType;
25
+ }
26
+ }
27
+ };
28
+ const SVG_ELEMENT_LIST = exports.SVG_ELEMENT_LIST = ['anchor', 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'desc', 'discard', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'foreignObject', 'g', 'hatch', 'hatchpath', 'image', 'line', 'linearGradient', 'marker', 'mask', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'stop', 'svgStyle', 'svg', 'switch', 'symbol', 'text', 'textPath', 'svgTitle', 'tspan', 'unknown', 'use', 'view'];
29
+ const updateDomProperties = (dom, prevProps, nextProps, isSvgElement = false) => {
30
+ const isEvent = name => {
31
+ if (!String.prototype.startsWith) {
32
+ return name[0] === 'o' && name[1] === 'n';
33
+ }
34
+ return name.startsWith('on');
35
+ };
36
+ const isAttribute = name => !isEvent(name) && name !== 'children' && name !== 'style' && name !== 'ref' && name !== 'key';
37
+ const isNew = (prev, next) => key => prev[key] !== next[key];
38
+ const isGone = (prev, next) => key => !(key in next);
39
+ Object.keys(prevProps).filter(isEvent).filter(key => !(key in nextProps) || isNew(prevProps, nextProps)(key)).forEach(name => {
40
+ const eventType = name.toLowerCase().substring(2);
41
+ dom.removeEventListener(eventType, prevProps[name]);
42
+ });
43
+ Object.keys(prevProps).filter(isAttribute).filter(isGone(prevProps, nextProps)).forEach(name => {
44
+ if (name === 'className') {
45
+ dom['class'] = null;
46
+ } else if (name === 'htmlFor') {
47
+ dom['for'] = null;
48
+ } else {
49
+ dom[name] = null;
50
+ }
51
+ });
52
+ Object.keys(nextProps).filter(isAttribute).filter(isNew(prevProps, nextProps)).forEach(name => {
53
+ if (isSvgElement) {
54
+ if (name === 'className') {
55
+ dom.setAttribute('class', nextProps[name]);
56
+ } else {
57
+ dom.setAttribute(name, nextProps[name]);
58
+ }
59
+ } else {
60
+ if (name.includes('aria-') || name === 'role') {
61
+ dom.setAttribute(name, nextProps[name]);
62
+ } else {
63
+ dom[name] = nextProps[name];
64
+ }
65
+ }
66
+ });
67
+ prevProps.style = prevProps.style || {};
68
+ nextProps.style = nextProps.style || {};
69
+ Object.keys(nextProps.style).filter(isNew(prevProps.style, nextProps.style)).forEach(key => {
70
+ dom.style[key] = nextProps.style[key];
71
+ });
72
+ Object.keys(prevProps.style).filter(isGone(prevProps.style, nextProps.style)).forEach(key => {
73
+ dom.style[key] = '';
74
+ });
75
+ Object.keys(nextProps).filter(isEvent).filter(isNew(prevProps, nextProps)).forEach(name => {
76
+ const eventType = name.toLowerCase().substring(2);
77
+ dom.addEventListener(eventType, nextProps[name]);
78
+ });
79
+ };
80
+ exports.updateDomProperties = updateDomProperties;
81
+ const createDomElement = fiber => {
82
+ const isTextElement = fiber.type === _elements.TEXT_ELEMENT;
83
+ const isSvgElement = SVG_ELEMENT_LIST.indexOf(fiber.type) > -1;
84
+ let dom;
85
+ if (isTextElement) {
86
+ dom = document.createTextNode('');
87
+ } else if (isSvgElement) {
88
+ dom = document.createElementNS('http://www.w3.org/2000/svg', getHTMLValidSvgTag(fiber.type));
89
+ } else {
90
+ dom = document.createElement(fiber.type);
91
+ }
92
+ updateDomProperties(dom, {}, fiber.props, isSvgElement);
93
+ return dom;
94
+ };
95
+ exports.createDomElement = createDomElement;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createElement = exports.TEXT_ELEMENT = void 0;
7
+ const TEXT_ELEMENT = exports.TEXT_ELEMENT = 'TEXT_ELEMENT';
8
+ const createTextElement = value => ({
9
+ type: TEXT_ELEMENT,
10
+ props: {
11
+ nodeValue: value
12
+ }
13
+ });
14
+ const createElement = (type, config, ...args) => {
15
+ const props = Object.assign({}, config);
16
+ const hasChildren = args.length > 0;
17
+ const rawChildren = hasChildren ? [].concat(...args) : [];
18
+ props.children = rawChildren.filter(c => c !== null && c !== false).map(c => typeof c === 'function' ? createElement(c, {
19
+ ...(c.props || {})
20
+ }) : c instanceof Object ? c : createTextElement(c));
21
+ return {
22
+ type,
23
+ props
24
+ };
25
+ };
26
+ exports.createElement = createElement;
@@ -0,0 +1,379 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.scheduleUpdate = exports.render = exports.createRef = void 0;
7
+ var _domUtils = require("./domUtils");
8
+ const HOST_COMPONENT = 'host';
9
+ const CLASS_COMPONENT = 'class';
10
+ const FUNCTION_COMPONENT = 'function';
11
+ const HOST_ROOT = 'root';
12
+ const PLACEMENT = 1;
13
+ const DELETION = 2;
14
+ const UPDATE = 3;
15
+ const ENOUGH_TIME = 1;
16
+ const updateQueue = [];
17
+ let nextUnitOfWork = null;
18
+ let pendingCommit = null;
19
+ const getRoot = fiber => {
20
+ let node = fiber;
21
+ while (node.parent) {
22
+ node = node.parent;
23
+ }
24
+ return node;
25
+ };
26
+ const resetNextUnitOfWork = () => {
27
+ const update = updateQueue.shift();
28
+ if (!update) {
29
+ return;
30
+ }
31
+ if (update.partialState) {
32
+ update.instance.__fiber.partialState = update.partialState;
33
+ }
34
+ if (update.partialStateCallback) {
35
+ update.instance.__fiber.partialStateCallback = update.partialStateCallback;
36
+ }
37
+ const root = update.from === HOST_ROOT ? update.dom._rootContainerFiber : getRoot(update.instance.__fiber);
38
+ nextUnitOfWork = {
39
+ tag: HOST_ROOT,
40
+ stateNode: update.dom || root.stateNode,
41
+ props: update.newProps || root.props,
42
+ alternate: root
43
+ };
44
+ };
45
+ const workLoop = deadline => {
46
+ if (!nextUnitOfWork) {
47
+ resetNextUnitOfWork();
48
+ }
49
+ while (nextUnitOfWork && deadline.timeRemaining() > ENOUGH_TIME) {
50
+ nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
51
+ }
52
+ if (pendingCommit) {
53
+ commitAllWork(pendingCommit);
54
+ }
55
+ };
56
+ const performWork = deadline => {
57
+ workLoop(deadline);
58
+ if (nextUnitOfWork || updateQueue.length > 0) {
59
+ requestIdleCallback(performWork);
60
+ }
61
+ };
62
+ const performUnitOfWork = wipFiber => {
63
+ beginWork(wipFiber);
64
+ if (wipFiber.child) {
65
+ return wipFiber.child;
66
+ }
67
+ let unitOfWork = wipFiber;
68
+ while (unitOfWork) {
69
+ completeWork(unitOfWork);
70
+ if (unitOfWork.sibling) {
71
+ return unitOfWork.sibling;
72
+ }
73
+ unitOfWork = unitOfWork.parent;
74
+ }
75
+ };
76
+ const beginWork = wipFiber => {
77
+ if (wipFiber.tag === CLASS_COMPONENT) {
78
+ updateClassComponent(wipFiber);
79
+ } else if (wipFiber.tag === FUNCTION_COMPONENT) {
80
+ updateFunctionComponent(wipFiber);
81
+ } else {
82
+ updateHostComponent(wipFiber);
83
+ }
84
+ };
85
+ const updateHostComponent = wipFiber => {
86
+ if (!wipFiber.stateNode) {
87
+ wipFiber.stateNode = (0, _domUtils.createDomElement)(wipFiber);
88
+ }
89
+ const newChildElements = wipFiber.props.children;
90
+ reconcileChildrenArray(wipFiber, newChildElements);
91
+ };
92
+ const createFunctionComponent = fiber => {
93
+ const instance = fiber.type(fiber.props);
94
+ instance.__fiber = fiber;
95
+ return instance;
96
+ };
97
+ const updateFunctionComponent = wipFiber => {
98
+ let instance = wipFiber.stateNode || null;
99
+ if (instance === null) {
100
+ instance = wipFiber.stateNode = createFunctionComponent(wipFiber);
101
+ } else if (wipFiber.props === instance.props && !wipFiber.partialState) {
102
+ cloneChildFibers(wipFiber);
103
+ return;
104
+ }
105
+ instance.props = wipFiber.props;
106
+ wipFiber.stateNode.render = wipFiber.type;
107
+ const newChildElements = wipFiber.stateNode.render(wipFiber.props);
108
+ reconcileChildrenArray(wipFiber, newChildElements);
109
+ };
110
+ const createInstance = fiber => {
111
+ const context = Object.assign({}, fiber.stateNode ? {
112
+ ...fiber.stateNode.context
113
+ } : {});
114
+ const instance = new fiber.type(fiber.props, context);
115
+ instance.__fiber = fiber;
116
+ return instance;
117
+ };
118
+ const updateClassComponent = wipFiber => {
119
+ let instance = wipFiber.stateNode || null;
120
+ if (instance === null) {
121
+ const stateNode = createInstance(wipFiber);
122
+ stateNode.context = {
123
+ ...stateNode.context
124
+ };
125
+ instance = wipFiber.stateNode = stateNode;
126
+ wipFiber.stateNode.setState = wipFiber.stateNode.setState.bind(wipFiber.stateNode);
127
+ if (wipFiber.type.prototype.componentDidMount) {
128
+ wipFiber.stateNode.componentDidMount = wipFiber.stateNode.componentDidMount.bind(wipFiber.stateNode);
129
+ }
130
+ if (wipFiber.type.prototype.componentDidUpdate) {
131
+ wipFiber.stateNode.componentDidUpdate = wipFiber.stateNode.componentDidUpdate.bind(wipFiber.stateNode);
132
+ }
133
+ if (wipFiber.type.prototype.componentWillUnmount) {
134
+ wipFiber.stateNode.componentWillUnmount = wipFiber.stateNode.componentWillUnmount.bind(wipFiber.stateNode);
135
+ }
136
+ } else if (wipFiber.props === instance.props && !wipFiber.partialState && !wipFiber.partialStateCallback) {
137
+ cloneChildFibers(wipFiber);
138
+ return;
139
+ }
140
+ const nextProps = {
141
+ ...wipFiber.props
142
+ };
143
+ let nextState = {};
144
+ if (!wipFiber.partialStateCallback) {
145
+ nextState = Object.assign({}, instance.state, wipFiber.partialState);
146
+ } else {
147
+ nextState = wipFiber.partialStateCallback(instance.state, nextProps);
148
+ }
149
+ instance.props = nextProps;
150
+ instance.state = nextState;
151
+ wipFiber.partialState = null;
152
+ delete wipFiber.partialStateCallback;
153
+ let newChildElements = null;
154
+ newChildElements = wipFiber.stateNode.render();
155
+ reconcileChildrenArray(wipFiber, newChildElements);
156
+ };
157
+ const arrify = val => !val ? [] : Array.isArray(val) ? val : [val];
158
+ const reconcileChildrenArray = (wipFiber, newChildElements) => {
159
+ const elements = arrify(newChildElements);
160
+ let index = 0;
161
+ let oldFiber = wipFiber.alternate ? wipFiber.alternate.child : null;
162
+ let newFiber = null;
163
+ while (index < elements.length || oldFiber) {
164
+ const prevFiber = newFiber;
165
+ const element = index < elements.length && elements[index];
166
+ const sameType = oldFiber && element && element.type === oldFiber.type;
167
+ if (sameType) {
168
+ newFiber = {
169
+ type: oldFiber.type,
170
+ tag: oldFiber.tag,
171
+ stateNode: oldFiber.stateNode,
172
+ props: element.props,
173
+ parent: wipFiber,
174
+ alternate: oldFiber,
175
+ partialState: oldFiber.partialState,
176
+ effectTag: UPDATE
177
+ };
178
+ if (oldFiber.partialStateCallback) {
179
+ newFiber.partialStateCallback = oldFiber.partialStateCallback;
180
+ }
181
+ }
182
+ if (element && !sameType) {
183
+ let tag;
184
+ if (typeof element.type === 'string') {
185
+ tag = HOST_COMPONENT;
186
+ } else if (typeof element.type === 'function' && !element.type.isAnuComponent && !element.type.prototype.hasOwnProperty('render')) {
187
+ tag = FUNCTION_COMPONENT;
188
+ } else {
189
+ tag = CLASS_COMPONENT;
190
+ }
191
+ newFiber = {
192
+ type: element.type,
193
+ tag,
194
+ props: element.props,
195
+ parent: wipFiber,
196
+ effectTag: PLACEMENT
197
+ };
198
+ }
199
+ if (oldFiber && !sameType) {
200
+ oldFiber.effectTag = DELETION;
201
+ wipFiber.effects = wipFiber.effects || [];
202
+ wipFiber.effects.push(oldFiber);
203
+ }
204
+ if (oldFiber) {
205
+ oldFiber = oldFiber.sibling;
206
+ }
207
+ if (index === 0) {
208
+ wipFiber.child = newFiber;
209
+ } else if (prevFiber && element) {
210
+ prevFiber.sibling = newFiber;
211
+ }
212
+ index++;
213
+ }
214
+ };
215
+ const cloneChildFibers = parentFiber => {
216
+ const oldFiber = parentFiber.alternate;
217
+ if (!oldFiber.child) {
218
+ return;
219
+ }
220
+ let oldChild = oldFiber.child;
221
+ let prevChild = null;
222
+ while (oldChild) {
223
+ const newChild = {
224
+ type: oldChild.type,
225
+ tag: oldChild.tag,
226
+ stateNode: oldChild.stateNode,
227
+ props: oldChild.props,
228
+ partialState: oldChild.partialState,
229
+ alternate: oldChild,
230
+ parent: parentFiber
231
+ };
232
+ if (oldChild.partialStateCallback) {
233
+ newChild.partialStateCallback = oldChild.partialStateCallback;
234
+ }
235
+ if (prevChild) {
236
+ prevChild.sibling = newChild;
237
+ } else {
238
+ parentFiber.child = newChild;
239
+ }
240
+ prevChild = newChild;
241
+ oldChild = oldChild.sibling;
242
+ }
243
+ };
244
+ const completeWork = fiber => {
245
+ if (fiber.tag === CLASS_COMPONENT) {
246
+ fiber.stateNode.__fiber = fiber;
247
+ }
248
+ if (fiber.parent) {
249
+ const childEffects = fiber.effects || [];
250
+ const thisEffect = fiber.effectTag !== null ? [fiber] : [];
251
+ const parentEffects = fiber.parent.effects || [];
252
+ fiber.parent.effects = parentEffects.concat(childEffects, thisEffect);
253
+ } else {
254
+ pendingCommit = fiber;
255
+ }
256
+ };
257
+ const componentLifecyclesQueue = [];
258
+ const flushComponentLifecyclesQueue = () => {
259
+ while (componentLifecyclesQueue.length > 0) {
260
+ const {
261
+ fn,
262
+ params: {
263
+ prevProps,
264
+ prevState
265
+ }
266
+ } = componentLifecyclesQueue.shift();
267
+ fn(prevProps, prevState);
268
+ }
269
+ };
270
+ const commitAllWork = fiber => {
271
+ fiber.effects.forEach((effect, index, effects) => {
272
+ commitWork(effect);
273
+ if (index === effects.length - 1) {
274
+ flushComponentLifecyclesQueue();
275
+ }
276
+ });
277
+ fiber.stateNode._rootContainerFiber = fiber;
278
+ nextUnitOfWork = null;
279
+ pendingCommit = null;
280
+ };
281
+ const commitWork = effect => {
282
+ if (effect.tag === HOST_ROOT) {
283
+ return;
284
+ }
285
+ let domParentFiber = effect.parent;
286
+ const isRefInProps = props => Object.keys(props).indexOf('ref') > -1;
287
+ while (domParentFiber.tag === CLASS_COMPONENT || domParentFiber.tag === FUNCTION_COMPONENT) {
288
+ domParentFiber = domParentFiber.parent;
289
+ }
290
+ const domParent = domParentFiber.stateNode;
291
+ if (effect.effectTag === PLACEMENT) {
292
+ if (effect.tag === HOST_COMPONENT) {
293
+ domParent.appendChild(effect.stateNode);
294
+ if (isRefInProps(effect.props)) {
295
+ effect.props.ref.current = effect.stateNode;
296
+ }
297
+ } else if (effect.tag === CLASS_COMPONENT) {
298
+ if (effect.stateNode.componentDidMount) {
299
+ componentLifecyclesQueue.push({
300
+ fn: effect.stateNode.componentDidMount,
301
+ params: {}
302
+ });
303
+ }
304
+ }
305
+ } else if (effect.effectTag === UPDATE) {
306
+ if (effect && effect.stateNode && effect.alternate && effect.alternate.props && effect.props) {
307
+ if (effect.tag === HOST_COMPONENT) {
308
+ (0, _domUtils.updateDomProperties)(effect.stateNode, effect.alternate.props, effect.props, _domUtils.SVG_ELEMENT_LIST.indexOf(effect.type) > -1);
309
+ if (isRefInProps(effect.props)) {
310
+ effect.props.ref.current = effect.stateNode;
311
+ }
312
+ } else if (effect.tag === CLASS_COMPONENT) {
313
+ if (effect.stateNode.componentDidUpdate) {
314
+ componentLifecyclesQueue.push({
315
+ fn: effect.stateNode.componentDidUpdate,
316
+ params: {
317
+ prevProps: effect.stateNode.props,
318
+ prevState: effect.stateNode.state
319
+ }
320
+ });
321
+ }
322
+ }
323
+ }
324
+ } else if (effect.effectTag === DELETION) {
325
+ if (effect.tag === CLASS_COMPONENT) {
326
+ if (effect.stateNode.componentWillUnmount) {
327
+ effect.stateNode.componentWillUnmount();
328
+ }
329
+ }
330
+ commitDeletion(effect, domParent);
331
+ }
332
+ };
333
+ const commitDeletion = (fiber, domParent) => {
334
+ let node = fiber;
335
+ while (node) {
336
+ if (node.tag === CLASS_COMPONENT || node.tag === FUNCTION_COMPONENT) {
337
+ node = node.child;
338
+ continue;
339
+ }
340
+ if (domParent.contains(node.stateNode)) {
341
+ domParent.removeChild(node.stateNode);
342
+ }
343
+ while (node !== fiber && !node.sibling) {
344
+ node = node.parent;
345
+ }
346
+ if (node === fiber) {
347
+ return;
348
+ }
349
+ node = node.sibling;
350
+ }
351
+ };
352
+ const createRef = () => ({
353
+ current: null
354
+ });
355
+ exports.createRef = createRef;
356
+ const scheduleUpdate = (instance, partialState, partialStateCallback) => {
357
+ const updateFiber = {
358
+ from: CLASS_COMPONENT,
359
+ instance,
360
+ partialState
361
+ };
362
+ if (partialStateCallback) {
363
+ updateFiber.partialStateCallback = partialStateCallback;
364
+ }
365
+ updateQueue.push(updateFiber);
366
+ requestIdleCallback(performWork);
367
+ };
368
+ exports.scheduleUpdate = scheduleUpdate;
369
+ const render = (elements, containerDom) => {
370
+ updateQueue.push({
371
+ from: HOST_ROOT,
372
+ dom: containerDom,
373
+ newProps: {
374
+ children: elements
375
+ }
376
+ });
377
+ requestIdleCallback(performWork);
378
+ };
379
+ exports.render = render;