@unsetsoft/ryunixjs 0.4.10 → 0.4.11-nightly.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 (2) hide show
  1. package/dist/Ryunix.js +189 -199
  2. package/package.json +3 -3
package/dist/Ryunix.js CHANGED
@@ -1,13 +1,8 @@
1
- ;(function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined'
3
- ? factory(exports)
4
- : typeof define === 'function' && define.amd
5
- ? define(['exports'], factory)
6
- : ((global =
7
- typeof globalThis !== 'undefined' ? globalThis : global || self),
8
- factory((global.Ryunix = {})))
9
- })(this, function (exports) {
10
- 'use strict'
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Ryunix = {}));
5
+ })(this, (function (exports) { 'use strict';
11
6
 
12
7
  const vars = {
13
8
  containerRoot: null,
@@ -17,15 +12,15 @@
17
12
  deletions: null,
18
13
  wipFiber: null,
19
14
  hookIndex: null,
20
- }
15
+ };
21
16
 
22
- const reg = /[A-Z]/g
17
+ const reg = /[A-Z]/g;
23
18
 
24
19
  const RYUNIX_TYPES = Object.freeze({
25
20
  TEXT_ELEMENT: Symbol('text.element'),
26
21
  RYUNIX_EFFECT: Symbol('ryunix.effect'),
27
22
  RYUNIX_CONTEXT: Symbol('ryunix.context'),
28
- })
23
+ });
29
24
 
30
25
  const STRINGS = Object.freeze({
31
26
  object: 'object',
@@ -33,13 +28,13 @@
33
28
  style: 'style',
34
29
  className: 'className',
35
30
  children: 'children',
36
- })
31
+ });
37
32
 
38
33
  const EFFECT_TAGS = Object.freeze({
39
34
  PLACEMENT: Symbol(),
40
35
  UPDATE: Symbol(),
41
36
  DELETION: Symbol(),
42
- })
37
+ });
43
38
 
44
39
  /**
45
40
  * The function creates a new element with the given type, props, and children.
@@ -70,7 +65,7 @@
70
65
  ),
71
66
  },
72
67
  }
73
- }
68
+ };
74
69
 
75
70
  /**
76
71
  * The function creates a text element with a given text value.
@@ -87,7 +82,7 @@
87
82
  children: [],
88
83
  },
89
84
  }
90
- }
85
+ };
91
86
 
92
87
  const Fragments = (props) => {
93
88
  if (props.style) {
@@ -97,7 +92,7 @@
97
92
  throw new Error('className cannot be empty.')
98
93
  }
99
94
  return createElement('div', props, props.children)
100
- }
95
+ };
101
96
 
102
97
  /**
103
98
  * The function renders an element into a container using a work-in-progress root.
@@ -113,10 +108,10 @@
113
108
  children: [element],
114
109
  },
115
110
  alternate: vars.currentRoot,
116
- }
117
- vars.deletions = []
118
- vars.nextUnitOfWork = vars.wipRoot
119
- }
111
+ };
112
+ vars.deletions = [];
113
+ vars.nextUnitOfWork = vars.wipRoot;
114
+ };
120
115
 
121
116
  /**
122
117
  * @description The function creates a reference to a DOM element with the specified ID. This will be used to initialize the app.
@@ -125,19 +120,19 @@
125
120
  * for the root element.
126
121
  */
127
122
  const init = (root) => {
128
- const rootElement = root || '__ryunix'
129
- vars.containerRoot = document.getElementById(rootElement)
130
- }
131
-
132
- const isEvent = (key) => key.startsWith('on')
133
- const isProperty = (key) => key !== STRINGS.children && !isEvent(key)
134
- const isNew = (prev, next) => (key) => prev[key] !== next[key]
135
- const isGone = (next) => (key) => !(key in next)
123
+ const rootElement = root || '__ryunix';
124
+ vars.containerRoot = document.getElementById(rootElement);
125
+ };
126
+
127
+ const isEvent = (key) => key.startsWith('on');
128
+ const isProperty = (key) => key !== STRINGS.children && !isEvent(key);
129
+ const isNew = (prev, next) => (key) => prev[key] !== next[key];
130
+ const isGone = (next) => (key) => !(key in next);
136
131
  const hasDepsChanged = (prevDeps, nextDeps) =>
137
132
  !prevDeps ||
138
133
  !nextDeps ||
139
134
  prevDeps.length !== nextDeps.length ||
140
- prevDeps.some((dep, index) => dep !== nextDeps[index])
135
+ prevDeps.some((dep, index) => dep !== nextDeps[index]);
141
136
 
142
137
  /**
143
138
  * The function cancels all effect hooks in a given fiber.
@@ -149,14 +144,12 @@
149
144
  const cancelEffects = (fiber) => {
150
145
  if (fiber.hooks) {
151
146
  fiber.hooks
152
- .filter(
153
- (hook) => hook.tag === RYUNIX_TYPES.RYUNIX_EFFECT && hook.cancel,
154
- )
147
+ .filter((hook) => hook.tag === RYUNIX_TYPES.RYUNIX_EFFECT && hook.cancel)
155
148
  .forEach((effectHook) => {
156
- effectHook.cancel()
157
- })
149
+ effectHook.cancel();
150
+ });
158
151
  }
159
- }
152
+ };
160
153
 
161
154
  /**
162
155
  * The function runs all effect hooks in a given fiber.
@@ -168,14 +161,12 @@
168
161
  const runEffects = (fiber) => {
169
162
  if (fiber.hooks) {
170
163
  fiber.hooks
171
- .filter(
172
- (hook) => hook.tag === RYUNIX_TYPES.RYUNIX_EFFECT && hook.effect,
173
- )
164
+ .filter((hook) => hook.tag === RYUNIX_TYPES.RYUNIX_EFFECT && hook.effect)
174
165
  .forEach((effectHook) => {
175
- effectHook.cancel = effectHook.effect()
176
- })
166
+ effectHook.cancel = effectHook.effect();
167
+ });
177
168
  }
178
- }
169
+ };
179
170
 
180
171
  /**
181
172
  * @description The function creates a state.
@@ -187,17 +178,17 @@
187
178
  const oldHook =
188
179
  vars.wipFiber.alternate &&
189
180
  vars.wipFiber.alternate.hooks &&
190
- vars.wipFiber.alternate.hooks[vars.hookIndex]
181
+ vars.wipFiber.alternate.hooks[vars.hookIndex];
191
182
  const hook = {
192
183
  state: oldHook ? oldHook.state : initial,
193
184
  queue: [],
194
- }
185
+ };
195
186
 
196
- const actions = oldHook ? oldHook.queue : []
187
+ const actions = oldHook ? oldHook.queue : [];
197
188
  actions.forEach((action) => {
198
189
  hook.state =
199
- typeof action === STRINGS.function ? action(hook.state) : action
200
- })
190
+ typeof action === STRINGS.function ? action(hook.state) : action;
191
+ });
201
192
 
202
193
  /**
203
194
  * The function `setState` updates the state of a component in Ryunix by adding an action to a queue
@@ -207,20 +198,20 @@
207
198
  * that needs to be applied to the component's state.
208
199
  */
209
200
  const setState = (action) => {
210
- hook.queue.push(action)
201
+ hook.queue.push(action);
211
202
  vars.wipRoot = {
212
203
  dom: vars.currentRoot.dom,
213
204
  props: vars.currentRoot.props,
214
205
  alternate: vars.currentRoot,
215
- }
216
- vars.nextUnitOfWork = vars.wipRoot
217
- vars.deletions = []
218
- }
206
+ };
207
+ vars.nextUnitOfWork = vars.wipRoot;
208
+ vars.deletions = [];
209
+ };
219
210
 
220
- vars.wipFiber.hooks.push(hook)
221
- vars.hookIndex++
211
+ vars.wipFiber.hooks.push(hook);
212
+ vars.hookIndex++;
222
213
  return [hook.state, setState]
223
- }
214
+ };
224
215
 
225
216
  /**
226
217
  * This is a function that creates a hook for managing side effects in Ryunix components.
@@ -235,66 +226,66 @@
235
226
  const oldHook =
236
227
  vars.wipFiber.alternate &&
237
228
  vars.wipFiber.alternate.hooks &&
238
- vars.wipFiber.alternate.hooks[vars.hookIndex]
229
+ vars.wipFiber.alternate.hooks[vars.hookIndex];
239
230
 
240
- const hasChanged = hasDepsChanged(oldHook ? oldHook.deps : undefined, deps)
231
+ const hasChanged = hasDepsChanged(oldHook ? oldHook.deps : undefined, deps);
241
232
 
242
233
  const hook = {
243
234
  tag: RYUNIX_TYPES.RYUNIX_EFFECT,
244
235
  effect: hasChanged ? effect : null,
245
236
  cancel: hasChanged && oldHook && oldHook.cancel,
246
237
  deps,
247
- }
238
+ };
248
239
 
249
- vars.wipFiber.hooks.push(hook)
250
- vars.hookIndex++
251
- }
240
+ vars.wipFiber.hooks.push(hook);
241
+ vars.hookIndex++;
242
+ };
252
243
 
253
244
  const useQuery = () => {
254
- vars.hookIndex++
245
+ vars.hookIndex++;
255
246
 
256
247
  const oldHook =
257
248
  vars.wipFiber.alternate &&
258
249
  vars.wipFiber.alternate.hooks &&
259
- vars.wipFiber.alternate.hooks[vars.hookIndex]
250
+ vars.wipFiber.alternate.hooks[vars.hookIndex];
260
251
 
261
- const hasOld = oldHook ? oldHook : undefined
252
+ const hasOld = oldHook ? oldHook : undefined;
262
253
 
263
- const urlSearchParams = new URLSearchParams(window.location.search)
264
- const params = Object.fromEntries(urlSearchParams.entries())
265
- const Query = hasOld ? hasOld : params
254
+ const urlSearchParams = new URLSearchParams(window.location.search);
255
+ const params = Object.fromEntries(urlSearchParams.entries());
256
+ const Query = hasOld ? hasOld : params;
266
257
 
267
258
  const hook = {
268
259
  tag: RYUNIX_TYPES.RYUNIX_EFFECT,
269
260
  query: Query,
270
- }
261
+ };
271
262
 
272
- vars.wipFiber.hooks.push(hook)
263
+ vars.wipFiber.hooks.push(hook);
273
264
 
274
265
  return hook.query
275
- }
266
+ };
276
267
 
277
268
  const Router = ({ path, component }) => {
278
- const [currentPath, setCurrentPath] = useStore(window.location.pathname)
269
+ const [currentPath, setCurrentPath] = useStore(window.location.pathname);
279
270
 
280
271
  useEffect(() => {
281
272
  const onLocationChange = () => {
282
- setCurrentPath(() => window.location.pathname)
283
- }
273
+ setCurrentPath(() => window.location.pathname);
274
+ };
284
275
 
285
- window.addEventListener('navigate', onLocationChange)
286
- window.addEventListener('pushsatate', onLocationChange)
287
- window.addEventListener('popstate', onLocationChange)
276
+ window.addEventListener('navigate', onLocationChange);
277
+ window.addEventListener('pushsatate', onLocationChange);
278
+ window.addEventListener('popstate', onLocationChange);
288
279
 
289
280
  return () => {
290
- window.removeEventListener('navigate', onLocationChange)
291
- window.removeEventListener('pushsatate', onLocationChange)
292
- window.removeEventListener('popstate', onLocationChange)
281
+ window.removeEventListener('navigate', onLocationChange);
282
+ window.removeEventListener('pushsatate', onLocationChange);
283
+ window.removeEventListener('popstate', onLocationChange);
293
284
  }
294
- }, [currentPath])
285
+ }, [currentPath]);
295
286
 
296
287
  return currentPath === path ? component() : null
297
- }
288
+ };
298
289
 
299
290
  const Navigate = (props) => {
300
291
  if (props.style) {
@@ -316,24 +307,24 @@
316
307
  throw new Error("Missig 'to' param.")
317
308
  }
318
309
  const preventReload = (event) => {
319
- event.preventDefault()
310
+ event.preventDefault();
320
311
  if (window.location.pathname !== props.to) {
321
- window.history.pushState({}, '', props.to)
322
- const navigationEvent = new Event('pushsatate')
323
- window.dispatchEvent(navigationEvent)
312
+ window.history.pushState({}, '', props.to);
313
+ const navigationEvent = new Event('pushsatate');
314
+ window.dispatchEvent(navigationEvent);
324
315
  }
325
- }
316
+ };
326
317
 
327
318
  const anchor = {
328
319
  href: props.to,
329
320
  onClick: preventReload,
330
321
  ...props,
331
- }
322
+ };
332
323
 
333
- const children = props.label ? props.label : props.children
324
+ const children = props.label ? props.label : props.children;
334
325
 
335
326
  return createElement('a', anchor, children)
336
- }
327
+ };
337
328
 
338
329
  /**
339
330
  * The function creates a new DOM element based on the given fiber object and updates its properties.
@@ -349,12 +340,12 @@
349
340
  const dom =
350
341
  fiber.type == RYUNIX_TYPES.TEXT_ELEMENT
351
342
  ? document.createTextNode('')
352
- : document.createElement(fiber.type)
343
+ : document.createElement(fiber.type);
353
344
 
354
- updateDom(dom, {}, fiber.props)
345
+ updateDom(dom, {}, fiber.props);
355
346
 
356
347
  return dom
357
- }
348
+ };
358
349
 
359
350
  /**
360
351
  * The function updates the DOM by removing old event listeners and properties, and adding new ones
@@ -366,74 +357,72 @@
366
357
  const updateDom = (dom, prevProps, nextProps) => {
367
358
  Object.keys(prevProps)
368
359
  .filter(isEvent)
369
- .filter(
370
- (key) => isGone(nextProps)(key) || isNew(prevProps, nextProps)(key),
371
- )
360
+ .filter((key) => isGone(nextProps)(key) || isNew(prevProps, nextProps)(key))
372
361
  .forEach((name) => {
373
- const eventType = name.toLowerCase().substring(2)
374
- dom.removeEventListener(eventType, prevProps[name])
375
- })
362
+ const eventType = name.toLowerCase().substring(2);
363
+ dom.removeEventListener(eventType, prevProps[name]);
364
+ });
376
365
 
377
366
  Object.keys(prevProps)
378
367
  .filter(isProperty)
379
368
  .filter(isGone(nextProps))
380
369
  .forEach((name) => {
381
- dom[name] = ''
382
- })
370
+ dom[name] = '';
371
+ });
383
372
 
384
373
  Object.keys(nextProps)
385
374
  .filter(isProperty)
386
375
  .filter(isNew(prevProps, nextProps))
387
376
  .forEach((name) => {
388
377
  if (name === STRINGS.style) {
389
- DomStyle(dom, nextProps.style)
378
+ DomStyle(dom, nextProps.style);
390
379
  } else if (name === STRINGS.className) {
391
380
  if (nextProps.className === '') {
392
381
  throw new Error('className cannot be empty.')
393
382
  }
394
383
  prevProps.className &&
395
- dom.classList.remove(...prevProps.className.split(/\s+/))
396
- dom.classList.add(...nextProps.className.split(/\s+/))
384
+ dom.classList.remove(...prevProps.className.split(/\s+/));
385
+ dom.classList.add(...nextProps.className.split(/\s+/));
397
386
  } else {
398
- dom[name] = nextProps[name]
387
+ dom[name] = nextProps[name];
399
388
  }
400
- })
389
+ });
401
390
 
402
391
  Object.keys(nextProps)
403
392
  .filter(isEvent)
404
393
  .filter(isNew(prevProps, nextProps))
405
394
  .forEach((name) => {
406
- const eventType = name.toLowerCase().substring(2)
407
- dom.addEventListener(eventType, nextProps[name])
408
- })
409
- }
395
+ const eventType = name.toLowerCase().substring(2);
396
+ dom.addEventListener(eventType, nextProps[name]);
397
+ });
398
+ };
410
399
 
411
400
  const DomStyle = (dom, style) => {
412
401
  dom.style = Object.keys(style).reduce((acc, styleName) => {
413
402
  const key = styleName.replace(reg, function (v) {
414
403
  return '-' + v.toLowerCase()
415
- })
416
- acc += `${key}: ${style[styleName]};`
404
+ });
405
+ acc += `${key}: ${style[styleName]};`;
417
406
  return acc
418
- }, '')
419
- }
407
+ }, '');
408
+ };
420
409
 
421
- var Dom = /*#__PURE__*/ Object.freeze({
410
+ var Dom = /*#__PURE__*/Object.freeze({
422
411
  __proto__: null,
423
412
  DomStyle: DomStyle,
424
413
  createDom: createDom,
425
- updateDom: updateDom,
426
- })
414
+ updateDom: updateDom
415
+ });
427
416
 
428
417
  /**
429
418
  * The function commits changes made to the virtual DOM to the actual DOM.
430
419
  */
431
420
  const commitRoot = () => {
432
- vars.deletions.forEach(commitWork)
433
- commitWork(vars.wipRoot.child)
434
- vars.currentRoot = vars.wipRoot
435
- vars.wipRoot = null
436
- }
421
+ vars.deletions.forEach(commitWork);
422
+ commitWork(vars.wipRoot.child);
423
+ vars.currentRoot = vars.wipRoot;
424
+ vars.wipRoot = null;
425
+ };
437
426
 
438
427
  /**
439
428
  * The function commits changes made to the DOM based on the effect tag of the fiber.
@@ -447,32 +436,32 @@
447
436
  return
448
437
  }
449
438
 
450
- let domParentFiber = fiber.parent
439
+ let domParentFiber = fiber.parent;
451
440
  while (!domParentFiber.dom) {
452
- domParentFiber = domParentFiber.parent
441
+ domParentFiber = domParentFiber.parent;
453
442
  }
454
- const domParent = domParentFiber.dom
443
+ const domParent = domParentFiber.dom;
455
444
 
456
445
  if (fiber.effectTag === EFFECT_TAGS.PLACEMENT) {
457
446
  if (fiber.dom != null) {
458
- domParent.appendChild(fiber.dom)
447
+ domParent.appendChild(fiber.dom);
459
448
  }
460
- runEffects(fiber)
449
+ runEffects(fiber);
461
450
  } else if (fiber.effectTag === EFFECT_TAGS.UPDATE) {
462
- cancelEffects(fiber)
451
+ cancelEffects(fiber);
463
452
  if (fiber.dom != null) {
464
- updateDom(fiber.dom, fiber.alternate.props, fiber.props)
453
+ updateDom(fiber.dom, fiber.alternate.props, fiber.props);
465
454
  }
466
- runEffects(fiber)
455
+ runEffects(fiber);
467
456
  } else if (fiber.effectTag === EFFECT_TAGS.DELETION) {
468
- cancelEffects(fiber)
469
- commitDeletion(fiber, domParent)
457
+ cancelEffects(fiber);
458
+ commitDeletion(fiber, domParent);
470
459
  return
471
460
  }
472
461
 
473
- commitWork(fiber.child)
474
- commitWork(fiber.sibling)
475
- }
462
+ commitWork(fiber.child);
463
+ commitWork(fiber.sibling);
464
+ };
476
465
 
477
466
  /**
478
467
  * The function removes a fiber's corresponding DOM node from its parent node or recursively removes
@@ -483,18 +472,18 @@
483
472
  */
484
473
  const commitDeletion = (fiber, domParent) => {
485
474
  if (fiber.dom) {
486
- domParent.removeChild(fiber.dom)
475
+ domParent.removeChild(fiber.dom);
487
476
  } else {
488
- commitDeletion(fiber.child, domParent)
477
+ commitDeletion(fiber.child, domParent);
489
478
  }
490
- }
479
+ };
491
480
 
492
- var Commits = /*#__PURE__*/ Object.freeze({
481
+ var Commits = /*#__PURE__*/Object.freeze({
493
482
  __proto__: null,
494
483
  commitDeletion: commitDeletion,
495
484
  commitRoot: commitRoot,
496
- commitWork: commitWork,
497
- })
485
+ commitWork: commitWork
486
+ });
498
487
 
499
488
  /**
500
489
  * This function reconciles the children of a fiber node with a new set of elements, creating new
@@ -506,15 +495,15 @@
506
495
  * fiber's subtree
507
496
  */
508
497
  const reconcileChildren = (wipFiber, elements) => {
509
- let index = 0
510
- let oldFiber = wipFiber.alternate && wipFiber.alternate.child
511
- let prevSibling
498
+ let index = 0;
499
+ let oldFiber = wipFiber.alternate && wipFiber.alternate.child;
500
+ let prevSibling;
512
501
 
513
502
  while (index < elements.length || oldFiber != null) {
514
- const element = elements[index]
515
- let newFiber
503
+ const element = elements[index];
504
+ let newFiber;
516
505
 
517
- const sameType = oldFiber && element && element.type == oldFiber.type
506
+ const sameType = oldFiber && element && element.type == oldFiber.type;
518
507
 
519
508
  if (sameType) {
520
509
  newFiber = {
@@ -524,7 +513,7 @@
524
513
  parent: wipFiber,
525
514
  alternate: oldFiber,
526
515
  effectTag: EFFECT_TAGS.UPDATE,
527
- }
516
+ };
528
517
  }
529
518
  if (element && !sameType) {
530
519
  newFiber = {
@@ -534,32 +523,32 @@
534
523
  parent: wipFiber,
535
524
  alternate: null,
536
525
  effectTag: EFFECT_TAGS.PLACEMENT,
537
- }
526
+ };
538
527
  }
539
528
  if (oldFiber && !sameType) {
540
- oldFiber.effectTag = EFFECT_TAGS.DELETION
541
- vars.deletions.push(oldFiber)
529
+ oldFiber.effectTag = EFFECT_TAGS.DELETION;
530
+ vars.deletions.push(oldFiber);
542
531
  }
543
532
 
544
533
  if (oldFiber) {
545
- oldFiber = oldFiber.sibling
534
+ oldFiber = oldFiber.sibling;
546
535
  }
547
536
 
548
537
  if (index === 0) {
549
- wipFiber.child = newFiber
538
+ wipFiber.child = newFiber;
550
539
  } else if (element) {
551
- prevSibling.sibling = newFiber
540
+ prevSibling.sibling = newFiber;
552
541
  }
553
542
 
554
- prevSibling = newFiber
555
- index++
543
+ prevSibling = newFiber;
544
+ index++;
556
545
  }
557
- }
546
+ };
558
547
 
559
- var Reconciler = /*#__PURE__*/ Object.freeze({
548
+ var Reconciler = /*#__PURE__*/Object.freeze({
560
549
  __proto__: null,
561
- reconcileChildren: reconcileChildren,
562
- })
550
+ reconcileChildren: reconcileChildren
551
+ });
563
552
 
564
553
  /**
565
554
  * This function updates a function component by setting up a work-in-progress fiber, resetting the
@@ -569,12 +558,12 @@
569
558
  * used to update the state of the component and its children.
570
559
  */
571
560
  const updateFunctionComponent = (fiber) => {
572
- vars.wipFiber = fiber
573
- vars.hookIndex = 0
574
- vars.wipFiber.hooks = []
575
- const children = [fiber.type(fiber.props)]
576
- reconcileChildren(fiber, children)
577
- }
561
+ vars.wipFiber = fiber;
562
+ vars.hookIndex = 0;
563
+ vars.wipFiber.hooks = [];
564
+ const children = [fiber.type(fiber.props)];
565
+ reconcileChildren(fiber, children);
566
+ };
578
567
 
579
568
  /**
580
569
  * This function updates a host component's DOM element and reconciles its children.
@@ -584,16 +573,16 @@
584
573
  */
585
574
  const updateHostComponent = (fiber) => {
586
575
  if (!fiber.dom) {
587
- fiber.dom = createDom(fiber)
576
+ fiber.dom = createDom(fiber);
588
577
  }
589
- reconcileChildren(fiber, fiber.props.children.flat())
590
- }
578
+ reconcileChildren(fiber, fiber.props.children.flat());
579
+ };
591
580
 
592
- var Components = /*#__PURE__*/ Object.freeze({
581
+ var Components = /*#__PURE__*/Object.freeze({
593
582
  __proto__: null,
594
583
  updateFunctionComponent: updateFunctionComponent,
595
- updateHostComponent: updateHostComponent,
596
- })
584
+ updateHostComponent: updateHostComponent
585
+ });
597
586
 
598
587
  /**
599
588
  * This function uses requestIdleCallback to perform work on a fiber tree until it is complete or the
@@ -604,20 +593,20 @@
604
593
  * is used to determine
605
594
  */
606
595
  const workLoop = (deadline) => {
607
- let shouldYield = false
596
+ let shouldYield = false;
608
597
  while (vars.nextUnitOfWork && !shouldYield) {
609
- vars.nextUnitOfWork = performUnitOfWork(vars.nextUnitOfWork)
610
- shouldYield = deadline.timeRemaining() < 1
598
+ vars.nextUnitOfWork = performUnitOfWork(vars.nextUnitOfWork);
599
+ shouldYield = deadline.timeRemaining() < 1;
611
600
  }
612
601
 
613
602
  if (!vars.nextUnitOfWork && vars.wipRoot) {
614
- commitRoot()
603
+ commitRoot();
615
604
  }
616
605
 
617
- requestIdleCallback(workLoop)
618
- }
606
+ requestIdleCallback(workLoop);
607
+ };
619
608
 
620
- requestIdleCallback(workLoop)
609
+ requestIdleCallback(workLoop);
621
610
 
622
611
  /**
623
612
  * The function performs a unit of work by updating either a function component or a host component and
@@ -632,29 +621,29 @@
632
621
  * sibling of the parent. The function returns `null` if there are no more fibers to process.
633
622
  */
634
623
  const performUnitOfWork = (fiber) => {
635
- const isFunctionComponent = fiber.type instanceof Function
624
+ const isFunctionComponent = fiber.type instanceof Function;
636
625
  if (isFunctionComponent) {
637
- updateFunctionComponent(fiber)
626
+ updateFunctionComponent(fiber);
638
627
  } else {
639
- updateHostComponent(fiber)
628
+ updateHostComponent(fiber);
640
629
  }
641
630
  if (fiber.child) {
642
631
  return fiber.child
643
632
  }
644
- let nextFiber = fiber
633
+ let nextFiber = fiber;
645
634
  while (nextFiber) {
646
635
  if (nextFiber.sibling) {
647
636
  return nextFiber.sibling
648
637
  }
649
- nextFiber = nextFiber.parent
638
+ nextFiber = nextFiber.parent;
650
639
  }
651
- }
640
+ };
652
641
 
653
- var Workers = /*#__PURE__*/ Object.freeze({
642
+ var Workers = /*#__PURE__*/Object.freeze({
654
643
  __proto__: null,
655
644
  performUnitOfWork: performUnitOfWork,
656
- workLoop: workLoop,
657
- })
645
+ workLoop: workLoop
646
+ });
658
647
 
659
648
  var Ryunix = {
660
649
  createElement,
@@ -666,17 +655,18 @@
666
655
  Reconciler,
667
656
  Components,
668
657
  Commits,
669
- }
658
+ };
659
+
660
+ window.Ryunix = Ryunix;
670
661
 
671
- window.Ryunix = Ryunix
662
+ exports.Fragments = Fragments;
663
+ exports.Navigate = Navigate;
664
+ exports.Router = Router;
665
+ exports.default = Ryunix;
666
+ exports.useEffect = useEffect;
667
+ exports.useQuery = useQuery;
668
+ exports.useStore = useStore;
672
669
 
673
- exports.Fragments = Fragments
674
- exports.Navigate = Navigate
675
- exports.Router = Router
676
- exports.default = Ryunix
677
- exports.useEffect = useEffect
678
- exports.useQuery = useQuery
679
- exports.useStore = useStore
670
+ Object.defineProperty(exports, '__esModule', { value: true });
680
671
 
681
- Object.defineProperty(exports, '__esModule', { value: true })
682
- })
672
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsetsoft/ryunixjs",
3
- "version": "0.4.10",
3
+ "version": "0.4.11-nightly.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/Ryunix.js",
6
6
  "private": false,
@@ -10,7 +10,7 @@
10
10
  "homepage": "https://github.com/UnSetSoft/Ryunixjs#readme",
11
11
  "scripts": {
12
12
  "build": "rollup ./src/main.js --file ./dist/Ryunix.js --format umd --name Ryunix",
13
- "prepublish": "npm run build",
13
+ "prepublishOnly": "npm run build",
14
14
  "postinstall": "npm run build",
15
15
  "nightly:release": "npm publish --tag nightly",
16
16
  "release": "npm publish"
@@ -27,4 +27,4 @@
27
27
  "publishConfig": {
28
28
  "registry": "https://registry.npmjs.org"
29
29
  }
30
- }
30
+ }