@e280/sly 0.2.0-2 → 0.2.0-21
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/README.md +552 -98
- package/package.json +12 -5
- package/s/base/element.ts +76 -0
- package/s/base/index.ts +5 -0
- package/s/{views → base}/use.ts +17 -18
- package/s/base/utils/attr-watcher.ts +22 -0
- package/s/base/utils/reactor.ts +32 -0
- package/s/base/utils/use-attrs.ts +27 -0
- package/s/demo/demo.bundle.ts +9 -5
- package/s/demo/views/counter.ts +21 -24
- package/s/demo/views/demo.ts +10 -6
- package/s/demo/views/fastcount.ts +29 -0
- package/s/demo/views/loaders.ts +7 -7
- package/s/dom/attrs/attrs.ts +21 -0
- package/s/dom/attrs/parts/attr-fns.ts +38 -0
- package/s/dom/attrs/parts/attr-proxies.ts +35 -0
- package/s/dom/attrs/parts/attr-spec.ts +29 -0
- package/s/dom/attrs/parts/on-attrs.ts +8 -0
- package/s/dom/dom.ts +46 -16
- package/s/dom/index.ts +4 -0
- package/s/dom/parts/el.ts +14 -0
- package/s/dom/parts/eve.ts +24 -0
- package/s/dom/{register.ts → parts/register.ts} +2 -7
- package/s/dom/types.ts +39 -2
- package/s/index.html.ts +4 -2
- package/s/index.ts +7 -18
- package/s/loaders/index.barrel.ts +9 -0
- package/s/loaders/index.ts +3 -0
- package/s/loaders/make.ts +14 -0
- package/s/loaders/mock.ts +11 -0
- package/s/{ops/loaders → loaders}/parts/anims.ts +1 -1
- package/s/{ops/loaders → loaders}/parts/ascii-anim.ts +4 -3
- package/s/{ops/loaders → loaders}/parts/error-display.ts +2 -2
- package/s/loaders/types.ts +6 -0
- package/s/loot/drag-and-drops.ts +82 -0
- package/s/loot/{drop.ts → drops.ts} +8 -17
- package/s/loot/helpers.ts +3 -3
- package/s/loot/index.barrel.ts +5 -0
- package/s/loot/index.ts +1 -3
- package/s/ops/index.ts +5 -0
- package/s/ops/op.ts +3 -2
- package/s/spa/index.barrel.ts +6 -0
- package/s/spa/index.ts +3 -0
- package/s/spa/plumbing/braces.ts +76 -0
- package/s/spa/plumbing/primitives.ts +85 -0
- package/s/spa/plumbing/router-core.ts +49 -0
- package/s/spa/plumbing/types.ts +45 -0
- package/s/spa/router.ts +49 -0
- package/s/spa/spa.test.ts +91 -0
- package/s/tests.test.ts +4 -1
- package/s/view/index.ts +6 -0
- package/s/view/types.ts +40 -0
- package/s/view/utils/make-component.ts +34 -0
- package/s/view/utils/make-view.ts +48 -0
- package/s/view/utils/parts/capsule.ts +67 -0
- package/s/view/utils/parts/chain.ts +33 -0
- package/s/view/utils/parts/context.ts +10 -0
- package/s/view/utils/parts/directive.ts +29 -0
- package/s/view/utils/parts/set-attrs.ts +33 -0
- package/s/view/utils/parts/sly-view.ts +15 -0
- package/s/view/view.ts +24 -0
- package/x/base/css-reset.js.map +1 -0
- package/x/base/element.d.ts +19 -0
- package/x/base/element.js +52 -0
- package/x/base/element.js.map +1 -0
- package/x/base/index.d.ts +3 -0
- package/x/base/index.js +4 -0
- package/x/base/index.js.map +1 -0
- package/x/{views → base}/use.d.ts +5 -5
- package/x/{views → base}/use.js +9 -11
- package/x/base/use.js.map +1 -0
- package/x/base/utils/apply-styles.js.map +1 -0
- package/x/base/utils/attr-watcher.d.ts +8 -0
- package/x/base/utils/attr-watcher.js +20 -0
- package/x/base/utils/attr-watcher.js.map +1 -0
- package/x/base/utils/mounts.js.map +1 -0
- package/x/base/utils/reactor.d.ts +5 -0
- package/x/base/utils/reactor.js +25 -0
- package/x/base/utils/reactor.js.map +1 -0
- package/x/base/utils/use-attrs.d.ts +11 -0
- package/x/base/utils/use-attrs.js +19 -0
- package/x/base/utils/use-attrs.js.map +1 -0
- package/x/demo/demo.bundle.js +8 -4
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +19 -22
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/views/counter.d.ts +374 -1
- package/x/demo/views/counter.js +19 -22
- package/x/demo/views/counter.js.map +1 -1
- package/x/demo/views/demo.d.ts +4 -1
- package/x/demo/views/demo.js +10 -5
- package/x/demo/views/demo.js.map +1 -1
- package/x/demo/views/fastcount.d.ts +12 -0
- package/x/demo/views/fastcount.js +21 -0
- package/x/demo/views/fastcount.js.map +1 -0
- package/x/demo/views/loaders.js +6 -6
- package/x/demo/views/loaders.js.map +1 -1
- package/x/dom/attrs/attrs.d.ts +20 -0
- package/x/dom/attrs/attrs.js +17 -0
- package/x/dom/attrs/attrs.js.map +1 -0
- package/x/dom/attrs/parts/attr-fns.d.ts +13 -0
- package/x/dom/attrs/parts/attr-fns.js +42 -0
- package/x/dom/attrs/parts/attr-fns.js.map +1 -0
- package/x/dom/attrs/parts/attr-proxies.d.ts +8 -0
- package/x/dom/attrs/parts/attr-proxies.js +21 -0
- package/x/dom/attrs/parts/attr-proxies.js.map +1 -0
- package/x/dom/attrs/parts/attr-spec.d.ts +3 -0
- package/x/dom/attrs/parts/attr-spec.js +21 -0
- package/x/dom/attrs/parts/attr-spec.js.map +1 -0
- package/x/dom/attrs/parts/on-attrs.d.ts +2 -0
- package/x/dom/attrs/parts/on-attrs.js +7 -0
- package/x/dom/attrs/parts/on-attrs.js.map +1 -0
- package/x/dom/dom.d.ts +22 -7
- package/x/dom/dom.js +32 -12
- package/x/dom/dom.js.map +1 -1
- package/x/dom/index.d.ts +2 -0
- package/x/dom/index.js +3 -0
- package/x/dom/index.js.map +1 -0
- package/x/dom/parts/dashify.js.map +1 -0
- package/x/dom/parts/el.d.ts +2 -0
- package/x/dom/parts/el.js +7 -0
- package/x/dom/parts/el.js.map +1 -0
- package/x/dom/parts/eve.d.ts +7 -0
- package/x/dom/parts/eve.js +16 -0
- package/x/dom/parts/eve.js.map +1 -0
- package/x/dom/{register.d.ts → parts/register.d.ts} +2 -6
- package/x/dom/parts/register.js.map +1 -0
- package/x/dom/types.d.ts +14 -2
- package/x/index.d.ts +7 -15
- package/x/index.html +6 -4
- package/x/index.html.js +4 -2
- package/x/index.html.js.map +1 -1
- package/x/index.js +7 -15
- package/x/index.js.map +1 -1
- package/x/loaders/index.barrel.d.ts +6 -0
- package/x/loaders/index.barrel.js +7 -0
- package/x/loaders/index.barrel.js.map +1 -0
- package/x/loaders/index.d.ts +1 -0
- package/x/loaders/index.js +2 -0
- package/x/loaders/index.js.map +1 -0
- package/x/loaders/make.d.ts +3 -0
- package/x/loaders/make.js +6 -0
- package/x/loaders/make.js.map +1 -0
- package/x/loaders/mock.d.ts +2 -0
- package/x/loaders/mock.js +8 -0
- package/x/loaders/mock.js.map +1 -0
- package/x/{ops/loaders → loaders}/parts/anims.d.ts +1 -1
- package/x/loaders/parts/anims.js.map +1 -0
- package/x/{ops/loaders → loaders}/parts/ascii-anim.d.ts +2 -2
- package/x/{ops/loaders → loaders}/parts/ascii-anim.js +2 -2
- package/x/loaders/parts/ascii-anim.js.map +1 -0
- package/x/loaders/parts/error-display.d.ts +1 -0
- package/x/{ops/loaders → loaders}/parts/error-display.js +2 -2
- package/x/loaders/parts/error-display.js.map +1 -0
- package/x/loaders/types.d.ts +3 -0
- package/x/loaders/types.js.map +1 -0
- package/x/loot/drag-and-drops.d.ts +30 -0
- package/x/loot/drag-and-drops.js +63 -0
- package/x/loot/drag-and-drops.js.map +1 -0
- package/x/loot/{drop.d.ts → drops.d.ts} +3 -5
- package/x/loot/drops.js +25 -0
- package/x/loot/drops.js.map +1 -0
- package/x/loot/helpers.d.ts +3 -3
- package/x/loot/helpers.js +3 -3
- package/x/loot/helpers.js.map +1 -1
- package/x/loot/index.barrel.d.ts +3 -0
- package/x/loot/index.barrel.js +4 -0
- package/x/loot/index.barrel.js.map +1 -0
- package/x/loot/index.d.ts +1 -3
- package/x/loot/index.js +1 -3
- package/x/loot/index.js.map +1 -1
- package/x/ops/index.d.ts +3 -0
- package/x/ops/index.js +4 -0
- package/x/ops/index.js.map +1 -0
- package/x/ops/op.d.ts +2 -2
- package/x/ops/op.js +3 -2
- package/x/ops/op.js.map +1 -1
- package/x/spa/index.barrel.d.ts +4 -0
- package/x/spa/index.barrel.js +3 -0
- package/x/spa/index.barrel.js.map +1 -0
- package/x/spa/index.d.ts +1 -0
- package/x/spa/index.js +2 -0
- package/x/spa/index.js.map +1 -0
- package/x/spa/plumbing/braces.d.ts +12 -0
- package/x/spa/plumbing/braces.js +55 -0
- package/x/spa/plumbing/braces.js.map +1 -0
- package/x/spa/plumbing/primitives.d.ts +22 -0
- package/x/spa/plumbing/primitives.js +65 -0
- package/x/spa/plumbing/primitives.js.map +1 -0
- package/x/spa/plumbing/router-core.d.ts +13 -0
- package/x/spa/plumbing/router-core.js +38 -0
- package/x/spa/plumbing/router-core.js.map +1 -0
- package/x/spa/plumbing/types.d.ts +35 -0
- package/x/spa/plumbing/types.js +2 -0
- package/x/spa/plumbing/types.js.map +1 -0
- package/x/spa/router.d.ts +16 -0
- package/x/spa/router.js +39 -0
- package/x/spa/router.js.map +1 -0
- package/x/spa/spa.test.d.ts +15 -0
- package/x/spa/spa.test.js +78 -0
- package/x/spa/spa.test.js.map +1 -0
- package/x/tests.test.js +4 -1
- package/x/tests.test.js.map +1 -1
- package/x/view/index.d.ts +4 -0
- package/x/view/index.js +5 -0
- package/x/view/index.js.map +1 -0
- package/x/view/types.d.ts +22 -0
- package/x/view/types.js +2 -0
- package/x/{views → view}/types.js.map +1 -1
- package/x/view/utils/make-component.d.ts +5 -0
- package/x/view/utils/make-component.js +17 -0
- package/x/view/utils/make-component.js.map +1 -0
- package/x/view/utils/make-view.d.ts +2 -0
- package/x/view/utils/make-view.js +24 -0
- package/x/view/utils/make-view.js.map +1 -0
- package/x/view/utils/parts/capsule.d.ts +13 -0
- package/x/view/utils/parts/capsule.js +49 -0
- package/x/view/utils/parts/capsule.js.map +1 -0
- package/x/view/utils/parts/chain.d.ts +11 -0
- package/x/view/utils/parts/chain.js +21 -0
- package/x/view/utils/parts/chain.js.map +1 -0
- package/x/view/utils/parts/context.d.ts +8 -0
- package/x/view/utils/parts/context.js +10 -0
- package/x/view/utils/parts/context.js.map +1 -0
- package/x/view/utils/parts/directive.d.ts +5 -0
- package/x/view/utils/parts/directive.js +18 -0
- package/x/view/utils/parts/directive.js.map +1 -0
- package/x/view/utils/parts/set-attrs.d.ts +3 -0
- package/x/view/utils/parts/set-attrs.js +21 -0
- package/x/view/utils/parts/set-attrs.js.map +1 -0
- package/x/view/utils/parts/sly-view.d.ts +5 -0
- package/x/view/utils/parts/sly-view.js +13 -0
- package/x/view/utils/parts/sly-view.js.map +1 -0
- package/x/view/view.d.ts +11 -0
- package/x/view/view.js +15 -0
- package/x/view/view.js.map +1 -0
- package/s/loot/drag-drop.ts +0 -76
- package/s/ops/loaders/make-loader.ts +0 -18
- package/s/views/attributes.ts +0 -89
- package/s/views/types.ts +0 -40
- package/s/views/utils/apply-attrs.ts +0 -33
- package/s/views/view.ts +0 -150
- package/x/dom/dashify.js.map +0 -1
- package/x/dom/register.js.map +0 -1
- package/x/loot/drag-drop.d.ts +0 -29
- package/x/loot/drag-drop.js +0 -54
- package/x/loot/drag-drop.js.map +0 -1
- package/x/loot/drop.js +0 -32
- package/x/loot/drop.js.map +0 -1
- package/x/ops/loaders/make-loader.d.ts +0 -5
- package/x/ops/loaders/make-loader.js +0 -7
- package/x/ops/loaders/make-loader.js.map +0 -1
- package/x/ops/loaders/parts/anims.js.map +0 -1
- package/x/ops/loaders/parts/ascii-anim.js.map +0 -1
- package/x/ops/loaders/parts/error-display.d.ts +0 -1
- package/x/ops/loaders/parts/error-display.js.map +0 -1
- package/x/views/attributes.d.ts +0 -10
- package/x/views/attributes.js +0 -46
- package/x/views/attributes.js.map +0 -1
- package/x/views/css-reset.js.map +0 -1
- package/x/views/types.d.ts +0 -31
- package/x/views/use.js.map +0 -1
- package/x/views/utils/apply-attrs.d.ts +0 -2
- package/x/views/utils/apply-attrs.js +0 -21
- package/x/views/utils/apply-attrs.js.map +0 -1
- package/x/views/utils/apply-styles.js.map +0 -1
- package/x/views/utils/mounts.js.map +0 -1
- package/x/views/view.d.ts +0 -9
- package/x/views/view.js +0 -116
- package/x/views/view.js.map +0 -1
- /package/s/{views → base}/css-reset.ts +0 -0
- /package/s/{views → base}/utils/apply-styles.ts +0 -0
- /package/s/{views → base}/utils/mounts.ts +0 -0
- /package/s/dom/{dashify.ts → parts/dashify.ts} +0 -0
- /package/x/{views → base}/css-reset.d.ts +0 -0
- /package/x/{views → base}/css-reset.js +0 -0
- /package/x/{views → base}/utils/apply-styles.d.ts +0 -0
- /package/x/{views → base}/utils/apply-styles.js +0 -0
- /package/x/{views → base}/utils/mounts.d.ts +0 -0
- /package/x/{views → base}/utils/mounts.js +0 -0
- /package/x/dom/{dashify.d.ts → parts/dashify.d.ts} +0 -0
- /package/x/dom/{dashify.js → parts/dashify.js} +0 -0
- /package/x/dom/{register.js → parts/register.js} +0 -0
- /package/x/{ops/loaders → loaders}/parts/anims.js +0 -0
- /package/x/{views → loaders}/types.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSResultGroup } from "lit";
|
|
2
|
+
import { Content } from "../view/types.js";
|
|
3
|
+
import { Use } from "./use.js";
|
|
4
|
+
export declare class BaseElement extends HTMLElement {
|
|
5
|
+
#private;
|
|
6
|
+
static styles: CSSResultGroup | undefined;
|
|
7
|
+
readonly shadow: ShadowRoot;
|
|
8
|
+
/** create the shadow root. override this if you want to change the shadow root settings. */
|
|
9
|
+
createShadow(): ShadowRoot;
|
|
10
|
+
constructor();
|
|
11
|
+
/** return some content to render. */
|
|
12
|
+
render(_use: Use): Content;
|
|
13
|
+
/** immediately perform a fresh render into the shadow root. */
|
|
14
|
+
updateNow: () => void;
|
|
15
|
+
/** request a rerender which will happen soon (debounced). */
|
|
16
|
+
update: import("@e280/stz").DebounceReturn<() => void>;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { debounce } from "@e280/stz";
|
|
2
|
+
import { dom } from "../dom/dom.js";
|
|
3
|
+
import { Reactor } from "./utils/reactor.js";
|
|
4
|
+
import { AttrWatcher } from "./utils/attr-watcher.js";
|
|
5
|
+
import { applyStyles } from "./utils/apply-styles.js";
|
|
6
|
+
import { Use, _disconnect, _reconnect, _wrap } from "./use.js";
|
|
7
|
+
export class BaseElement extends HTMLElement {
|
|
8
|
+
static styles;
|
|
9
|
+
shadow;
|
|
10
|
+
#use;
|
|
11
|
+
#mountCount = 0;
|
|
12
|
+
#reactor = new Reactor();
|
|
13
|
+
#attrWatcher = new AttrWatcher(this, () => this.update());
|
|
14
|
+
/** create the shadow root. override this if you want to change the shadow root settings. */
|
|
15
|
+
createShadow() {
|
|
16
|
+
return this.attachShadow({ mode: "open" });
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.shadow = this.createShadow();
|
|
21
|
+
this.#use = new Use(this, this.shadow, this.updateNow, this.update);
|
|
22
|
+
}
|
|
23
|
+
/** return some content to render. */
|
|
24
|
+
render(_use) { }
|
|
25
|
+
/** immediately perform a fresh render into the shadow root. */
|
|
26
|
+
updateNow = () => {
|
|
27
|
+
this.#use[_wrap](() => {
|
|
28
|
+
dom.render(this.shadow, this.#reactor.effect(() => this.render(this.#use), this.update));
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
/** request a rerender which will happen soon (debounced). */
|
|
32
|
+
update = debounce(0, this.updateNow);
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
if (this.#mountCount === 0) {
|
|
35
|
+
const styles = this.constructor.styles;
|
|
36
|
+
if (styles)
|
|
37
|
+
applyStyles(this.shadow, styles);
|
|
38
|
+
this.updateNow();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.#use[_reconnect]();
|
|
42
|
+
}
|
|
43
|
+
this.#attrWatcher.start();
|
|
44
|
+
this.#mountCount++;
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
this.#use[_disconnect]();
|
|
48
|
+
this.#reactor.clear();
|
|
49
|
+
this.#attrWatcher.stop();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../s/base/element.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAGlC,OAAO,EAAC,GAAG,EAAC,MAAM,eAAe,CAAA;AAEjC,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAC,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,UAAU,CAAA;AAE5D,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC3C,MAAM,CAAC,MAAM,CAA4B;IAEhC,MAAM,CAAY;IAE3B,IAAI,CAAK;IACT,WAAW,GAAG,CAAC,CAAA;IACf,QAAQ,GAAG,IAAI,OAAO,EAAE,CAAA;IACxB,YAAY,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IAEzD,4FAA4F;IAC5F,YAAY;QACX,OAAO,IAAI,CAAC,YAAY,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IACzC,CAAC;IAED;QACC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAClB,IAAI,EACJ,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,MAAM,CACX,CAAA;IACF,CAAC;IAED,qCAAqC;IACrC,MAAM,CAAC,IAAS,IAAY,CAAC;IAE7B,+DAA+D;IAC/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7 +1,7 @@
|
|
|
1
1
|
import { CSSResultGroup } from "lit";
|
|
2
2
|
import { SignalOptions } from "@e280/strata/signals";
|
|
3
3
|
import { Op } from "../ops/op.js";
|
|
4
|
-
import {
|
|
4
|
+
import { UseAttrs } from "./utils/use-attrs.js";
|
|
5
5
|
export declare const _wrap: unique symbol;
|
|
6
6
|
export declare const _disconnect: unique symbol;
|
|
7
7
|
export declare const _reconnect: unique symbol;
|
|
@@ -11,6 +11,7 @@ export declare class Use {
|
|
|
11
11
|
shadow: ShadowRoot;
|
|
12
12
|
renderNow: () => void;
|
|
13
13
|
render: () => Promise<void>;
|
|
14
|
+
readonly attrs: UseAttrs;
|
|
14
15
|
[_wrap]<R>(fn: () => R): R;
|
|
15
16
|
[_disconnect](): void;
|
|
16
17
|
[_reconnect](): void;
|
|
@@ -21,21 +22,20 @@ export declare class Use {
|
|
|
21
22
|
styles(...styles: CSSResultGroup[]): void;
|
|
22
23
|
/** alias for 'styles' */
|
|
23
24
|
css(...styles: CSSResultGroup[]): void;
|
|
24
|
-
attrs<A extends AttrSpec>(spec: A): import("./attributes.js").AttrTypes<A>;
|
|
25
25
|
once<V>(fn: () => V): V;
|
|
26
26
|
mount(fn: () => () => void): void;
|
|
27
27
|
life<V>(fn: () => [result: V, dispose: () => void]): V;
|
|
28
28
|
wake<V>(fn: () => V): V;
|
|
29
29
|
op: {
|
|
30
30
|
<V>(f: () => Promise<V>): Op<V>;
|
|
31
|
-
|
|
31
|
+
load: <V>(f: () => Promise<V>) => Op<V>;
|
|
32
32
|
promise<V>(p: Promise<V>): Op<V>;
|
|
33
33
|
};
|
|
34
34
|
signal: {
|
|
35
35
|
<V>(value: V, options?: Partial<SignalOptions>): import("@e280/strata/signals").SignalFn<V>;
|
|
36
|
-
|
|
36
|
+
derived<V>(formula: () => V, options?: Partial<SignalOptions>): import("@e280/strata/signals").DerivedFn<V>;
|
|
37
37
|
lazy<V>(formula: () => V, options?: Partial<SignalOptions>): import("@e280/strata/signals").LazyFn<V>;
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
derived<V>(formula: () => V, options?: Partial<SignalOptions>): import("@e280/strata/signals").DerivedFn<V>;
|
|
40
40
|
lazy<V>(formula: () => V, options?: Partial<SignalOptions>): import("@e280/strata/signals").LazyFn<V>;
|
|
41
41
|
}
|
package/x/{views → base}/use.js
RENAMED
|
@@ -2,8 +2,8 @@ import { defer, MapG } from "@e280/stz";
|
|
|
2
2
|
import { signal } from "@e280/strata/signals";
|
|
3
3
|
import { Op } from "../ops/op.js";
|
|
4
4
|
import { Mounts } from "./utils/mounts.js";
|
|
5
|
+
import { UseAttrs } from "./utils/use-attrs.js";
|
|
5
6
|
import { applyStyles } from "./utils/apply-styles.js";
|
|
6
|
-
import { attributes, onAttrChange } from "./attributes.js";
|
|
7
7
|
export const _wrap = Symbol();
|
|
8
8
|
export const _disconnect = Symbol();
|
|
9
9
|
export const _reconnect = Symbol();
|
|
@@ -12,6 +12,7 @@ export class Use {
|
|
|
12
12
|
shadow;
|
|
13
13
|
renderNow;
|
|
14
14
|
render;
|
|
15
|
+
attrs;
|
|
15
16
|
#runs = 0;
|
|
16
17
|
#position = 0;
|
|
17
18
|
#values = new MapG();
|
|
@@ -38,6 +39,7 @@ export class Use {
|
|
|
38
39
|
this.shadow = shadow;
|
|
39
40
|
this.renderNow = renderNow;
|
|
40
41
|
this.render = render;
|
|
42
|
+
this.attrs = new UseAttrs(this);
|
|
41
43
|
}
|
|
42
44
|
get renderCount() {
|
|
43
45
|
return this.#runs;
|
|
@@ -55,10 +57,6 @@ export class Use {
|
|
|
55
57
|
css(...styles) {
|
|
56
58
|
return this.styles(...styles);
|
|
57
59
|
}
|
|
58
|
-
attrs(spec) {
|
|
59
|
-
this.mount(() => onAttrChange(this.element, this.render));
|
|
60
|
-
return this.once(() => attributes(this.element, spec));
|
|
61
|
-
}
|
|
62
60
|
once(fn) {
|
|
63
61
|
return this.#values.guarantee(this.#position++, fn);
|
|
64
62
|
}
|
|
@@ -80,9 +78,9 @@ export class Use {
|
|
|
80
78
|
op = (() => {
|
|
81
79
|
const that = this;
|
|
82
80
|
function op(f) {
|
|
83
|
-
return that.once(() => Op.
|
|
81
|
+
return that.once(() => Op.load(f));
|
|
84
82
|
}
|
|
85
|
-
op.
|
|
83
|
+
op.load = op;
|
|
86
84
|
op.promise = (p) => this.once(() => Op.promise(p));
|
|
87
85
|
return op;
|
|
88
86
|
})();
|
|
@@ -91,16 +89,16 @@ export class Use {
|
|
|
91
89
|
function sig(value, options) {
|
|
92
90
|
return that.once(() => signal(value, options));
|
|
93
91
|
}
|
|
94
|
-
sig.
|
|
95
|
-
return that.once(() => signal.
|
|
92
|
+
sig.derived = function derived(formula, options) {
|
|
93
|
+
return that.once(() => signal.derived(formula, options));
|
|
96
94
|
};
|
|
97
95
|
sig.lazy = function lazy(formula, options) {
|
|
98
96
|
return that.once(() => signal.lazy(formula, options));
|
|
99
97
|
};
|
|
100
98
|
return sig;
|
|
101
99
|
})();
|
|
102
|
-
|
|
103
|
-
return this.once(() => signal.
|
|
100
|
+
derived(formula, options) {
|
|
101
|
+
return this.once(() => signal.derived(formula, options));
|
|
104
102
|
}
|
|
105
103
|
lazy(formula, options) {
|
|
106
104
|
return this.once(() => signal.lazy(formula, options));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../s/base/use.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,WAAW,CAAA;AACrC,OAAO,EAAC,MAAM,EAAgB,MAAM,sBAAsB,CAAA;AAE1D,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAA;AAC/B,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAA;AAEnD,MAAM,CAAC,MAAM,KAAK,GAAG,MAA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IAAI,CAAI,OAAgB,EAAE,OAAgC;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAI,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IACzD,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-styles.js","sourceRoot":"","sources":["../../../s/base/utils/apply-styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAqC,kBAAkB,EAAC,MAAM,KAAK,CAAA;AAEtF,MAAM,UAAU,WAAW,CAAC,MAAkB,EAAE,MAAuB;IACtE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,aAAa,CAAC,MAAuB;IAC7C,MAAM,aAAa,GAAG,EAAE,CAAA;IAExB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAE,MAAyB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;QACxE,KAAK,MAAM,CAAC,IAAI,GAAG;YAClB,aAAa,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAsB,CAAC,CAAC,CAAA;IACnE,CAAC;SACI,IAAI,MAAM,KAAK,SAAS;QAC5B,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAA;IAE/C,OAAO,aAAa,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { dom } from "../../dom/dom.js";
|
|
2
|
+
export class AttrWatcher {
|
|
3
|
+
element;
|
|
4
|
+
response;
|
|
5
|
+
#stopper;
|
|
6
|
+
constructor(element, response) {
|
|
7
|
+
this.element = element;
|
|
8
|
+
this.response = response;
|
|
9
|
+
}
|
|
10
|
+
start() {
|
|
11
|
+
if (!this.#stopper)
|
|
12
|
+
this.#stopper = dom.attrs(this.element).on(this.response);
|
|
13
|
+
}
|
|
14
|
+
stop() {
|
|
15
|
+
if (this.#stopper)
|
|
16
|
+
this.#stopper();
|
|
17
|
+
this.#stopper = undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=attr-watcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attr-watcher.js","sourceRoot":"","sources":["../../../s/base/utils/attr-watcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAEpC,MAAM,OAAO,WAAW;IAId;IACA;IAJT,QAAQ,CAA0B;IAElC,YACS,OAAoB,EACpB,QAAoB;QADpB,YAAO,GAAP,OAAO,CAAa;QACpB,aAAQ,GAAR,QAAQ,CAAY;IAC1B,CAAC;IAEJ,KAAK;QACJ,IAAI,CAAC,IAAI,CAAC,QAAQ;YACjB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC3D,CAAC;IAED,IAAI;QACH,IAAI,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,EAAE,CAAA;QAClC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAA;IAC1B,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mounts.js","sourceRoot":"","sources":["../../../s/base/utils/mounts.ts"],"names":[],"mappings":"AACA,MAAM,OAAO,MAAM;IAClB,SAAS,GAAyB,EAAE,CAAA;IACpC,WAAW,GAAmB,EAAE,CAAA;IAEhC,KAAK,CAAC,KAAuB;QAC5B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC1B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;IAC/B,CAAC;IAED,UAAU;QACT,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,WAAW;YACrC,OAAO,EAAE,CAAA;QACV,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA;IACtB,CAAC;IAED,UAAU;QACT,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS;YACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;IAChC,CAAC;CACD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MapG } from "@e280/stz";
|
|
2
|
+
import { tracker } from "@e280/strata";
|
|
3
|
+
export class Reactor {
|
|
4
|
+
#map = new MapG();
|
|
5
|
+
effect(collect, respond) {
|
|
6
|
+
const { seen, result } = tracker.observe(collect);
|
|
7
|
+
// add seen items
|
|
8
|
+
for (const item of seen)
|
|
9
|
+
this.#map.guarantee(item, () => tracker.subscribe(item, respond));
|
|
10
|
+
// remove orphaned items
|
|
11
|
+
for (const [item, dispose] of this.#map) {
|
|
12
|
+
if (!seen.has(item)) {
|
|
13
|
+
dispose();
|
|
14
|
+
this.#map.delete(item);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
for (const dispose of this.#map.values())
|
|
21
|
+
dispose();
|
|
22
|
+
this.#map.clear();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=reactor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactor.js","sourceRoot":"","sources":["../../../s/base/utils/reactor.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AAEpC,MAAM,OAAO,OAAO;IACnB,IAAI,GAAG,IAAI,IAAI,EAAmB,CAAA;IAElC,MAAM,CAAI,OAAgB,EAAE,OAA4B;QACvD,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAE/C,iBAAiB;QACjB,KAAK,MAAM,IAAI,IAAI,IAAI;YACtB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;QAElE,wBAAwB;QACxB,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACzC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,OAAO,EAAE,CAAA;gBACT,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YACvB,CAAC;QACF,CAAC;QAED,OAAO,MAAM,CAAA;IACd,CAAC;IAED,KAAK;QACJ,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACvC,OAAO,EAAE,CAAA;QACV,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;IAClB,CAAC;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Use } from "../use.js";
|
|
2
|
+
import { AttrSpec } from "../../dom/types.js";
|
|
3
|
+
export declare class UseAttrs {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(use: Use);
|
|
6
|
+
get strings(): Record<string, string | undefined>;
|
|
7
|
+
get numbers(): Record<string, number | undefined>;
|
|
8
|
+
get booleans(): Record<string, boolean | undefined>;
|
|
9
|
+
spec<A extends AttrSpec>(spec: A): import("../../dom/types.js").AttrTypes<A>;
|
|
10
|
+
on(fn: () => void): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { dom } from "../../dom/dom.js";
|
|
2
|
+
export class UseAttrs {
|
|
3
|
+
#use;
|
|
4
|
+
#attrs;
|
|
5
|
+
constructor(use) {
|
|
6
|
+
this.#use = use;
|
|
7
|
+
this.#attrs = dom.attrs(use.element);
|
|
8
|
+
}
|
|
9
|
+
get strings() { return this.#attrs.strings; }
|
|
10
|
+
get numbers() { return this.#attrs.numbers; }
|
|
11
|
+
get booleans() { return this.#attrs.booleans; }
|
|
12
|
+
spec(spec) {
|
|
13
|
+
return this.#use.once(() => this.#attrs.spec(spec));
|
|
14
|
+
}
|
|
15
|
+
on(fn) {
|
|
16
|
+
return this.#use.mount(() => this.#attrs.on(fn));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=use-attrs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-attrs.js","sourceRoot":"","sources":["../../../s/base/utils/use-attrs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAGpC,MAAM,OAAO,QAAQ;IACpB,IAAI,CAAK;IACT,MAAM,CAAO;IAEb,YAAY,GAAQ;QACnB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;QACf,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA,CAAC,CAAC;IAC5C,IAAI,OAAO,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA,CAAC,CAAC;IAC5C,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAC;IAE9C,IAAI,CAAqB,IAAO;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACpD,CAAC;IAED,EAAE,CAAC,EAAc;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACjD,CAAC;CACD"}
|
package/x/demo/demo.bundle.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { dom } from "../dom/dom.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
dom.register({
|
|
2
|
+
import { CounterComponent } from "./views/counter.js";
|
|
3
|
+
import { DemoComponent } from "./views/demo.js";
|
|
4
|
+
import { FastcountElement } from "./views/fastcount.js";
|
|
5
|
+
dom.register({
|
|
6
|
+
DemoComponent,
|
|
7
|
+
CounterComponent,
|
|
8
|
+
FastcountElement,
|
|
9
|
+
});
|
|
6
10
|
console.log("🦝 sly");
|
|
7
11
|
//# sourceMappingURL=demo.bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demo.bundle.js","sourceRoot":"","sources":["../../s/demo/demo.bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,eAAe,CAAA;AACjC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"demo.bundle.js","sourceRoot":"","sources":["../../s/demo/demo.bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,eAAe,CAAA;AACjC,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAErD,GAAG,CAAC,QAAQ,CAAC;IACZ,aAAa;IACb,gBAAgB;IAChB,gBAAgB;CAChB,CAAC,CAAA;AAEF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA"}
|