@ixfx/ui 0.56.0 → 0.56.2
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/LICENSE +26 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +54 -54
- package/package.json +30 -8
- /package/dist/{chunk-CzXV76rE.js → chunk-BN_g-Awi.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021-
|
|
3
|
+
Copyright (c) 2021-2026 Clint Heyer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Package: bezier-js
|
|
26
|
+
https://github.com/Pomax/bezierjs
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2023 Pomax
|
|
4
29
|
|
|
5
30
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
31
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-
|
|
1
|
+
import { t as __exportAll } from "./chunk-BN_g-Awi.js";
|
|
2
2
|
import * as RxFrom from "@ixfx/rx/from";
|
|
3
3
|
import { eventTrigger, observable } from "@ixfx/rx/from";
|
|
4
4
|
import { debounce } from "@ixfx/rx/ops";
|
|
@@ -405,8 +405,8 @@ function domForm(formElOrQuery, options = {}) {
|
|
|
405
405
|
* @returns
|
|
406
406
|
*/
|
|
407
407
|
function fromDomQuery(query) {
|
|
408
|
-
const elements
|
|
409
|
-
return Rx.From.object(elements
|
|
408
|
+
const elements = [...document.querySelectorAll(query)];
|
|
409
|
+
return Rx.From.object(elements);
|
|
410
410
|
}
|
|
411
411
|
/**
|
|
412
412
|
* Updates an element's `textContent` when the source value changes.
|
|
@@ -542,64 +542,64 @@ const bindElement = (source, elOrQuery, ...binds) => {
|
|
|
542
542
|
let b = [];
|
|
543
543
|
if (binds.length === 0) b.push({ elField: `textContent` });
|
|
544
544
|
else b = [...binds];
|
|
545
|
-
return bind(source, ...b.map((bind
|
|
546
|
-
if (`element` in bind
|
|
545
|
+
return bind(source, ...b.map((bind) => {
|
|
546
|
+
if (`element` in bind) return bind;
|
|
547
547
|
return {
|
|
548
|
-
...bind
|
|
548
|
+
...bind,
|
|
549
549
|
element: el
|
|
550
550
|
};
|
|
551
551
|
}));
|
|
552
552
|
};
|
|
553
|
-
const resolveBindUpdater = (bind
|
|
554
|
-
const b = resolveBindUpdaterBase(bind
|
|
553
|
+
const resolveBindUpdater = (bind, element) => {
|
|
554
|
+
const b = resolveBindUpdaterBase(bind);
|
|
555
555
|
return (value) => {
|
|
556
556
|
b(value, element);
|
|
557
557
|
};
|
|
558
558
|
};
|
|
559
|
-
const resolveBindUpdaterBase = (bind
|
|
560
|
-
if (bind
|
|
561
|
-
const field = bind
|
|
559
|
+
const resolveBindUpdaterBase = (bind) => {
|
|
560
|
+
if (bind.elField !== void 0 || bind.cssVariable === void 0 && bind.attribName === void 0 && bind.cssProperty === void 0 && bind.textContent === void 0 && bind.htmlContent === void 0) {
|
|
561
|
+
const field = bind.elField ?? `textContent`;
|
|
562
562
|
return (v, element) => {
|
|
563
563
|
element[field] = v;
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
|
-
if (bind
|
|
567
|
-
const attrib = bind
|
|
566
|
+
if (bind.attribName !== void 0) {
|
|
567
|
+
const attrib = bind.attribName;
|
|
568
568
|
return (v, element) => {
|
|
569
569
|
element.setAttribute(attrib, v);
|
|
570
570
|
};
|
|
571
571
|
}
|
|
572
|
-
if (bind
|
|
572
|
+
if (bind.textContent) return (v, element) => {
|
|
573
573
|
element.textContent = v;
|
|
574
574
|
};
|
|
575
|
-
if (bind
|
|
575
|
+
if (bind.htmlContent) return (v, element) => {
|
|
576
576
|
element.innerHTML = v;
|
|
577
577
|
};
|
|
578
|
-
if (bind
|
|
579
|
-
let css = bind
|
|
578
|
+
if (bind.cssVariable !== void 0) {
|
|
579
|
+
let css = bind.cssVariable;
|
|
580
580
|
if (!css.startsWith(`--`)) css = `--` + css;
|
|
581
581
|
return (v, element) => {
|
|
582
582
|
element.style.setProperty(css, v);
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
|
-
if (bind
|
|
586
|
-
element.style[bind
|
|
585
|
+
if (bind.cssProperty !== void 0) return (v, element) => {
|
|
586
|
+
element.style[bind.cssProperty] = v;
|
|
587
587
|
};
|
|
588
588
|
return (_, _element) => {
|
|
589
589
|
/** no-op */
|
|
590
590
|
};
|
|
591
591
|
};
|
|
592
|
-
const resolveTransform = (bind
|
|
593
|
-
if (!bind
|
|
594
|
-
if (bind
|
|
595
|
-
if (bind
|
|
592
|
+
const resolveTransform = (bind) => {
|
|
593
|
+
if (!bind.transform && !bind.transformValue) return;
|
|
594
|
+
if (bind.transformValue) {
|
|
595
|
+
if (bind.sourceField === void 0) throw new Error(`Expects 'sourceField' to be set when 'transformValue' is set`);
|
|
596
596
|
return (value) => {
|
|
597
|
-
const fieldValue = value[bind
|
|
598
|
-
return bind
|
|
597
|
+
const fieldValue = value[bind.sourceField];
|
|
598
|
+
return bind.transformValue(fieldValue);
|
|
599
599
|
};
|
|
600
|
-
} else if (bind
|
|
601
|
-
if (bind
|
|
602
|
-
return (value) => bind
|
|
600
|
+
} else if (bind.transform) {
|
|
601
|
+
if (bind.sourceField !== void 0) throw new Error(`If 'transform' is set, 'sourceField' is ignored`);
|
|
602
|
+
return (value) => bind.transform(value);
|
|
603
603
|
}
|
|
604
604
|
};
|
|
605
605
|
/**
|
|
@@ -634,26 +634,26 @@ const resolveTransform = (bind$1) => {
|
|
|
634
634
|
* @returns
|
|
635
635
|
*/
|
|
636
636
|
const bind = (source, ...bindsUnresolvedElements) => {
|
|
637
|
-
const binds = bindsUnresolvedElements.map((bind
|
|
638
|
-
if (bind
|
|
639
|
-
if (bind
|
|
640
|
-
...bind
|
|
641
|
-
element: resolveEl(bind
|
|
637
|
+
const binds = bindsUnresolvedElements.map((bind) => {
|
|
638
|
+
if (bind.element && bind.element !== void 0) return bind;
|
|
639
|
+
if (bind.query) return {
|
|
640
|
+
...bind,
|
|
641
|
+
element: resolveEl(bind.query)
|
|
642
642
|
};
|
|
643
|
-
throw new Error(`Unable to resolve element. Missing 'element' or 'query' values on bind. ${JSON.stringify(bind
|
|
643
|
+
throw new Error(`Unable to resolve element. Missing 'element' or 'query' values on bind. ${JSON.stringify(bind)}`);
|
|
644
644
|
});
|
|
645
|
-
const bindsResolved = binds.map((bind
|
|
646
|
-
update: resolveBindUpdater(bind
|
|
647
|
-
transformer: resolveTransform(bind
|
|
648
|
-
sourceField: bind
|
|
645
|
+
const bindsResolved = binds.map((bind) => ({
|
|
646
|
+
update: resolveBindUpdater(bind, bind.element),
|
|
647
|
+
transformer: resolveTransform(bind),
|
|
648
|
+
sourceField: bind.sourceField
|
|
649
649
|
}));
|
|
650
650
|
const update = (value) => {
|
|
651
|
-
for (const bind
|
|
651
|
+
for (const bind of bindsResolved) if (bind.transformer) bind.update(bind.transformer(value));
|
|
652
652
|
else {
|
|
653
|
-
const v = bind
|
|
654
|
-
if (typeof v === `object`) if (bind
|
|
655
|
-
else bind
|
|
656
|
-
else bind
|
|
653
|
+
const v = bind.sourceField ? value[bind.sourceField] : value;
|
|
654
|
+
if (typeof v === `object`) if (bind.sourceField) bind.update(JSON.stringify(v));
|
|
655
|
+
else bind.update(JSON.stringify(v));
|
|
656
|
+
else bind.update(v);
|
|
657
657
|
}
|
|
658
658
|
};
|
|
659
659
|
const unsub = source.on((message) => {
|
|
@@ -663,7 +663,7 @@ const bind = (source, ...bindsUnresolvedElements) => {
|
|
|
663
663
|
if (Rx.hasLast(source)) update(source.last());
|
|
664
664
|
return { remove: (removeElements) => {
|
|
665
665
|
unsub();
|
|
666
|
-
if (removeElements) for (const bind
|
|
666
|
+
if (removeElements) for (const bind of binds) bind.element.remove();
|
|
667
667
|
} };
|
|
668
668
|
};
|
|
669
669
|
/**
|
|
@@ -806,8 +806,8 @@ const elements = (source, options) => {
|
|
|
806
806
|
});
|
|
807
807
|
}
|
|
808
808
|
const findBind = (path) => {
|
|
809
|
-
const bind
|
|
810
|
-
if (bind
|
|
809
|
+
const bind = findBySomeKey(binds, stringSegmentsWholeToEnd(path));
|
|
810
|
+
if (bind !== void 0) return bind;
|
|
811
811
|
if (!path.includes(`.`)) return binds.get(`_root`);
|
|
812
812
|
};
|
|
813
813
|
function* ancestorBinds(path) {
|
|
@@ -817,9 +817,9 @@ const elements = (source, options) => {
|
|
|
817
817
|
const create = (path, value) => {
|
|
818
818
|
const rootedPath = getRootedPath(path);
|
|
819
819
|
console.log(`Rx.Dom.elements.create: ${path} rooted: ${rootedPath} value: ${JSON.stringify(value)}`);
|
|
820
|
-
const bind
|
|
820
|
+
const bind = findBind(getRootedPath(path));
|
|
821
821
|
let tagName = defaultTag;
|
|
822
|
-
if (bind
|
|
822
|
+
if (bind?.tagName) tagName = bind.tagName;
|
|
823
823
|
const el = document.createElement(tagName);
|
|
824
824
|
el.setAttribute(`data-path`, path);
|
|
825
825
|
update(path, el, value);
|
|
@@ -836,17 +836,17 @@ const elements = (source, options) => {
|
|
|
836
836
|
};
|
|
837
837
|
const update = (path, el, value) => {
|
|
838
838
|
console.log(`Rx.dom.update path: ${path} value:`, value);
|
|
839
|
-
const bind
|
|
840
|
-
if (bind
|
|
839
|
+
const bind = findBind(getRootedPath(path));
|
|
840
|
+
if (bind === void 0) {
|
|
841
841
|
if (typeof value === `object`) value = JSON.stringify(value);
|
|
842
842
|
el.textContent = value;
|
|
843
843
|
} else {
|
|
844
|
-
if (bind
|
|
845
|
-
bind
|
|
844
|
+
if (bind.transform) value = bind.transform(value);
|
|
845
|
+
bind.update(value, el);
|
|
846
846
|
}
|
|
847
847
|
};
|
|
848
|
-
const changes = (changes
|
|
849
|
-
const queue = new QueueMutable({}, changes
|
|
848
|
+
const changes = (changes) => {
|
|
849
|
+
const queue = new QueueMutable({}, changes);
|
|
850
850
|
let d = queue.dequeue();
|
|
851
851
|
const seenPaths = /* @__PURE__ */ new Set();
|
|
852
852
|
while (d !== void 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixfx/ui",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -8,16 +8,38 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@ixfx/core": "0.56.
|
|
12
|
-
"@ixfx/
|
|
13
|
-
"@ixfx/
|
|
14
|
-
"@ixfx/visual": "0.56.
|
|
15
|
-
"@ixfx/rx": "0.56.
|
|
11
|
+
"@ixfx/core": "0.56.2",
|
|
12
|
+
"@ixfx/dom": "0.56.2",
|
|
13
|
+
"@ixfx/collections": "0.56.2",
|
|
14
|
+
"@ixfx/visual": "0.56.2",
|
|
15
|
+
"@ixfx/rx": "0.56.2"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
18
|
".": "./dist/index.js",
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"description": "ixfx ui",
|
|
25
|
+
"keywords": [
|
|
26
|
+
"ixfx",
|
|
27
|
+
"interactivity",
|
|
28
|
+
"ui"
|
|
29
|
+
],
|
|
30
|
+
"homepage": "https://ixfxfun.dev",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/clinth/ixfx/issues"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/clinth/ixfx.git",
|
|
37
|
+
"directory": "packages/ui"
|
|
38
|
+
},
|
|
39
|
+
"author": "Clint Heyer <clint@thestaticvoid.net>",
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=24.0.0"
|
|
42
|
+
},
|
|
43
|
+
"main": "./dist/index.js",
|
|
44
|
+
"scripts": {}
|
|
23
45
|
}
|
|
File without changes
|