aberdeen 1.0.8 → 1.0.10
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/aberdeen.d.ts +2 -2
- package/dist/aberdeen.js +21 -10
- package/dist/aberdeen.js.map +3 -3
- package/dist-min/aberdeen.js +5 -5
- package/dist-min/aberdeen.js.map +3 -3
- package/html-to-aberdeen +354 -0
- package/package.json +1 -1
- package/src/aberdeen.ts +23 -12
package/dist/aberdeen.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export type SortKeyType = number | string | Array<number | string> | undefined;
|
|
|
66
66
|
* @see {@link onEach} for usage with sorting.
|
|
67
67
|
*/
|
|
68
68
|
export declare function invertString(input: string): string;
|
|
69
|
-
export declare function onEach<T>(target:
|
|
69
|
+
export declare function onEach<T>(target: ReadonlyArray<undefined | T>, render: (value: T, index: number) => void, makeKey?: (value: T, key: any) => SortKeyType): void;
|
|
70
70
|
export declare function onEach<K extends string | number | symbol, T>(target: Record<K, undefined | T>, render: (value: T, index: K) => void, makeKey?: (value: T, key: K) => SortKeyType): void;
|
|
71
71
|
/**
|
|
72
72
|
* Reactively checks if an observable array or object is empty.
|
|
@@ -306,7 +306,7 @@ export declare function ref<T extends TargetType, K extends keyof T>(target: T,
|
|
|
306
306
|
* This is often used together with {@link ref}, in order to use properties other than `.value`.
|
|
307
307
|
* - `{text: string|number}`: Add the value as a `TextNode` to the *current* element.
|
|
308
308
|
* - `{html: string}`: Add the value as HTML to the *current* element. This should only be used in exceptional situations. And of course, beware of XSS.
|
|
309
|
-
|
|
309
|
+
- `Node`: If a DOM Node (Element or TextNode) is passed in, it is added as a child to the *current* element. If the Node is an Element, it becomes the new *current* element for the rest of this `$` function execution.
|
|
310
310
|
*
|
|
311
311
|
* @returns The most inner DOM element that was created (not counting text nodes nor elements created by content functions),
|
|
312
312
|
* or undefined if no elements were created.
|
package/dist/aberdeen.js
CHANGED
|
@@ -138,7 +138,7 @@ function partToStr(part) {
|
|
|
138
138
|
let num = Math.abs(Math.round(part));
|
|
139
139
|
const negative = part < 0;
|
|
140
140
|
while (num > 0) {
|
|
141
|
-
result
|
|
141
|
+
result = String.fromCharCode(negative ? 65534 - num % 65533 : 2 + num % 65533) + result;
|
|
142
142
|
num = Math.floor(num / 65533);
|
|
143
143
|
}
|
|
144
144
|
return String.fromCharCode(128 + (negative ? -result.length : result.length)) + result;
|
|
@@ -910,9 +910,9 @@ var SPECIAL_PROPS = {
|
|
|
910
910
|
addNode(document.createTextNode(value));
|
|
911
911
|
},
|
|
912
912
|
element: (value) => {
|
|
913
|
-
|
|
914
|
-
throw new Error(`Unexpected element-argument: ${JSON.parse(value)}`);
|
|
913
|
+
console.log("Aberdeen: $({element: myElement}) is deprecated, use $(myElement) instead");
|
|
915
914
|
addNode(value);
|
|
915
|
+
SPECIAL_PROPS.element = addNode;
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
918
|
function $(...args) {
|
|
@@ -974,12 +974,23 @@ function $(...args) {
|
|
|
974
974
|
}
|
|
975
975
|
} else if (typeof arg === "object") {
|
|
976
976
|
if (arg.constructor !== Object) {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
977
|
+
if (arg instanceof Node) {
|
|
978
|
+
addNode(arg);
|
|
979
|
+
if (arg instanceof Element) {
|
|
980
|
+
if (!savedCurrentScope)
|
|
981
|
+
savedCurrentScope = currentScope;
|
|
982
|
+
currentScope = new ChainedScope(arg, true);
|
|
983
|
+
currentScope.lastChild = arg.lastChild || undefined;
|
|
984
|
+
}
|
|
985
|
+
} else {
|
|
986
|
+
err = `Unexpected argument: ${arg}`;
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
} else {
|
|
990
|
+
for (const key in arg) {
|
|
991
|
+
const val = arg[key];
|
|
992
|
+
applyArg(key, val);
|
|
993
|
+
}
|
|
983
994
|
}
|
|
984
995
|
} else if (typeof arg === "function") {
|
|
985
996
|
new RegularScope(currentScope.parentElement, arg);
|
|
@@ -1217,5 +1228,5 @@ export {
|
|
|
1217
1228
|
$
|
|
1218
1229
|
};
|
|
1219
1230
|
|
|
1220
|
-
//# debugId=
|
|
1231
|
+
//# debugId=4D9B4C45440E57B664756E2164756E21
|
|
1221
1232
|
//# sourceMappingURL=aberdeen.js.map
|