Skip to content

Commit fdc7519

Browse files
committed
Upgrade to v2.2.4
1 parent ecbcacb commit fdc7519

File tree

5 files changed

+63
-24
lines changed

5 files changed

+63
-24
lines changed

inter.js

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Interjs
3-
* Version - 2.2.3
3+
* Version - 2.2.4
44
* MIT LICENSED BY - Denis Power
55
* Repo - https://github.com/interjs/inter
66
* 2021 - 2024
@@ -221,9 +221,9 @@
221221
consW(`"${prop}" was not defined as a conditional property.`);
222222
}
223223

224-
function runTwoElseIfElementsCanNotHaveTheSamePropError(prop) {
224+
function runAlreadyUsedPropInConditionalGroupError(prop) {
225225
err(`
226-
Two elements with the "_elseIf" attribute can not have the same conditional property.
226+
Two elements in the conditional group can not have the same conditional property.
227227
Property: "${prop}"
228228
`);
229229
}
@@ -249,7 +249,11 @@
249249
element which has more than one conditional atribute, it's forbidden.`);
250250
}
251251

252-
function runNotDefinedIfNotPropWarning(child, _ifNot, data) {
252+
function runNotDefinedIfNotPropWarning(child, _ifNot /*propValue*/, data) {
253+
if (_ifNot.trim().length == 0) {
254+
runInvalidConditionalAttrs("_ifNot");
255+
return;
256+
}
253257
ParserWarning(`
254258
255259
The conditional rendering parser found
@@ -265,12 +269,23 @@
265269
`);
266270
}
267271

272+
function runInvalidConditionalAttrs(attrName) {
273+
ParserWarning(`The conditional rendering parser found an ${attrName} attribute that does not
274+
have a value assigned to it. Assign a value to the ${attrName} attribute.
275+
`);
276+
}
277+
268278
function runNotDefinedElseIfPropWarning(propValue) {
279+
if (propValue.trim().length == 0) {
280+
runInvalidConditionalAttrs("_elseIf");
281+
return;
282+
}
283+
269284
ParserWarning(`The conditional rendering parser found an element which has the "_elseIf"
270-
conditional property whose the value is: "${propValue}",
271-
but you did not define any conditional property with that name.
272-
273-
`);
285+
conditional property whose the value is: "${propValue}",
286+
but you did not define any conditional property with that name.
287+
288+
`);
274289
}
275290

276291
function runInvalidElseAttributeError() {
@@ -292,6 +307,10 @@
292307
}
293308

294309
function runNotDefinedIfPropWarning(propValue, child, data) {
310+
if (propValue.trim().length == 0) {
311+
runInvalidConditionalAttrs("_if");
312+
return;
313+
}
295314
ParserWarning(`
296315
The conditional rendering parser found
297316
an element which has the "_if" attribute and the value
@@ -1269,7 +1288,7 @@
12691288
if (!this.conditionalProps.has(prop)) {
12701289
this.elseIfs.add(elseIfOptions);
12711290
this.conditionalProps.add(prop);
1272-
} else runTwoElseIfElementsCanNotHaveTheSamePropError(prop);
1291+
} else runAlreadyUsedPropInConditionalGroupError(prop);
12731292
},
12741293

12751294
deleteData() {
@@ -3427,5 +3446,5 @@
34273446
window.template = template;
34283447
window.toAttrs = toAttrs;
34293448
window.Backend = Backend;
3430-
console.log("The global version 2.2.3 of Inter was loaded successfully.");
3449+
console.log("The global version 2.2.4 of Inter was loaded successfully.");
34313450
})();

inter.m.js

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
22
* Interjs
3-
* Version - 2.2.3
3+
* Version - 2.2.4
44
* MIT LICENSED BY - Denis Power
55
* Repo - https://github.com/interjs/inter
66
* 2021 - 2024
77
* GENERATED BY INTER BUILDER
88
* Module version
99
*/
1010

11-
export const interVersion = "2.2.3";
11+
export const interVersion = "2.2.4";
1212

1313
function runInvalidTemplateArgumentError(arg) {
1414
syErr(`The argument of the template function must be a plain Javascript object,
@@ -218,9 +218,9 @@ function runNotDefinedConditionalPropWarning(prop) {
218218
consW(`"${prop}" was not defined as a conditional property.`);
219219
}
220220

221-
function runTwoElseIfElementsCanNotHaveTheSamePropError(prop) {
221+
function runAlreadyUsedPropInConditionalGroupError(prop) {
222222
err(`
223-
Two elements with the "_elseIf" attribute can not have the same conditional property.
223+
Two elements in the conditional group can not have the same conditional property.
224224
Property: "${prop}"
225225
`);
226226
}
@@ -246,7 +246,11 @@ function runHasMoreThanOneCondtionalAttributeError(child) {
246246
element which has more than one conditional atribute, it's forbidden.`);
247247
}
248248

249-
function runNotDefinedIfNotPropWarning(child, _ifNot, data) {
249+
function runNotDefinedIfNotPropWarning(child, _ifNot /*propValue*/, data) {
250+
if (_ifNot.trim().length == 0) {
251+
runInvalidConditionalAttrs("_ifNot");
252+
return;
253+
}
250254
ParserWarning(`
251255
252256
The conditional rendering parser found
@@ -262,12 +266,23 @@ function runNotDefinedIfNotPropWarning(child, _ifNot, data) {
262266
`);
263267
}
264268

269+
function runInvalidConditionalAttrs(attrName) {
270+
ParserWarning(`The conditional rendering parser found an ${attrName} attribute that does not
271+
have a value assigned to it. Assign a value to the ${attrName} attribute.
272+
`);
273+
}
274+
265275
function runNotDefinedElseIfPropWarning(propValue) {
276+
if (propValue.trim().length == 0) {
277+
runInvalidConditionalAttrs("_elseIf");
278+
return;
279+
}
280+
266281
ParserWarning(`The conditional rendering parser found an element which has the "_elseIf"
267-
conditional property whose the value is: "${propValue}",
268-
but you did not define any conditional property with that name.
269-
270-
`);
282+
conditional property whose the value is: "${propValue}",
283+
but you did not define any conditional property with that name.
284+
285+
`);
271286
}
272287

273288
function runInvalidElseAttributeError() {
@@ -289,6 +304,10 @@ function runInvalidSetCondsValueError(arg) {
289304
}
290305

291306
function runNotDefinedIfPropWarning(propValue, child, data) {
307+
if (propValue.trim().length == 0) {
308+
runInvalidConditionalAttrs("_if");
309+
return;
310+
}
292311
ParserWarning(`
293312
The conditional rendering parser found
294313
an element which has the "_if" attribute and the value
@@ -1263,7 +1282,7 @@ export function renderIf(obj) {
12631282
if (!this.conditionalProps.has(prop)) {
12641283
this.elseIfs.add(elseIfOptions);
12651284
this.conditionalProps.add(prop);
1266-
} else runTwoElseIfElementsCanNotHaveTheSamePropError(prop);
1285+
} else runAlreadyUsedPropInConditionalGroupError(prop);
12671286
},
12681287

12691288
deleteData() {

inter.min.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"name":"inter","version":"2.2.3","description":"The javascript framework to build highly interactive front-end web applications.","author":"Denis Power","license":"MIT","jsdelivr":"inter.min.js","repository":{"type":"git","url":"git+https://github.com/interjs/inter.git"},"homepage":"https://interjs.github.io","bugs":{"url":"https://github.com/interjs/inter/issues"},"main":"inter.js","keywords":["interjs","inter"],"devDependencies":{"eslint":"^8.56.0","prettier":"^2.8.3"}}
1+
{"name":"inter","version":"2.2.4","description":"The javascript framework to build highly interactive front-end web applications.","author":"Denis Power","license":"MIT","jsdelivr":"inter.min.js","repository":{"type":"git","url":"git+https://github.com/interjs/inter.git"},"homepage":"https://interjs.github.io","bugs":{"url":"https://github.com/interjs/inter/issues"},"main":"inter.js","keywords":["interjs","inter"],"devDependencies":{"eslint":"^8.56.0","prettier":"^2.8.3"}}

0 commit comments

Comments
 (0)