@oscarpalmer/abydon 0.23.0 → 0.23.1
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.
- package/dist/abydon.full.mjs +4 -4
- package/dist/attribute/index.mjs +3 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/attribute/index.ts +4 -2
- package/src/index.ts +2 -2
package/dist/abydon.full.mjs
CHANGED
|
@@ -1819,9 +1819,9 @@ function mapAttributes(data, element, ignoreValue) {
|
|
|
1819
1819
|
for (let index = 0; index < length; index += 1) {
|
|
1820
1820
|
const { name, value } = attributes[index];
|
|
1821
1821
|
const actualName = name.replace(EXPRESSION_ABYDON_ATTRIBUTE_PREFIX, "");
|
|
1822
|
-
const actualValue = getValue(data, value);
|
|
1823
1822
|
if (actualName !== name) element.removeAttribute(name);
|
|
1824
|
-
if (actualName === "value" && ignoreValue) continue;
|
|
1823
|
+
if (isNullableOrWhitespace(value) || actualName === "value" && ignoreValue) continue;
|
|
1824
|
+
const actualValue = getValue(data, value);
|
|
1825
1825
|
switch (true) {
|
|
1826
1826
|
case EXPRESSION_EVENT_PREFIX.test(actualName):
|
|
1827
1827
|
mapEvent(element, actualName, actualValue);
|
|
@@ -2181,7 +2181,7 @@ function removeMora(data) {
|
|
|
2181
2181
|
//#region src/index.ts
|
|
2182
2182
|
/**
|
|
2183
2183
|
* Create a _Fragments_ instance from a reactive array
|
|
2184
|
-
*
|
|
2184
|
+
*
|
|
2185
2185
|
* _A Fragments instance can be used to efficiently render a list of items that may change over time, using unique identifiers to track each item, only adding, removing, or updating each related Fragment._
|
|
2186
2186
|
*
|
|
2187
2187
|
* @example
|
|
@@ -2210,7 +2210,7 @@ function fragments(array, identify, fragment) {
|
|
|
2210
2210
|
}
|
|
2211
2211
|
/**
|
|
2212
2212
|
* Create a _Fragment_ from a template
|
|
2213
|
-
*
|
|
2213
|
+
*
|
|
2214
2214
|
* _A Fragment can be used to efficiently render a template that may change over time, only updating the necessary parts of the DOM._
|
|
2215
2215
|
*
|
|
2216
2216
|
* @example
|
package/dist/attribute/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { EXPRESSION_ABYDON_ATTRIBUTE_PREFIX, EXPRESSION_ABYDON_CONTENT, EXPRESSI
|
|
|
2
2
|
import { setComputedValue } from "../helpers/index.mjs";
|
|
3
3
|
import { mapEvent } from "../node/event.mjs";
|
|
4
4
|
import { setAttribute } from "./value.mjs";
|
|
5
|
+
import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
|
|
5
6
|
import { isSignal } from "@oscarpalmer/mora";
|
|
6
7
|
import { isInputElement } from "@oscarpalmer/toretto/is";
|
|
7
8
|
//#region src/attribute/index.ts
|
|
@@ -25,9 +26,9 @@ function mapAttributes(data, element, ignoreValue) {
|
|
|
25
26
|
for (let index = 0; index < length; index += 1) {
|
|
26
27
|
const { name, value } = attributes[index];
|
|
27
28
|
const actualName = name.replace(EXPRESSION_ABYDON_ATTRIBUTE_PREFIX, "");
|
|
28
|
-
const actualValue = getValue(data, value);
|
|
29
29
|
if (actualName !== name) element.removeAttribute(name);
|
|
30
|
-
if (actualName === "value" && ignoreValue) continue;
|
|
30
|
+
if (isNullableOrWhitespace(value) || actualName === "value" && ignoreValue) continue;
|
|
31
|
+
const actualValue = getValue(data, value);
|
|
31
32
|
switch (true) {
|
|
32
33
|
case EXPRESSION_EVENT_PREFIX.test(actualName):
|
|
33
34
|
mapEvent(element, actualName, actualValue);
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export * from "@oscarpalmer/mora";
|
|
|
6
6
|
//#region src/index.ts
|
|
7
7
|
/**
|
|
8
8
|
* Create a _Fragments_ instance from a reactive array
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* _A Fragments instance can be used to efficiently render a list of items that may change over time, using unique identifiers to track each item, only adding, removing, or updating each related Fragment._
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
@@ -35,7 +35,7 @@ function fragments(array, identify, fragment) {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Create a _Fragment_ from a template
|
|
38
|
-
*
|
|
38
|
+
*
|
|
39
39
|
* _A Fragment can be used to efficiently render a template that may change over time, only updating the necessary parts of the DOM._
|
|
40
40
|
*
|
|
41
41
|
* @example
|
package/package.json
CHANGED
package/src/attribute/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {setComputedValue} from '../helpers';
|
|
|
12
12
|
import type {FragmentData} from '../models';
|
|
13
13
|
import {mapEvent} from '../node/event';
|
|
14
14
|
import {setAttribute} from './value';
|
|
15
|
+
import {isNullableOrWhitespace} from '@oscarpalmer/atoms/is';
|
|
15
16
|
|
|
16
17
|
function compareAttributes(first: Attr, second: Attr): number {
|
|
17
18
|
return first.name.localeCompare(second.name);
|
|
@@ -55,16 +56,17 @@ export function mapAttributes(
|
|
|
55
56
|
const {name, value} = attributes[index];
|
|
56
57
|
|
|
57
58
|
const actualName = name.replace(EXPRESSION_ABYDON_ATTRIBUTE_PREFIX, '');
|
|
58
|
-
const actualValue = getValue(data, value);
|
|
59
59
|
|
|
60
60
|
if (actualName !== name) {
|
|
61
61
|
element.removeAttribute(name);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
if (actualName === PROPERTY_VALUE && ignoreValue) {
|
|
64
|
+
if (isNullableOrWhitespace(value) || (actualName === PROPERTY_VALUE && ignoreValue)) {
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
const actualValue = getValue(data, value);
|
|
69
|
+
|
|
68
70
|
switch (true) {
|
|
69
71
|
case EXPRESSION_EVENT_PREFIX.test(actualName):
|
|
70
72
|
mapEvent(element, actualName, actualValue);
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {Fragments} from './fragments';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Create a _Fragments_ instance from a reactive array
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* _A Fragments instance can be used to efficiently render a list of items that may change over time, using unique identifiers to track each item, only adding, removing, or updating each related Fragment._
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
@@ -48,7 +48,7 @@ export function fragments<Item>(
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Create a _Fragment_ from a template
|
|
51
|
-
*
|
|
51
|
+
*
|
|
52
52
|
* _A Fragment can be used to efficiently render a template that may change over time, only updating the necessary parts of the DOM._
|
|
53
53
|
*
|
|
54
54
|
* @example
|