Socket
Socket
Sign inDemoInstall

@thi.ng/rdom

Package Overview
Dependencies
Maintainers
0
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/rdom - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

4

api.d.ts

@@ -35,5 +35,5 @@ import type { Fn0 } from "@thi.ng/api";

* @param idx -
* @param xs -
* @param args -
*/
mount(parent: ParentNode, idx?: NumOrElement, ...xs: any[]): Promise<Element>;
mount(parent: ParentNode, idx?: NumOrElement, ...args: any[]): Promise<Element>;
/**

@@ -40,0 +40,0 @@ * Async component lifecycle method to remove the component from the

# Change Log
- **Last updated**: 2024-05-08T18:24:31Z
- **Last updated**: 2024-06-21T19:34:38Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,15 @@

### [1.4.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.4.1) (2024-06-21)
#### 🩹 Bug fixes
- fix [#469](https://github.com/thi-ng/umbrella/issues/469), update setAttrib() `class` handling ([6cf8c56](https://github.com/thi-ng/umbrella/commit/6cf8c56))
- use `el.setAttribute()` to be compatible w/ SVG elements
- https://developer.mozilla.org/en-US/docs/Web/API/Element/className#notes
#### ♻️ Refactoring
- rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
## [1.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.4.0) (2024-05-08)

@@ -14,0 +27,0 @@

@@ -10,7 +10,7 @@ import { isArray } from "@thi.ng/checks/is-array";

import { $wrapEl, $wrapText } from "./wrap.js";
const $compile = (tree) => isArray(tree) ? isComplexComponent(tree) ? complexComponent(tree) : basicComponent(tree) : isComponent(tree) ? tree : isSubscribable(tree) ? $sub(tree, "span") : isAsyncIterable(tree) ? $async(tree, "span") : tree instanceof Element ? $wrapEl(tree) : $wrapText("span", null, tree);
const walk = (f, x, path = []) => {
const $compile = (tree) => isArray(tree) ? __isComplexComponent(tree) ? __complexComponent(tree) : __basicComponent(tree) : isComponent(tree) ? tree : isSubscribable(tree) ? $sub(tree, "span") : isAsyncIterable(tree) ? $async(tree, "span") : tree instanceof Element ? $wrapEl(tree) : $wrapText("span", null, tree);
const __walk = (f, x, path = []) => {
if (isPlainObject(x)) {
for (const k in x) {
walk(f, x[k], [...path, k]);
__walk(f, x[k], [...path, k]);
}

@@ -20,10 +20,10 @@ }

};
const isComplexComponent = (x) => {
const __isComplexComponent = (x) => {
if (isPlainObject(x)) {
for (const k in x) {
if (isComplexComponent(x[k])) return true;
if (__isComplexComponent(x[k])) return true;
}
} else if (isArray(x)) {
for (let i = 0, n = x.length; i < n; i++) {
if (isComplexComponent(x[i])) return true;
if (__isComplexComponent(x[i])) return true;
}

@@ -33,7 +33,7 @@ }

};
const complexComponent = (tree) => ({
const __complexComponent = (tree) => ({
async mount(parent, index = -1) {
this.subs = [];
const attribs = { ...tree[1] };
walk((x, path) => {
__walk((x, path) => {
if (isSubscribable(x)) {

@@ -68,3 +68,3 @@ this.subs.push(x.subscribe(new $SubA(this, path)));

});
const basicComponent = (tree) => ({
const __basicComponent = (tree) => ({
async mount(parent, index = -1) {

@@ -71,0 +71,0 @@ return this.el = await $tree(tree, parent, index);

@@ -10,3 +10,3 @@ import type { Maybe, MaybeDeref } from "@thi.ng/api";

el?: Element;
abstract mount(parent: ParentNode, index?: NumOrElement, ...xs: any[]): Promise<Element>;
abstract mount(parent: ParentNode, index?: NumOrElement, ...args: any[]): Promise<Element>;
unmount(): Promise<void>;

@@ -13,0 +13,0 @@ update(state?: T): void;

@@ -99,3 +99,3 @@ import { deref, isDeref } from "@thi.ng/api/deref";

for (let id in attribs) {
setAttrib(el, id, attribs[id], attribs);
__setAttrib(el, id, attribs[id], attribs);
}

@@ -105,10 +105,10 @@ return el;

const __setterCache = {};
const getproto = Object.getPrototypeOf;
const getdesc = Object.getOwnPropertyDescriptor;
const __desc = (proto, prop) => proto ? getdesc(proto, prop) ?? __desc(getproto(proto), prop) : void 0;
const __getProto = Object.getPrototypeOf;
const __getDesc = Object.getOwnPropertyDescriptor;
const __desc = (proto, prop) => proto ? __getDesc(proto, prop) ?? __desc(__getProto(proto), prop) : void 0;
const __setter = (el, prop) => {
const key = `${el.namespaceURI}/${el.tagName}#${prop}`;
return __setterCache[key] ?? (__setterCache[key] = __desc(getproto(el), prop)?.set ?? false);
return __setterCache[key] ?? (__setterCache[key] = __desc(__getProto(el), prop)?.set ?? false);
};
const setAttrib = (el, id, val, attribs) => {
const __setAttrib = (el, id, val, attribs) => {
implementsFunction(val, "deref") && (val = val.deref());

@@ -128,3 +128,6 @@ if (id.startsWith("on")) {

case "class":
el.className = isString(val) ? val : mergeClasses(el.className, val);
el.setAttribute(
"class",
isString(val) ? val : mergeClasses(el.className, val)
);
break;

@@ -135,6 +138,6 @@ case "style":

case "value":
updateValueAttrib(el, val);
__updateValueAttrib(el, val);
break;
case "data":
updateDataAttribs(el, val);
__updateDataAttribs(el, val);
break;

@@ -159,3 +162,3 @@ case "prefix":

};
const updateValueAttrib = (el, value) => {
const __updateValueAttrib = (el, value) => {
let ev;

@@ -180,3 +183,3 @@ switch (el.type) {

};
const updateDataAttribs = (el, attribs) => {
const __updateDataAttribs = (el, attribs) => {
const data = el.dataset;

@@ -183,0 +186,0 @@ for (let id in attribs) {

@@ -49,3 +49,3 @@ import type { Fn, Keys } from "@thi.ng/api";

*/
export declare const $object: <T extends object, K extends keyof T>(src: T, opts: Partial<StreamObjOpts<T, K>>, inner: Fn<StreamObj<T, K>["streams"], Promise<ComponentLike>>) => $Object<T, K>;
export declare const $object: <T extends object, K extends Keys<T>>(src: T, opts: Partial<StreamObjOpts<T, K>>, inner: Fn<StreamObj<T, K>["streams"], Promise<ComponentLike>>) => $Object<T, K>;
/**

@@ -83,3 +83,3 @@ * Syntax sugar for a combination of {@link $sub} and {@link $object} to allow

*/
export declare const $subObject: <T extends object, K extends keyof T>(src: ISubscribable<T>, opts: Partial<StreamObjOpts<T, K>>, inner: Fn<StreamObj<T, K>["streams"], Promise<ComponentLike>>) => IComponent<T>;
export declare const $subObject: <T extends object, K extends Keys<T>>(src: ISubscribable<T>, opts: Partial<StreamObjOpts<T, K>>, inner: Fn<StreamObj<T, K>["streams"], Promise<ComponentLike>>) => IComponent<T>;
export declare class $Object<T extends object, K extends Keys<T>> extends Component implements IMountWithState<T> {

@@ -86,0 +86,0 @@ protected ctor: Fn<StreamObj<T, K>["streams"], Promise<ComponentLike>>;

{
"name": "@thi.ng/rdom",
"version": "1.4.0",
"version": "1.4.1",
"description": "Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible",

@@ -13,3 +13,3 @@ "type": "module",

},
"homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/rdom#readme",
"homepage": "https://thi.ng/rdom",
"funding": [

@@ -41,16 +41,16 @@ {

"dependencies": {
"@thi.ng/api": "^8.11.2",
"@thi.ng/checks": "^3.6.4",
"@thi.ng/errors": "^2.5.7",
"@thi.ng/hiccup": "^5.2.1",
"@thi.ng/paths": "^5.1.81",
"@thi.ng/prefixes": "^2.3.19",
"@thi.ng/rstream": "^8.5.0",
"@thi.ng/strings": "^3.7.33"
"@thi.ng/api": "^8.11.3",
"@thi.ng/checks": "^3.6.5",
"@thi.ng/errors": "^2.5.8",
"@thi.ng/hiccup": "^5.2.2",
"@thi.ng/paths": "^5.1.82",
"@thi.ng/prefixes": "^2.3.20",
"@thi.ng/rstream": "^8.5.1",
"@thi.ng/strings": "^3.7.34"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.43.2",
"esbuild": "^0.21.1",
"@microsoft/api-extractor": "^7.47.0",
"esbuild": "^0.21.5",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
"typescript": "^5.5.2"
},

@@ -150,3 +150,3 @@ "keywords": [

},
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
}

@@ -10,3 +10,3 @@ <!-- This file is generated - DO NOT EDIT! -->

> [!NOTE]
> This is one of 192 standalone projects, maintained as part
> This is one of 193 standalone projects, maintained as part
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo

@@ -13,0 +13,0 @@ > and anti-framework.

import { $compile } from "./compile.js";
import { $addChild, $html, $remove, $text } from "./dom.js";
const wrapper = (update) => (tag, attribs, body) => ({
const __wrapper = (update) => (tag, attribs, body) => ({
async mount(parent, index, state) {

@@ -18,4 +18,4 @@ this.inner = $compile([tag, attribs]);

});
const $wrapText = wrapper($text);
const $wrapHtml = wrapper($html);
const $wrapText = __wrapper($text);
const $wrapHtml = __wrapper($html);
const $wrapEl = (el) => ({

@@ -22,0 +22,0 @@ async mount(parent, idx) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc