Skip to content

Commit

Permalink
Update Inter to v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisPower1 committed Jan 5, 2024
1 parent 2f20ce7 commit e2247c3
Show file tree
Hide file tree
Showing 5 changed files with 3,303 additions and 46 deletions.
53 changes: 16 additions & 37 deletions inter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Interjs
* Version - 2.1.7
* Version - 2.2.0
* MIT LICENSED BY - Denis Power
* Repo - https://github.com/interjs/inter
* 2021 - 2023
* GENERATED BY INTER GLOBAL BUILDER
* 2021 - 2024
* GENERATED BY INTER BUILDER
*
*/

Expand Down Expand Up @@ -122,11 +122,6 @@
syErr("The first argument of [LIST REACTOR ].addItems must be an Array.");
}

function runOtherArrayDeprecationWarning() {
consW(`The "otherArray" property was deprecated since version 2.1.0,
use the "setEach" property instead.`);
}

function runInvalidTemplateReturnError() {
syErr(`The template function is not being returned inside the "do" method in
renderList(reactive listing), just return the template function.`);
Expand All @@ -152,7 +147,7 @@
err(`"${type}" is an unsupported request type in Ajax.`);
}

function runInvalidEventWarning(name) {
function runInvalidAjaxEventWarning(name) {
consW(`There's not any event named "${name}" in Ajax request.`);
}

Expand Down Expand Up @@ -416,10 +411,6 @@
return tag instanceof HTMLElement;
}

function isANode(target) {
return isDefined(target) && (target.nodeType == 1 || target.nodeType == 3);
}

function validDomEvent(eventName) {
return eventName in HTMLElement.prototype;
}
Expand Down Expand Up @@ -480,7 +471,7 @@
// WARNINGS HELPERS

function syErr(err) {
throw new SyntaxError(`Inter syntaxError : ${err}`);
throw new Error(`Inter syntaxError : ${err}`);
}

function err(e) {
Expand Down Expand Up @@ -2019,11 +2010,11 @@
function createArrayReactor(each, renderingSystem) {
if (isNotConfigurable(each)) runNotConfigurableArrayError();

const costumProps = new Set(["otherArray", "addItems", "setEach"]);
const customProps = new Set(["addItems", "setEach"]);

return new Proxy(each, {
set(target, prop, value, proxy) {
if (costumProps.has(prop)) {
if (customProps.has(prop)) {
Reflect.set(...arguments);
return true;
}
Expand Down Expand Up @@ -2449,7 +2440,7 @@
function renderList(options) {
function defineListReactor(each, renderingSystem, root) {
if (isArray(each)) {
defineCostumArrayProps(each);
defineCustomArrayProps(each);
return createArrayReactor(each, renderingSystem);
} else if (isObj(each)) {
return createObjReactor(each, renderingSystem, root);
Expand Down Expand Up @@ -2557,7 +2548,7 @@
Object.defineProperty(obj, prop, descriptiors);
}

function defineCostumArrayProps(array) {
function defineCustomArrayProps(array) {
if (hasReactiveSymbol(array)) return false;

function addItemsHandler(items, position) {
Expand All @@ -2580,22 +2571,10 @@
}
}

const costumProps = [
{ name: "otherArray", handler: setEachHandler },
{ name: "addItems", handler: addItemsHandler },
];

for (const { name, handler } of costumProps) {
if (name == "addItems") defineProp(array, name, { value: handler });
else
defineProp(array, name, {
set() {
if (name === "otherArray") runOtherArrayDeprecationWarning();

handler(...arguments);
},
});
}
const customProps = [{ name: "addItems", handler: addItemsHandler }];

for (const { name, handler } of customProps)
defineProp(array, name, { value: handler });
}

if (typeof each !== "number") proSetup();
Expand Down Expand Up @@ -3131,7 +3110,7 @@
handler(Arg);
};
}
} else runInvalidEventWarning(name);
} else runInvalidAjaxEventWarning(name);
});
}

Expand Down Expand Up @@ -3275,7 +3254,7 @@

req.onreadystatechange = function () {
if (this.readyState == 4) {
if (this.status == 200) {
if (this.status >= 200 && this.status < 300) {
if (responseHandlers.has("okay"))
responseHandlers.get("okay")(AjaxResponse);
} else {
Expand Down Expand Up @@ -3337,5 +3316,5 @@
window.template = template;
window.toAttrs = toAttrs;
window.Backend = Backend;
console.log("The global version 2.1.7 of Inter was loaded successfully.");
console.log("The global version 2.2.0 of Inter was loaded successfully.");
})();
Loading

0 comments on commit e2247c3

Please sign in to comment.