rumious 2.1.5 → 2.1.6

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.
@@ -1,6 +1,7 @@
1
1
  import { RumiousTemplate } from '../types/index.js';
2
2
  import { RumiousRenderContext, RumiousViewControl } from '../render/index.js';
3
3
  import { RumiousApp } from '../app/index.js';
4
+ import { RumiousRef } from '../ref/index.js';
4
5
  export declare class RumiousComponent<T = any> {
5
6
  props: T;
6
7
  app: RumiousApp;
@@ -19,6 +20,7 @@ export declare class RumiousComponent<T = any> {
19
20
  onRender(): void;
20
21
  onDestroy(): void;
21
22
  beforeRender(): void;
23
+ renderTo(target: HTMLElement | RumiousRef, template: RumiousTemplate): void;
22
24
  }
23
25
  export declare class Fragment extends RumiousComponent<any> {
24
26
  }
package/dist/index.js CHANGED
@@ -470,95 +470,6 @@ function createStore(value) {
470
470
  return new RumiousStore(value);
471
471
  }
472
472
 
473
- class RumiousComponent {
474
- props;
475
- app;
476
- element;
477
- context;
478
- slot = null;
479
- static tagName = 'rumious-component';
480
- constructor() { }
481
- createViewControl() {
482
- return createViewControl();
483
- }
484
- mountTo(template, target) {
485
- return render(template, target, this.context);
486
- }
487
- prepare(props, context, element) {
488
- this.app = context.app;
489
- this.element = element;
490
- this.props = props;
491
- this.context = new RumiousRenderContext(context.app, this);
492
- }
493
- template() {
494
- throw new Error(`RumiousRenderError: Cannot render empty component !`);
495
- }
496
- requestRender() {
497
- let template = this.template();
498
- render(template, this.element, this.context);
499
- }
500
- remove() {
501
- this.element.remove();
502
- }
503
- onCreate() { }
504
- onRender() { }
505
- onDestroy() { }
506
- beforeRender() { }
507
- }
508
- class Fragment extends RumiousComponent {
509
- }
510
-
511
- class RumiousComponentElement extends HTMLElement {
512
- component;
513
- props;
514
- context;
515
- instance;
516
- slotTempl = null;
517
- constructor() {
518
- super();
519
- }
520
- setContext(context) {
521
- this.context = context;
522
- }
523
- async connectedCallback() {
524
- let instance = new this.component();
525
- this.instance = instance;
526
- this.instance.slot = this.slotTempl;
527
- instance.prepare(this.props, this.context, this);
528
- instance.onCreate();
529
- await instance.beforeRender();
530
- instance.requestRender();
531
- instance.onRender();
532
- }
533
- disconnectedCallback() {
534
- this.instance.onDestroy();
535
- }
536
- setSlot(templ) {
537
- this.slotTempl = templ;
538
- }
539
- }
540
- function createComponentElement(context, component, props) {
541
- if (!window.customElements.get(component.tagName)) {
542
- window.customElements.define(component.tagName, class extends RumiousComponentElement {
543
- });
544
- }
545
- const element = document.createElement(component.tagName);
546
- element.component = component;
547
- element.props = props;
548
- element.context = context;
549
- return [element];
550
- }
551
- function renderComponent(component, props) {
552
- if (!window.customElements.get(component.tagName)) {
553
- window.customElements.define(component.tagName, class extends RumiousComponentElement {
554
- });
555
- }
556
- const element = document.createElement(component.tagName);
557
- element.component = component;
558
- element.props = props;
559
- return element;
560
- }
561
-
562
473
  class RumiousRef {
563
474
  element;
564
475
  _mounted = false;
@@ -706,6 +617,103 @@ function createRef() {
706
617
  return new RumiousRef();
707
618
  }
708
619
 
620
+ class RumiousComponent {
621
+ props;
622
+ app;
623
+ element;
624
+ context;
625
+ slot = null;
626
+ static tagName = 'rumious-component';
627
+ constructor() { }
628
+ createViewControl() {
629
+ return createViewControl();
630
+ }
631
+ mountTo(template, target) {
632
+ return render(template, target, this.context);
633
+ }
634
+ prepare(props, context, element) {
635
+ this.app = context.app;
636
+ this.element = element;
637
+ this.props = props;
638
+ this.context = new RumiousRenderContext(context.app, this);
639
+ }
640
+ template() {
641
+ throw new Error(`RumiousRenderError: Cannot render empty component !`);
642
+ }
643
+ requestRender() {
644
+ let template = this.template();
645
+ render(template, this.element, this.context);
646
+ }
647
+ remove() {
648
+ this.element.remove();
649
+ }
650
+ onCreate() { }
651
+ onRender() { }
652
+ onDestroy() { }
653
+ beforeRender() { }
654
+ renderTo(target, template) {
655
+ if (target instanceof HTMLElement) {
656
+ render(template, target, this.context);
657
+ }
658
+ else if (target instanceof RumiousRef && target.isMounted()) {
659
+ render(template, target.element, this.context);
660
+ }
661
+ }
662
+ }
663
+ class Fragment extends RumiousComponent {
664
+ }
665
+
666
+ class RumiousComponentElement extends HTMLElement {
667
+ component;
668
+ props;
669
+ context;
670
+ instance;
671
+ slotTempl = null;
672
+ constructor() {
673
+ super();
674
+ }
675
+ setContext(context) {
676
+ this.context = context;
677
+ }
678
+ async connectedCallback() {
679
+ let instance = new this.component();
680
+ this.instance = instance;
681
+ this.instance.slot = this.slotTempl;
682
+ instance.prepare(this.props, this.context, this);
683
+ instance.onCreate();
684
+ await instance.beforeRender();
685
+ instance.requestRender();
686
+ instance.onRender();
687
+ }
688
+ disconnectedCallback() {
689
+ this.instance.onDestroy();
690
+ }
691
+ setSlot(templ) {
692
+ this.slotTempl = templ;
693
+ }
694
+ }
695
+ function createComponentElement(context, component, props) {
696
+ if (!window.customElements.get(component.tagName)) {
697
+ window.customElements.define(component.tagName, class extends RumiousComponentElement {
698
+ });
699
+ }
700
+ const element = document.createElement(component.tagName);
701
+ element.component = component;
702
+ element.props = props;
703
+ element.context = context;
704
+ return [element];
705
+ }
706
+ function renderComponent(component, props) {
707
+ if (!window.customElements.get(component.tagName)) {
708
+ window.customElements.define(component.tagName, class extends RumiousComponentElement {
709
+ });
710
+ }
711
+ const element = document.createElement(component.tagName);
712
+ element.component = component;
713
+ element.props = props;
714
+ return element;
715
+ }
716
+
709
717
  function appendChild(parent, node) {
710
718
  if (typeof node === 'string')
711
719
  parent.appendChild(document.createTextNode(node));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rumious",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "start": "NODE_ENV=production node dist/index.js",
19
19
  "dev": "NODE_ENV=development node dist/index.js",
20
20
  "test": "echo \"No tests yet\"",
21
- "prepublishOnly": "npm run dec && npm run build"
21
+ "prepublishOnly": "npm run build"
22
22
  },
23
23
  "keywords": [
24
24
  "rumious",
package/dist/app/app.js DELETED
@@ -1,20 +0,0 @@
1
- import { RumiousRenderContext, render } from '../render/index.js';
2
- export class RumiousApp {
3
- config;
4
- modules = [];
5
- context = new RumiousRenderContext(this, this);
6
- constructor(config) {
7
- this.config = config;
8
- }
9
- addModule(ModuleClass, options) {
10
- const instance = ModuleClass.init(this, options);
11
- this.modules.push(instance);
12
- return instance;
13
- }
14
- render(content) {
15
- render(content, this.config.root, this.context);
16
- }
17
- }
18
- export function createApp(config) {
19
- return new RumiousApp(config);
20
- }
package/dist/app/index.js DELETED
@@ -1 +0,0 @@
1
- export * from './app.js';
@@ -1,38 +0,0 @@
1
- import { RumiousRenderContext, render, createViewControl } from '../render/index.js';
2
- export class RumiousComponent {
3
- props;
4
- app;
5
- element;
6
- context;
7
- slot = null;
8
- static tagName = 'rumious-component';
9
- constructor() { }
10
- createViewControl() {
11
- return createViewControl();
12
- }
13
- mountTo(template, target) {
14
- return render(template, target, this.context);
15
- }
16
- prepare(props, context, element) {
17
- this.app = context.app;
18
- this.element = element;
19
- this.props = props;
20
- this.context = new RumiousRenderContext(context.app, this);
21
- }
22
- template() {
23
- throw new Error(`RumiousRenderError: Cannot render empty component !`);
24
- }
25
- requestRender() {
26
- let template = this.template();
27
- render(template, this.element, this.context);
28
- }
29
- remove() {
30
- this.element.remove();
31
- }
32
- onCreate() { }
33
- onRender() { }
34
- onDestroy() { }
35
- beforeRender() { }
36
- }
37
- export class Fragment extends RumiousComponent {
38
- }
@@ -1,50 +0,0 @@
1
- export class RumiousComponentElement extends HTMLElement {
2
- component;
3
- props;
4
- context;
5
- instance;
6
- slotTempl = null;
7
- constructor() {
8
- super();
9
- }
10
- setContext(context) {
11
- this.context = context;
12
- }
13
- async connectedCallback() {
14
- let instance = new this.component();
15
- this.instance = instance;
16
- this.instance.slot = this.slotTempl;
17
- instance.prepare(this.props, this.context, this);
18
- instance.onCreate();
19
- await instance.beforeRender();
20
- instance.requestRender();
21
- instance.onRender();
22
- }
23
- disconnectedCallback() {
24
- this.instance.onDestroy();
25
- }
26
- setSlot(templ) {
27
- this.slotTempl = templ;
28
- }
29
- }
30
- export function createComponentElement(context, component, props) {
31
- if (!window.customElements.get(component.tagName)) {
32
- window.customElements.define(component.tagName, class extends RumiousComponentElement {
33
- });
34
- }
35
- const element = document.createElement(component.tagName);
36
- element.component = component;
37
- element.props = props;
38
- element.context = context;
39
- return [element];
40
- }
41
- export function renderComponent(component, props) {
42
- if (!window.customElements.get(component.tagName)) {
43
- window.customElements.define(component.tagName, class extends RumiousComponentElement {
44
- });
45
- }
46
- const element = document.createElement(component.tagName);
47
- element.component = component;
48
- element.props = props;
49
- return element;
50
- }
@@ -1,2 +0,0 @@
1
- export * from './component.js';
2
- export * from './element.js';
package/dist/global.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/render/context.ts","../src/render/render.ts","../src/render/view.ts","../src/app/app.ts","../src/state/reactor.ts","../src/state/state.ts","../src/state/list.ts","../src/component/component.ts","../src/component/element.ts","../src/ref/ref.ts","../src/jsx/element.ts","../src/utils/checker.ts","../src/jsx/dynamic.ts","../src/jsx/template.ts","../src/jsx/component.ts","../src/module/index.ts","../src/index.ts"],"sourcesContent":["export class RumiousRenderContext {\n app;\n target;\n onRendered = [];\n constructor(app, target) {\n this.app = app;\n this.target = target;\n }\n}\n","export function render(content, container, context) {\n context.onRendered = [];\n let result = content(container, context);\n for (var i = 0; i < context.onRendered.length; i++) {\n context.onRendered[i]();\n }\n return result;\n}\n","import { render } from './render.js';\nexport class RumiousViewControl {\n targets = [];\n constructor() { }\n addTarget(target) {\n this.targets.push(target);\n }\n setView(template) {\n const targets = this.targets;\n if (targets.length === 0) {\n throw new Error(`RumiousRenderError: No target assigned to ViewControl`);\n }\n for (let i = 0; i < targets.length; i++) {\n render(template, targets[i].element, targets[i].context);\n }\n }\n each(callback) {\n for (let target of this.targets) {\n callback(target);\n }\n }\n emptyAll() {\n const targets = this.targets;\n for (let i = 0; i < targets.length; i++) {\n targets[i].element.textContent = '';\n }\n }\n empty(target) {\n const targets = this.targets;\n for (let i = 0; i < targets.length; i++) {\n if (targets[i].element === target) {\n target.textContent = '';\n return;\n }\n }\n }\n}\nexport function createViewControl() {\n return new RumiousViewControl();\n}\n","import { RumiousRenderContext, render } from '../render/index.js';\nexport class RumiousApp {\n config;\n modules = [];\n context = new RumiousRenderContext(this, this);\n constructor(config) {\n this.config = config;\n }\n addModule(ModuleClass, options) {\n const instance = ModuleClass.init(this, options);\n this.modules.push(instance);\n return instance;\n }\n render(content) {\n render(content, this.config.root, this.context);\n }\n}\nexport function createApp(config) {\n return new RumiousApp(config);\n}\n","export class RumiousReactor {\n target;\n bindings = [];\n internal = [];\n isUIBatch = true;\n scheduled = false;\n queuedCommits = [];\n constructor(target) {\n this.target = target;\n }\n addBinding(binding) {\n this.bindings.push(binding);\n }\n removeBinding(binding) {\n this.bindings = this.bindings.filter(b => b !== binding);\n }\n addInternalBinding(binding) {\n this.internal.push(binding);\n }\n removeInternalBinding(binding) {\n this.internal = this.internal.filter(b => b !== binding);\n }\n notify(commit) {\n for (const binding of this.bindings) {\n binding(commit);\n }\n if (this.isUIBatch) {\n this.scheduleInternalUpdate(commit);\n }\n else {\n for (const binding of this.internal) {\n binding(commit);\n }\n }\n }\n scheduleInternalUpdate(commit) {\n this.queuedCommits.push(commit);\n if (!this.scheduled) {\n this.scheduled = true;\n queueMicrotask(() => {\n this.flushInternal();\n });\n }\n }\n flushInternal() {\n const lastCommit = this.queuedCommits[this.queuedCommits.length - 1];\n for (const binding of this.internal) {\n binding(lastCommit); // chỉ gửi commit cuối cùng\n }\n this.queuedCommits = [];\n this.scheduled = false;\n }\n}\n","import { RumiousReactor } from './reactor.js';\nexport class RumiousState {\n value;\n reactor;\n constructor(value, reactor) {\n this.value = value;\n this.reactor = reactor;\n if (!this.reactor) {\n this.reactor = new RumiousReactor(this);\n }\n }\n set(value) {\n this.value = value;\n this.reactor?.notify({\n type: 'set',\n value: value,\n state: this\n });\n }\n get() {\n return this.value;\n }\n slientUpdate(value) {\n this.value = value;\n }\n update(updater) {\n this.set(updater(this.value));\n }\n toJSON() {\n return JSON.stringify(this.value);\n }\n trigger() {\n this.reactor?.notify({\n type: 'set',\n value: this.value,\n state: this\n });\n }\n}\nexport function createState(value) {\n return new RumiousState(value);\n}\nexport function watch(state, callback) {\n if (state.reactor)\n state.reactor.addBinding(callback);\n}\nexport function unwatch(state, callback) {\n if (state.reactor)\n state.reactor.removeBinding(callback);\n}\n","import { RumiousState } from './state.js';\nexport class RumiousListState extends RumiousState {\n value;\n reactor;\n constructor(value = [], reactor) {\n super(value, reactor);\n this.value = value;\n this.reactor = reactor;\n }\n append(value) {\n this.value.push(value);\n this.reactor?.notify({\n type: 'append',\n state: this,\n value\n });\n }\n prepend(value) {\n this.value.unshift(value);\n this.reactor?.notify({\n type: 'prepend',\n state: this,\n value\n });\n }\n insert(pos, value) {\n this.value.splice(pos, 0, value);\n this.reactor?.notify({\n type: 'insert',\n state: this,\n value,\n key: pos\n });\n }\n updateAt(pos, value) {\n this.value[pos] = value;\n this.reactor?.notify({\n type: 'update',\n state: this,\n value,\n key: pos\n });\n }\n remove(pos) {\n this.value.splice(pos, 1);\n this.reactor?.notify({\n type: 'remove',\n state: this,\n value: null,\n key: pos\n });\n }\n clear() {\n this.value.length = 0;\n this.reactor?.notify({\n type: 'set',\n state: this,\n value: []\n });\n }\n reverse() {\n this.value.reverse();\n this.reactor?.notify({\n type: 'set',\n state: this,\n value: this.value\n });\n }\n filter(predicate) {\n this.value = this.value.filter(predicate);\n this.reactor?.notify({\n type: 'set',\n state: this,\n value: this.value\n });\n }\n}\n","import { RumiousRenderContext, render } from '../render/index.js';\nexport class RumiousComponent {\n props;\n app;\n element;\n context;\n static tagName = 'rumious-component';\n constructor() { }\n mountTo(template, target) {\n return render(template, target, this.context);\n }\n prepare(props, context, element) {\n this.app = context.app;\n this.element = element;\n this.props = props;\n this.context = new RumiousRenderContext(context.app, this);\n }\n template() {\n throw new Error(`RumiousRenderError: Cannot render empty component !`);\n }\n requestRender() {\n let template = this.template();\n render(template, this.element, this.context);\n }\n remove() {\n this.element.remove();\n }\n onCreate() { }\n onRender() { }\n onDestroy() { }\n beforeRender() { }\n}\n","export class RumiousComponentElement extends HTMLElement {\n component;\n props;\n context;\n instance;\n constructor() {\n super();\n }\n setContext(context) {\n this.context = context;\n }\n async connectedCallback() {\n let instance = new this.component();\n this.instance = instance;\n instance.prepare(this.props, this.context, this);\n instance.onCreate();\n await instance.beforeRender();\n instance.requestRender();\n instance.onRender();\n }\n disconnectedCallback() {\n this.instance.onDestroy();\n }\n}\nexport function createComponentElement(context, component, props) {\n if (!window.customElements.get(component.tagName)) {\n window.customElements.define(component.tagName, class extends RumiousComponentElement {\n constructor() {\n super();\n this.component = component;\n this.props = props;\n this.context = context;\n }\n });\n }\n let element = document.createElement(component.tagName);\n return element;\n}\nexport function renderComponent(component, props) {\n if (!window.customElements.get(component.tagName)) {\n window.customElements.define(component.tagName, class extends RumiousComponentElement {\n constructor() {\n super();\n this.component = component;\n this.props = props;\n }\n });\n }\n let element = document.createElement(component.tagName);\n return element;\n}\n","import { RumiousComponentElement } from '../component/index.js';\nexport class RumiousRef {\n element;\n _mounted = false;\n _onMountCallbacks = [];\n _onUnmountCallbacks = [];\n constructor() { }\n setTarget(element) {\n this.element = element;\n this._mounted = true;\n for (const cb of this._onMountCallbacks) {\n cb(element);\n }\n }\n reset() {\n if (this._mounted) {\n for (const cb of this._onUnmountCallbacks) {\n cb();\n }\n }\n this.element = undefined;\n this._mounted = false;\n }\n get() {\n return this._mounted ? this.element : undefined;\n }\n isMounted() {\n return this._mounted;\n }\n has() {\n return this.isMounted();\n }\n onMount(cb) {\n this._onMountCallbacks.push(cb);\n if (this._mounted)\n cb(this.element);\n }\n onUnmount(cb) {\n this._onUnmountCallbacks.push(cb);\n }\n toString() {\n return `[RumiousRef ${this._mounted ? \"mounted\" : \"not mounted\"}]`;\n }\n focus() {\n this.assertMounted();\n this.element.focus();\n }\n addClass(className) {\n this.assertMounted();\n this.element.classList.add(className);\n }\n removeClass(className) {\n this.assertMounted();\n this.element.classList.remove(className);\n }\n toggleClass(className) {\n this.assertMounted();\n this.element.classList.toggle(className);\n }\n setAttr(key, value) {\n this.assertMounted();\n this.element.setAttribute(key, value);\n }\n removeAttr(key) {\n this.assertMounted();\n this.element.removeAttribute(key);\n }\n query(selector) {\n this.assertMounted();\n return this.element.querySelector(selector);\n }\n queryAll(selector) {\n this.assertMounted();\n return this.element.querySelectorAll(selector);\n }\n get value() {\n this.assertMounted();\n return 'value' in this.element ? this.element.value : undefined;\n }\n set value(val) {\n this.assertMounted();\n if ('value' in this.element) {\n this.element.value = val;\n }\n else {\n throw new Error(\"RumiousRefError: Element has no 'value' property.\");\n }\n }\n get text() {\n this.assertMounted();\n return this.element.textContent;\n }\n set text(val) {\n this.assertMounted();\n this.element.textContent = val;\n }\n get html() {\n this.assertMounted();\n return this.element.innerHTML;\n }\n set html(val) {\n this.assertMounted();\n this.element.innerHTML = val;\n }\n get checked() {\n this.assertMounted();\n return 'checked' in this.element ? Boolean(this.element.checked) : false;\n }\n set checked(val) {\n this.assertMounted();\n if ('checked' in this.element) {\n this.element.checked = val;\n }\n else {\n throw new Error(\"RumiousRefError: Element has no 'checked' property.\");\n }\n }\n get disabled() {\n this.assertMounted();\n return 'disabled' in this.element ? Boolean(this.element.disabled) : false;\n }\n set disabled(val) {\n this.assertMounted();\n if ('disabled' in this.element) {\n this.element.disabled = val;\n }\n else {\n throw new Error(\"RumiousRefError: Element has no 'disabled' property.\");\n }\n }\n get component() {\n if (this.element instanceof RumiousComponentElement) {\n return this.element.instance;\n }\n else {\n return null;\n }\n }\n assertMounted() {\n if (!this._mounted) {\n throw new Error(\"RumiousRefError: Element is not mounted.\");\n }\n }\n}\nexport function createRef() {\n return new RumiousRef();\n}\n","const nodeCache = new WeakMap();\nexport function resolveNode(root, path) {\n const key = path.join('.');\n let rootCache = nodeCache.get(root);\n if (!rootCache) {\n rootCache = new Map();\n nodeCache.set(root, rootCache);\n }\n if (rootCache.has(key)) {\n return rootCache.get(key);\n }\n let node;\n if (root instanceof DocumentFragment) {\n node = root.childNodes[0];\n }\n else {\n node = root;\n }\n for (let idx of path) {\n node = node.childNodes[idx];\n }\n rootCache.set(key, node);\n return node;\n}\nexport function replaceNode(oldNode, newNode) {\n const parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n else {\n console.warn('replaceNode: oldNode has no parent. Cannot replace.');\n }\n}\nexport function createEvent(target, name, callback) {\n if (!target.__rumiousEvents) {\n target.__rumiousEvents = {};\n }\n target.__rumiousEvents[name] = callback;\n}\nfunction triggerEvent(name, event) {\n const path = (event.composedPath?.() ?? [event.target]);\n for (const target of path) {\n if (target instanceof HTMLElement &&\n '__rumiousEvents' in target) {\n const element = target;\n const handler = element.__rumiousEvents?.[name];\n if (handler) {\n handler(event);\n break;\n }\n }\n }\n}\nexport function delegateEvents(events) {\n for (const name of events) {\n window.addEventListener(name, (e) => triggerEvent(name, e));\n }\n}\n","export function isTemplate(fn) {\n return typeof fn === 'function' && fn.__isTemplate === true;\n}\n","import { isTemplate } from '../utils/checker.js';\nimport { RumiousState } from '../state/index.js';\nimport { RumiousComponentElement } from '../component/index.js';\nfunction handleReactiveNode(node, value, context) {\n let currentNode = node;\n const update = () => {\n if (!document.contains(currentNode) && value.reactor) {\n value.reactor.removeBinding(update);\n return;\n }\n const newNode = value.value;\n if (newNode instanceof RumiousComponentElement) {\n newNode.setContext(context);\n }\n currentNode.parentNode?.replaceChild(newNode, currentNode);\n currentNode = newNode;\n };\n context.onRendered.push(() => {\n update();\n if (!value.reactor)\n return;\n value.reactor.addBinding(update);\n });\n return node;\n}\nfunction isPrimitive(value) {\n return value === null || (typeof value !== 'object' && typeof value !== 'function');\n}\nexport function createDynamicValue(context, value) {\n if (Array.isArray(value)) {\n const fragment = document.createDocumentFragment();\n for (const item of value) {\n if (isTemplate(item)) {\n const rendered = item(document.createDocumentFragment(), context);\n fragment.appendChild(rendered);\n }\n else if (isPrimitive(item)) {\n if (item !== null && item !== undefined && item !== false) {\n fragment.appendChild(document.createTextNode(String(item)));\n }\n }\n }\n return fragment;\n }\n if (isTemplate(value)) {\n return value(document.createDocumentFragment(), context);\n }\n if (value instanceof RumiousState && value.value instanceof Node) {\n return handleReactiveNode(document.createTextNode(''), value, context);\n }\n if (value instanceof RumiousState && value.reactor) {\n let node = document.createTextNode('');\n context.onRendered.push(() => {\n node.textContent = String(value.get());\n if (!value.reactor)\n return;\n value.reactor.addBinding((commit) => node.textContent = String(commit.state.get()));\n });\n return node;\n }\n if (isPrimitive(value) && value !== null && value !== undefined && value !== false) {\n return document.createTextNode(String(value));\n }\n return document.createTextNode('');\n}\n","import { RumiousRef } from '../ref/index.js';\nimport { createEvent } from './element.js';\nexport function createTemplate(fn) {\n return Object.assign(fn, {\n __isTemplate: true\n });\n}\nexport function html(h) {\n let template = document.createElement('template');\n template.innerHTML = h;\n return template.content.cloneNode(true);\n}\nexport const directives = {\n ref(context, modifier, target, value) {\n if (value instanceof RumiousRef) {\n value.setTarget(target);\n }\n else {\n throw new Error(\"Cannot setup element reference for non-RumiousRef object !\");\n }\n },\n model(context, modifier, element, state) {\n const tag = element.tagName, type = element.type;\n if (tag === \"TEXTAREA\") {\n element.addEventListener(\"input\", () => state.set(element.value));\n }\n else if (tag === \"SELECT\") {\n element.addEventListener(\"change\", () => {\n const s = element;\n state.set(s.multiple ? Array.from(s.selectedOptions).map(o => o.value) : s.value);\n });\n }\n else if (tag === \"INPUT\") {\n if (type === \"checkbox\") {\n element.addEventListener(\"change\", () => state.set(element.checked));\n }\n else if (type === \"radio\") {\n element.addEventListener(\"change\", () => {\n const i = element;\n if (i.checked)\n state.set(i.value);\n });\n }\n else if (type === \"file\") {\n element.addEventListener(\"change\", () => {\n const f = element.files;\n state.set(element.hasAttribute(\"multiple\") ? f : f?.[0] ?? null);\n });\n }\n else {\n element.addEventListener(\"input\", () => {\n const val = element.value;\n state.set(type === \"number\" ? (val === \"\" ? null : +val) : val);\n });\n }\n }\n },\n on(context, event, element, callback) {\n createEvent(element, event, callback);\n },\n bind(context, modifier, element, state) {\n let reactive = () => { };\n switch (modifier) {\n case 'text':\n reactive = () => { element.textContent = String(state.get()); };\n break;\n case 'html':\n reactive = () => { element.innerHTML = String(state.get()); };\n break;\n case 'style':\n reactive = () => {\n const styles = state.get();\n if (typeof styles === 'string') {\n element.setAttribute('style', styles);\n }\n else if (typeof styles === 'object') {\n Object.assign(element.style, styles);\n }\n };\n break;\n case 'class':\n reactive = () => {\n const cls = state.get();\n if (typeof cls === 'string')\n element.className = cls;\n else if (Array.isArray(cls))\n element.className = cls.join(' ');\n else if (typeof cls === 'object') {\n element.className = Object.entries(cls)\n .filter(([_, active]) => active)\n .map(([name]) => name)\n .join(' ');\n }\n };\n break;\n case 'disabled':\n reactive = () => {\n if ('disabled' in element)\n element.disabled = Boolean(state.get());\n };\n break;\n case 'checked':\n reactive = () => {\n if (element instanceof HTMLInputElement || element instanceof HTMLInputElement) {\n element.checked = Boolean(state.get());\n }\n };\n break;\n case 'value':\n reactive = () => {\n if ('value' in element)\n element.value = String(state.get());\n };\n break;\n default:\n throw new Error(`Unknown bind directive modifier: ${modifier}`);\n }\n function onStateChange(commit) {\n if (!document.contains(element) && state.reactor) {\n state.reactor.removeInternalBinding(onStateChange);\n return;\n }\n reactive();\n }\n context.onRendered.push(() => {\n reactive();\n if (!state.reactor)\n return;\n state.reactor.addInternalBinding(onStateChange);\n });\n },\n attr(context, attrName, element, state) {\n function onStateChange(commit) {\n if (!document.contains(element) && state.reactor) {\n state.reactor.removeInternalBinding(onStateChange);\n return;\n }\n element.setAttribute(attrName, String(state.get()));\n }\n context.onRendered.push(() => {\n onStateChange();\n if (!state.reactor)\n return;\n state.reactor.addInternalBinding(onStateChange);\n });\n },\n prop(context, name, element, state) {\n function onStateChange(commit) {\n if (!document.contains(element) && state.reactor) {\n state.reactor.removeInternalBinding(onStateChange);\n return;\n }\n element[name] = state.get();\n }\n context.onRendered.push(() => {\n onStateChange();\n if (!state.reactor)\n return;\n state.reactor.addInternalBinding(onStateChange);\n });\n },\n html(context, modifier, element, state) {\n function onStateChange(commit) {\n if (!document.contains(element) && state.reactor) {\n state.reactor.removeInternalBinding(onStateChange);\n return;\n }\n element.innerHTML = String(state.get());\n }\n context.onRendered.push(() => {\n onStateChange();\n if (!state.reactor)\n return;\n state.reactor.addInternalBinding(onStateChange);\n });\n },\n show(context, modifier, element, state) {\n function onStateChange(commit) {\n if (!document.contains(element) && state.reactor) {\n state.reactor.removeInternalBinding(onStateChange);\n return;\n }\n element.style.display = Boolean(state.get()) ? 'block' : 'none';\n }\n context.onRendered.push(() => {\n onStateChange();\n if (!state.reactor)\n return;\n state.reactor.addInternalBinding(onStateChange);\n });\n },\n hide(context, modifier, element, state) {\n function onStateChange(commit) {\n if (!document.contains(element) && state.reactor) {\n state.reactor.removeInternalBinding(onStateChange);\n return;\n }\n element.style.display = !Boolean(state.get()) ? 'block' : 'none';\n }\n context.onRendered.push(() => {\n onStateChange();\n if (!state.reactor)\n return;\n state.reactor.addInternalBinding(onStateChange);\n });\n }\n};\n// This is just to satisfy TypeScript's JSX requirement.\n// Rumious doesn't use createElement — we do things differently.\nfunction createElement(...args) {\n console.log(args);\n throw Error(`Rumious doesn't use createElement !`);\n}\n","import { createComponentElement } from '../component/index.js';\nexport function createComponent(context, component, props) {\n let element = createComponentElement(context, component, props);\n return element;\n}\n","export class RumiousModule {\n}\n","import './global.js';\nexport const __version__ = \"2.x\";\nexport * from './app/index.js';\nexport * from './types/index.js';\nexport * from './render/index.js';\nexport * from './state/index.js';\nexport * from './component/index.js';\nexport * from './ref/index.js';\nexport * from './jsx/index.js';\nexport * from './module/index.js';\n"],"names":[],"mappings":"AAAO,MAAM,oBAAoB,CAAC;AAClC,IAAI,GAAG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,SAAS,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE;AAC3D,IAAI,IAAI,OAAO,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC;AACnE,IAAI,OAAO,OAAO;AAClB;;ACJO,MAAM,aAAa,CAAC;AAC3B;;ACAY,MAAC,WAAW,GAAG;;;;"}
@@ -1,6 +0,0 @@
1
- import { createComponentElement } from '../component/index.js';
2
- export function createComponent(root, context, component, props) {
3
- let [element] = createComponentElement(context, component, props);
4
- root.appendChild(element);
5
- return [element];
6
- }
@@ -1,65 +0,0 @@
1
- import { isTemplate } from '../utils/checker.js';
2
- import { RumiousState } from '../state/index.js';
3
- import { RumiousComponentElement } from '../component/index.js';
4
- function handleReactiveNode(node, value, context) {
5
- let currentNode = node;
6
- const update = () => {
7
- if (!document.contains(currentNode) && value.reactor) {
8
- value.reactor.removeBinding(update);
9
- return;
10
- }
11
- const newNode = value.value;
12
- if (newNode instanceof RumiousComponentElement) {
13
- newNode.setContext(context);
14
- }
15
- currentNode.parentNode?.replaceChild(newNode, currentNode);
16
- currentNode = newNode;
17
- };
18
- context.onRendered.push(() => {
19
- update();
20
- if (!value.reactor)
21
- return;
22
- value.reactor.addBinding(update);
23
- });
24
- return node;
25
- }
26
- function isPrimitive(value) {
27
- return value === null || (typeof value !== 'object' && typeof value !== 'function');
28
- }
29
- export function createDynamicValue(context, value) {
30
- if (Array.isArray(value)) {
31
- const fragment = document.createDocumentFragment();
32
- for (const item of value) {
33
- if (isTemplate(item)) {
34
- const rendered = item(document.createDocumentFragment(), context);
35
- fragment.appendChild(rendered);
36
- }
37
- else if (isPrimitive(item)) {
38
- if (item !== null && item !== undefined && item !== false) {
39
- fragment.appendChild(document.createTextNode(String(item)));
40
- }
41
- }
42
- }
43
- return fragment;
44
- }
45
- if (isTemplate(value)) {
46
- return value(document.createDocumentFragment(), context);
47
- }
48
- if (value instanceof RumiousState && value.value instanceof Node) {
49
- return handleReactiveNode(document.createTextNode(''), value, context);
50
- }
51
- if (value instanceof RumiousState && value.reactor) {
52
- let node = document.createTextNode('');
53
- context.onRendered.push(() => {
54
- node.textContent = String(value.get());
55
- if (!value.reactor)
56
- return;
57
- value.reactor.addBinding((commit) => node.textContent = String(commit.state.get()));
58
- });
59
- return node;
60
- }
61
- if (isPrimitive(value) && value !== null && value !== undefined && value !== false) {
62
- return document.createTextNode(String(value));
63
- }
64
- return document.createTextNode('');
65
- }
@@ -1,50 +0,0 @@
1
- export function appendChild(parent, node) {
2
- if (typeof node === 'string')
3
- parent.appendChild(document.createTextNode(node));
4
- else
5
- parent.appendChild(node);
6
- }
7
- export function element(parent, tagName, attrs) {
8
- const el = document.createElement(tagName);
9
- if (attrs) {
10
- for (let key in attrs) {
11
- el.setAttribute(key, attrs[key]);
12
- }
13
- }
14
- parent.appendChild(el);
15
- return el;
16
- }
17
- export function replaceNode(oldNode, newNode) {
18
- const parent = oldNode.parentNode;
19
- if (parent) {
20
- parent.replaceChild(newNode, oldNode);
21
- }
22
- else {
23
- console.warn('replaceNode: oldNode has no parent. Cannot replace.');
24
- }
25
- }
26
- export function createEvent(target, name, callback) {
27
- if (!target.__rumiousEvents) {
28
- target.__rumiousEvents = {};
29
- }
30
- target.__rumiousEvents[name] = callback;
31
- }
32
- function triggerEvent(name, event) {
33
- const path = (event.composedPath?.() ?? [event.target]);
34
- for (const target of path) {
35
- if (target instanceof HTMLElement &&
36
- '__rumiousEvents' in target) {
37
- const element = target;
38
- const handler = element.__rumiousEvents?.[name];
39
- if (handler) {
40
- handler(event);
41
- break;
42
- }
43
- }
44
- }
45
- }
46
- export function delegateEvents(events) {
47
- for (const name of events) {
48
- window.addEventListener(name, (e) => triggerEvent(name, e));
49
- }
50
- }
package/dist/jsx/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from './element.js';
2
- export * from './dynamic.js';
3
- export * from './template.js';
4
- export * from './component.js';