@e280/sly 0.3.0-1 â 0.3.0-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/README.md +14 -13
- package/package.json +1 -1
- package/s/demo/demo.bundle.ts +1 -1
- package/s/dom/dom.ts +1 -1
- package/s/view/shadow.ts +1 -1
- package/x/demo/demo.bundle.js +1 -1
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +1 -1
- package/x/demo/demo.bundle.min.js.map +2 -2
- package/x/dom/dom.d.ts +1 -1
- package/x/dom/dom.js.map +1 -1
- package/x/index.html +2 -2
- package/x/view/shadow.d.ts +0 -1
- package/x/view/shadow.js +1 -1
- package/x/view/shadow.js.map +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install lit @e280/sly @e280/strata @e280/stz
|
|
|
10
10
|
|
|
11
11
|
[@e280](https://e280.org/)'s new [lit](https://lit.dev/)-based frontend webdev library.
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- ð [**#views**](#views) â light-dom or shadow-dom reactive lit views
|
|
14
14
|
- ðŠ [**#hooks**](#hooks) â full reference of available view hooks
|
|
15
15
|
- ðŦ [**#ops**](#ops) â reactive tooling for async operations
|
|
16
16
|
- âģ [**#loaders**](#loaders) â animated loading spinners for rendering ops
|
|
@@ -23,12 +23,13 @@ npm install lit @e280/sly @e280/strata @e280/stz
|
|
|
23
23
|
<br/><br/>
|
|
24
24
|
<a id="views"></a>
|
|
25
25
|
|
|
26
|
-
##
|
|
27
|
-
> *
|
|
26
|
+
## ð views
|
|
27
|
+
> *reactive views, light or shadow*
|
|
28
28
|
|
|
29
29
|
- ðŠķ **no compile step** â just god's honest javascript, via [lit](https://lit.dev/)-html tagged-template-literals
|
|
30
30
|
- ⥠**reactive** â views auto-rerender whenever any [strata](https://github.com/e280/strata)-compatible state changes
|
|
31
|
-
- ðŠ **hooks-based** â
|
|
31
|
+
- ðŠ **hooks-based** â familiar react-style [hooks](#hooks)
|
|
32
|
+
- ð **light or shadow** â render directly in the dom, or inside a shadow-dom bubble
|
|
32
33
|
|
|
33
34
|
```ts
|
|
34
35
|
import {html} from "lit"
|
|
@@ -58,7 +59,7 @@ export const MyShadowView = shadow(() => html`<p>shrouded in darkness</p>`)
|
|
|
58
59
|
```
|
|
59
60
|
- **render it into the dom**
|
|
60
61
|
```ts
|
|
61
|
-
dom.
|
|
62
|
+
dom.render(dom(".demo"), html`
|
|
62
63
|
<h1>my cool counter demo</h1>
|
|
63
64
|
${MyCounter(123)}
|
|
64
65
|
`)
|
|
@@ -87,14 +88,14 @@ export const MyShadowView = shadow(() => html`<p>shrouded in darkness</p>`)
|
|
|
87
88
|
```
|
|
88
89
|
- **render it into the dom**
|
|
89
90
|
```ts
|
|
90
|
-
dom.
|
|
91
|
+
dom.render(dom(".demo"), html`
|
|
91
92
|
<h1>my cool counter demo</h1>
|
|
92
93
|
${MyShadowCounter(234)}
|
|
93
94
|
`)
|
|
94
95
|
```
|
|
95
96
|
- **.with to nest children or set attrs**
|
|
96
97
|
```ts
|
|
97
|
-
dom.
|
|
98
|
+
dom.render(dom(".demo"), html`
|
|
98
99
|
<h1>my cool counter demo</h1>
|
|
99
100
|
|
|
100
101
|
${MyShadowCounter.with({
|
|
@@ -106,9 +107,9 @@ export const MyShadowView = shadow(() => html`<p>shrouded in darkness</p>`)
|
|
|
106
107
|
})}
|
|
107
108
|
`)
|
|
108
109
|
```
|
|
109
|
-
- **
|
|
110
|
+
- **you can do custom shadow config if needed**
|
|
110
111
|
```ts
|
|
111
|
-
const
|
|
112
|
+
const MyShadowView = shadow.config(() => {
|
|
112
113
|
const host = document.createElement("div")
|
|
113
114
|
const shadow = host.attachShadow({mode: "open"})
|
|
114
115
|
return {host, shadow}
|
|
@@ -661,10 +662,10 @@ import {dom} from "@e280/sly"
|
|
|
661
662
|
```
|
|
662
663
|
or if you wanna be more loosey-goosey, skip the spec
|
|
663
664
|
```ts
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
665
|
+
const {attrs} = dom.in(".demo")
|
|
666
|
+
attrs.strings.name = "pimsley"
|
|
667
|
+
attrs.numbers.count = 125
|
|
668
|
+
attrs.booleans.active = true
|
|
668
669
|
```
|
|
669
670
|
|
|
670
671
|
|
package/package.json
CHANGED
package/s/demo/demo.bundle.ts
CHANGED
package/s/dom/dom.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {register} from "./parts/register.js"
|
|
|
11
11
|
import {Queryable, Renderable} from "./types.js"
|
|
12
12
|
import {queryAll, queryMaybe, queryRequire} from "./parts/queries.js"
|
|
13
13
|
|
|
14
|
-
export function dom<E extends
|
|
14
|
+
export function dom<E extends HTMLElement>(selector: string, container: Queryable = document) {
|
|
15
15
|
return queryRequire<E>(selector, container)
|
|
16
16
|
}
|
|
17
17
|
|
package/s/view/shadow.ts
CHANGED
package/x/demo/demo.bundle.js
CHANGED
|
@@ -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,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAEpC,GAAG,CAAC,
|
|
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,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAEpC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;AAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA"}
|