@e280/sly 0.0.0-1 → 0.0.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 +183 -3
- package/package.json +3 -5
- package/s/demo/demo.bundle.ts +49 -0
- package/s/demo/demo.css +6 -0
- package/s/features/dom/dashify.ts +11 -0
- package/s/features/dom/dollar.ts +21 -0
- package/s/features/dom/register.ts +48 -0
- package/s/features/dom/types.ts +5 -0
- package/s/features/loady/ascii-loader.ts +38 -0
- package/s/features/loady/parts/ascii-anim.ts +27 -0
- package/s/features/loady/parts/ascii-loader.ts +14 -0
- package/s/features/loady/parts/error-display.ts +26 -0
- package/s/features/op/op.ts +98 -0
- package/s/features/op/pod.ts +19 -0
- package/s/features/op/types.ts +12 -0
- package/s/features/views/css-reset.ts +21 -0
- package/s/features/views/types.ts +23 -0
- package/s/features/views/use.ts +75 -0
- package/s/features/views/utils/apply-attrs.ts +33 -0
- package/s/features/views/utils/apply-styles.ts +21 -0
- package/s/features/views/utils/mounts.ts +22 -0
- package/s/features/views/view.ts +98 -0
- package/s/index.html.ts +2 -1
- package/s/index.ts +18 -0
- package/x/demo/demo.bundle.d.ts +1 -0
- package/x/demo/demo.bundle.js +37 -1
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +72 -1
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/demo.css +6 -0
- package/x/features/dom/dashify.d.ts +7 -0
- package/x/features/dom/dashify.js +10 -0
- package/x/features/dom/dashify.js.map +1 -0
- package/x/features/dom/dollar.d.ts +8 -0
- package/x/features/dom/dollar.js +15 -0
- package/x/features/dom/dollar.js.map +1 -0
- package/x/features/dom/register.d.ts +18 -0
- package/x/features/dom/register.js +29 -0
- package/x/features/dom/register.js.map +1 -0
- package/x/features/dom/types.d.ts +5 -0
- package/x/features/dom/types.js +2 -0
- package/x/features/dom/types.js.map +1 -0
- package/x/features/loady/ascii-loader.d.ts +5 -0
- package/x/features/loady/ascii-loader.js +33 -0
- package/x/features/loady/ascii-loader.js.map +1 -0
- package/x/features/loady/parts/ascii-anim.d.ts +8 -0
- package/x/features/loady/parts/ascii-anim.js +21 -0
- package/x/features/loady/parts/ascii-anim.js.map +1 -0
- package/x/features/loady/parts/ascii-loader.d.ts +3 -0
- package/x/features/loady/parts/ascii-loader.js +10 -0
- package/x/features/loady/parts/ascii-loader.js.map +1 -0
- package/x/features/loady/parts/error-display.d.ts +8 -0
- package/x/features/loady/parts/error-display.js +20 -0
- package/x/features/loady/parts/error-display.js.map +1 -0
- package/x/features/op/op.d.ts +21 -0
- package/x/features/op/op.js +79 -0
- package/x/features/op/op.js.map +1 -0
- package/x/features/op/pod.d.ts +5 -0
- package/x/features/op/pod.js +16 -0
- package/x/features/op/pod.js.map +1 -0
- package/x/features/op/types.d.ts +9 -0
- package/x/features/op/types.js +2 -0
- package/x/features/op/types.js.map +1 -0
- package/x/features/views/css-reset.d.ts +2 -0
- package/x/features/views/css-reset.js +19 -0
- package/x/features/views/css-reset.js.map +1 -0
- package/x/features/views/types.d.ts +16 -0
- package/x/features/views/types.js +2 -0
- package/x/features/views/types.js.map +1 -0
- package/x/features/views/use.d.ts +25 -0
- package/x/features/views/use.js +62 -0
- package/x/features/views/use.js.map +1 -0
- package/x/features/views/utils/apply-attrs.d.ts +2 -0
- package/x/features/views/utils/apply-attrs.js +21 -0
- package/x/features/views/utils/apply-attrs.js.map +1 -0
- package/x/features/views/utils/apply-styles.d.ts +2 -0
- package/x/features/views/utils/apply-styles.js +16 -0
- package/x/features/views/utils/apply-styles.js.map +1 -0
- package/x/features/views/utils/mounts.d.ts +6 -0
- package/x/features/views/utils/mounts.js +18 -0
- package/x/features/views/utils/mounts.js.map +1 -0
- package/x/features/views/view.d.ts +16 -0
- package/x/features/views/view.js +81 -0
- package/x/features/views/view.js.map +1 -0
- package/x/index.d.ts +13 -0
- package/x/index.html +10 -3
- package/x/index.html.js +2 -1
- package/x/index.html.js.map +1 -1
- package/x/index.js +13 -1
- package/x/index.js.map +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
import {CSSResultGroup} from "lit"
|
|
3
|
+
import {defer, MapG} from "@e280/stz"
|
|
4
|
+
import {signal} from "@e280/strata/signals"
|
|
5
|
+
|
|
6
|
+
import {Op} from "../op/op.js"
|
|
7
|
+
import {Mounts} from "./utils/mounts.js"
|
|
8
|
+
import {applyStyles} from "./utils/apply-styles.js"
|
|
9
|
+
|
|
10
|
+
export const _wrap = Symbol()
|
|
11
|
+
export const _disconnect = Symbol()
|
|
12
|
+
export const _reconnect = Symbol()
|
|
13
|
+
|
|
14
|
+
export class Use {
|
|
15
|
+
#runs = 0
|
|
16
|
+
#position = 0
|
|
17
|
+
#values = new MapG<number, any>()
|
|
18
|
+
#rendered = defer()
|
|
19
|
+
#mounts = new Mounts()
|
|
20
|
+
|
|
21
|
+
;[_wrap](fn: () => void) {
|
|
22
|
+
this.#runs++
|
|
23
|
+
this.#position = 0
|
|
24
|
+
this.#rendered = defer()
|
|
25
|
+
fn()
|
|
26
|
+
this.#rendered.resolve()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
;[_disconnect]() {
|
|
30
|
+
this.#mounts.unmountAll()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
;[_reconnect]() {
|
|
34
|
+
this.#mounts.remountAll()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
public element: HTMLElement,
|
|
39
|
+
public shadow: ShadowRoot,
|
|
40
|
+
) {}
|
|
41
|
+
|
|
42
|
+
get renderCount() {
|
|
43
|
+
return this.#runs
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get rendered() {
|
|
47
|
+
return this.#rendered.promise
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
once<V>(fn: () => V) {
|
|
51
|
+
return this.#values.guarantee(this.#position++, fn) as V
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
styles(...styles: CSSResultGroup[]) {
|
|
55
|
+
this.once(() => applyStyles(this.shadow, styles))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
name(name: string) {
|
|
59
|
+
this.once(() => this.element.setAttribute("view", name))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
signal<V>(value: V) {
|
|
63
|
+
return this.once(() => signal<V>(value))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
mount(mount: () => () => void) {
|
|
67
|
+
return this.once(() => this.#mounts.mount(mount))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
op = {
|
|
71
|
+
promise: <V>(p: Promise<V>) => this.once(() => Op.promise(p)),
|
|
72
|
+
fn: <V>(f: () => Promise<V>) => this.once(() => Op.fn(f)),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import {AttrValue} from "../types.js"
|
|
3
|
+
|
|
4
|
+
export function applyAttrs(
|
|
5
|
+
element: HTMLElement,
|
|
6
|
+
attrs: Record<string, AttrValue>,
|
|
7
|
+
) {
|
|
8
|
+
|
|
9
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
10
|
+
if (value === undefined)
|
|
11
|
+
element.removeAttribute(key)
|
|
12
|
+
|
|
13
|
+
else if (value === null)
|
|
14
|
+
element.removeAttribute(key)
|
|
15
|
+
|
|
16
|
+
else if (typeof value === "string")
|
|
17
|
+
element.setAttribute(key, value)
|
|
18
|
+
|
|
19
|
+
else if (typeof value === "number")
|
|
20
|
+
element.setAttribute(key, value.toString())
|
|
21
|
+
|
|
22
|
+
else if (typeof value === "boolean") {
|
|
23
|
+
if (value === true)
|
|
24
|
+
element.setAttribute(key, "")
|
|
25
|
+
else
|
|
26
|
+
element.removeAttribute(key)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
else
|
|
30
|
+
console.warn(`invalid attribute type ${key} is ${typeof value}`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import {adoptStyles, CSSResultGroup, CSSResultOrNative, getCompatibleStyle} from "lit"
|
|
3
|
+
|
|
4
|
+
export function applyStyles(shadow: ShadowRoot, styles?: CSSResultGroup) {
|
|
5
|
+
adoptStyles(shadow, prepareStyles(styles))
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function prepareStyles(styles?: CSSResultGroup): Array<CSSResultOrNative> {
|
|
9
|
+
const elementStyles = []
|
|
10
|
+
|
|
11
|
+
if (Array.isArray(styles)) {
|
|
12
|
+
const set = new Set((styles as Array<unknown>).flat(Infinity).reverse())
|
|
13
|
+
for (const s of set)
|
|
14
|
+
elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative))
|
|
15
|
+
}
|
|
16
|
+
else if (styles !== undefined)
|
|
17
|
+
elementStyles.push(getCompatibleStyle(styles))
|
|
18
|
+
|
|
19
|
+
return elementStyles
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
export class Mounts {
|
|
3
|
+
#mounters: (() => () => void)[] = []
|
|
4
|
+
#unmounters: (() => void)[] = []
|
|
5
|
+
|
|
6
|
+
mount(mount: () => () => void) {
|
|
7
|
+
this.#mounters.push(mount)
|
|
8
|
+
this.#unmounters.push(mount())
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
unmountAll() {
|
|
12
|
+
for (const unmount of this.#unmounters)
|
|
13
|
+
unmount()
|
|
14
|
+
this.#unmounters = []
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
remountAll() {
|
|
18
|
+
for (const mount of this.#mounters)
|
|
19
|
+
this.#unmounters.push(mount())
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
import {render} from "lit"
|
|
3
|
+
import {debounce, MapG} from "@e280/stz"
|
|
4
|
+
import {tracker} from "@e280/strata/tracker"
|
|
5
|
+
import {AsyncDirective} from "lit/async-directive.js"
|
|
6
|
+
import {directive, DirectiveResult} from "lit/directive.js"
|
|
7
|
+
|
|
8
|
+
import {register} from "../dom/register.js"
|
|
9
|
+
import {applyAttrs} from "./utils/apply-attrs.js"
|
|
10
|
+
import {applyStyles} from "./utils/apply-styles.js"
|
|
11
|
+
import {Use, _wrap, _disconnect, _reconnect} from "./use.js"
|
|
12
|
+
import {AttrValue, Content, ViewFn, ViewSettings, ViewWith} from "./types.js"
|
|
13
|
+
|
|
14
|
+
export const view = setupView({mode: "open"})
|
|
15
|
+
export class SlyView extends HTMLElement {}
|
|
16
|
+
register({SlyView}, {soft: true, upgrade: true})
|
|
17
|
+
|
|
18
|
+
function setupView(settings: ViewSettings) {
|
|
19
|
+
function view<Props extends any[]>(fn: ViewFn<Props>) {
|
|
20
|
+
class ViewDirective extends AsyncDirective {
|
|
21
|
+
#element = document.createElement(settings.tag ?? "sly-view")
|
|
22
|
+
#shadow = this.#element.attachShadow(settings)
|
|
23
|
+
#use = new Use(this.#element, this.#shadow)
|
|
24
|
+
#fn = (() => {
|
|
25
|
+
const fn2 = fn(this.#use)
|
|
26
|
+
this.#element.setAttribute("view", settings.name ?? "")
|
|
27
|
+
if (settings.styles) applyStyles(this.#shadow, settings.styles)
|
|
28
|
+
return fn2
|
|
29
|
+
})()
|
|
30
|
+
|
|
31
|
+
#tracking = new MapG<any, () => void>
|
|
32
|
+
|
|
33
|
+
#render = debounce(0, (w: ViewWith, props: Props) => {
|
|
34
|
+
if (!this.isConnected) return
|
|
35
|
+
this.#use[_wrap](() => {
|
|
36
|
+
// apply html attributes
|
|
37
|
+
applyAttrs(this.#element, w.attrs)
|
|
38
|
+
|
|
39
|
+
// render the template, tracking strata items
|
|
40
|
+
const {result, seen} = tracker.seen(() => this.#fn(...props))
|
|
41
|
+
|
|
42
|
+
// inject the template
|
|
43
|
+
render(result, this.#shadow)
|
|
44
|
+
|
|
45
|
+
// reacting to changes
|
|
46
|
+
for (const item of seen)
|
|
47
|
+
this.#tracking.guarantee(
|
|
48
|
+
item,
|
|
49
|
+
() => tracker.changed(item, async() => this.#render(w, props)),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
// inject content into light dom
|
|
53
|
+
render(w.children, this.#element)
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
render(w: ViewWith, props: Props) {
|
|
58
|
+
this.#render(w, props)
|
|
59
|
+
return this.#element
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
disconnected() {
|
|
63
|
+
this.#use[_disconnect]()
|
|
64
|
+
for (const untrack of this.#tracking.values())
|
|
65
|
+
untrack()
|
|
66
|
+
this.#tracking.clear()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
reconnected() {
|
|
70
|
+
this.#use[_reconnect]()
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function setupDirective(w: ViewWith) {
|
|
75
|
+
const r = directive(ViewDirective)
|
|
76
|
+
const rend = (...props: Props): DirectiveResult<any> => r(w, props)
|
|
77
|
+
rend.props = rend
|
|
78
|
+
rend.with = (w2: Partial<ViewWith>) => setupDirective({...w, ...w2})
|
|
79
|
+
rend.children = (children: Content) => setupDirective({...w, children})
|
|
80
|
+
rend.attrs = (attrs: Record<string, AttrValue>) => setupDirective({...w, attrs})
|
|
81
|
+
rend.attr = (name: string, value: AttrValue) => setupDirective({
|
|
82
|
+
...w,
|
|
83
|
+
attrs: {...w.attrs, [name]: value},
|
|
84
|
+
})
|
|
85
|
+
return rend
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return setupDirective({
|
|
89
|
+
attrs: {},
|
|
90
|
+
children: null,
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
view.view = view
|
|
95
|
+
view.settings = (settings2: Partial<ViewSettings>) => setupView({...settings, ...settings2})
|
|
96
|
+
return view
|
|
97
|
+
}
|
|
98
|
+
|
package/s/index.html.ts
CHANGED
|
@@ -28,7 +28,8 @@ export default ssg.page(import.meta.url, async orb => ({
|
|
|
28
28
|
<img class=icon alt="" src="/assets/favicon.png"/>
|
|
29
29
|
<h1>sly</h1>
|
|
30
30
|
<p class=lil>v${orb.packageVersion()}</p>
|
|
31
|
-
<
|
|
31
|
+
<div class=demo></div>
|
|
32
|
+
<p><a href="https://github.com/e280/sly">github.com/e280/sly</a></p>
|
|
32
33
|
`,
|
|
33
34
|
}))
|
|
34
35
|
|
package/s/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
export * from "./features/dom/dashify.js"
|
|
3
|
+
export * from "./features/dom/dollar.js"
|
|
4
|
+
export * from "./features/dom/register.js"
|
|
5
|
+
export * from "./features/dom/types.js"
|
|
6
|
+
|
|
7
|
+
export * from "./features/loady/ascii-loader.js"
|
|
8
|
+
export * from "./features/loady/parts/error-display.js"
|
|
9
|
+
|
|
10
|
+
export * from "./features/op/op.js"
|
|
11
|
+
export * from "./features/op/pod.js"
|
|
12
|
+
export * from "./features/op/types.js"
|
|
13
|
+
|
|
14
|
+
export * from "./features/views/css-reset.js"
|
|
15
|
+
export * from "./features/views/types.js"
|
|
16
|
+
export * from "./features/views/use.js"
|
|
17
|
+
export * from "./features/views/view.js"
|
|
18
|
+
|
package/x/demo/demo.bundle.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/x/demo/demo.bundle.js
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { nap, repeat } from "@e280/stz";
|
|
2
|
+
import { css, html, render } from "lit";
|
|
3
|
+
import { $ } from "../features/dom/dollar.js";
|
|
4
|
+
import { view } from "../features/views/view.js";
|
|
5
|
+
import { cssReset } from "../features/views/css-reset.js";
|
|
6
|
+
import { loady } from "../features/loady/ascii-loader.js";
|
|
2
7
|
console.log("🦝 sly");
|
|
8
|
+
const styles = css `
|
|
9
|
+
:host {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const MyView = view(use => (greeting) => {
|
|
17
|
+
use.name("my-view");
|
|
18
|
+
use.styles(cssReset, styles);
|
|
19
|
+
const count = use.signal(0);
|
|
20
|
+
use.mount(() => repeat(async () => {
|
|
21
|
+
await nap(1000);
|
|
22
|
+
count.value++;
|
|
23
|
+
}));
|
|
24
|
+
use.once(() => use.rendered.then(() => {
|
|
25
|
+
console.log("slot", $("slot", use.shadow));
|
|
26
|
+
}));
|
|
27
|
+
const op = use.op.fn(async () => {
|
|
28
|
+
await nap(5000);
|
|
29
|
+
});
|
|
30
|
+
return html `
|
|
31
|
+
<p>${greeting} <slot></slot> ${count()}</p>
|
|
32
|
+
<p>${loady.dots(op, () => "op loaded")}</p>
|
|
33
|
+
`;
|
|
34
|
+
});
|
|
35
|
+
render(MyView
|
|
36
|
+
.attr("class", "incredi")
|
|
37
|
+
.children("world")
|
|
38
|
+
.props("hello"), $(".demo"));
|
|
3
39
|
//# sourceMappingURL=demo.bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demo.bundle.js","sourceRoot":"","sources":["../../s/demo/demo.bundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"demo.bundle.js","sourceRoot":"","sources":["../../s/demo/demo.bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,MAAM,EAAC,MAAM,WAAW,CAAA;AACrC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,KAAK,CAAA;AAErC,OAAO,EAAC,CAAC,EAAC,MAAM,2BAA2B,CAAA;AAC3C,OAAO,EAAC,IAAI,EAAC,MAAM,2BAA2B,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,gCAAgC,CAAA;AACvD,OAAO,EAAC,KAAK,EAAC,MAAM,mCAAmC,CAAA;AAEvD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAErB,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;CAOjB,CAAA;AAED,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAgB,EAAE,EAAE;IAC/C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACnB,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAE3B,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,IAAG,EAAE;QAChC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAA;QACf,KAAK,CAAC,KAAK,EAAE,CAAA;IACd,CAAC,CAAC,CAAC,CAAA;IAEH,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAC,CAAA;IAEH,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,IAAG,EAAE;QAC9B,MAAM,GAAG,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;OACL,QAAQ,kBAAkB,KAAK,EAAE;OACjC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC;EACtC,CAAA;AACF,CAAC,CAAC,CAAA;AAEF,MAAM,CACL,MAAM;KACJ,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC;KACxB,QAAQ,CAAC,OAAO,CAAC;KACjB,KAAK,CAAC,OAAO,CAAC,EAChB,CAAC,CAAC,OAAO,CAAC,CACV,CAAA"}
|
|
@@ -1,2 +1,73 @@
|
|
|
1
|
-
console.log("\u{1F99D} sly");
|
|
1
|
+
var d=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;for(let e=0;e<=r.length;e++)if(r.at(e)!==t.at(e))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var x=Object.freeze({fromBytes(r){return[...r].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)t[e/2]=parseInt(r.slice(e,e+2),16);return t},random(r=32){return this.fromBytes(d.random(r))},string(r){return x.fromBytes(r)},bytes(r){return x.toBytes(r)}});var xt=58,J="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",_t=Object.freeze({fromBytes(r){let t=BigInt("0x"+x.fromBytes(r)),e="";for(;t>0;){let s=t%BigInt(xt);t=t/BigInt(xt),e=J[Number(s)]+e}for(let s of r)if(s===0)e=J[0]+e;else break;return e},toBytes(r){let t=BigInt(0);for(let i of r){let c=J.indexOf(i);if(c===-1)throw new Error(`Invalid character '${i}' in base58 string`);t=t*BigInt(xt)+BigInt(c)}let e=t.toString(16);e.length%2!==0&&(e="0"+e);let s=x.toBytes(e),o=0;for(let i of r)if(i===J[0])o++;else break;let n=new Uint8Array(o+s.length);return n.set(s,o),n},random(r=32){return this.fromBytes(d.random(r))},string(r){return _t.fromBytes(r)},bytes(r){return _t.toBytes(r)}});var Wt=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef"},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(t){this.lexicon=t,this.lookup=Object.fromEntries([...t.characters].map((e,s)=>[e,s])),this.negativePrefix=t.negativePrefix??"-"}toBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let c=0,a=0,l=[];for(let u of t){if(u===this.lexicon.padding?.character)continue;let h=this.lookup[u];if(h===void 0)throw new Error(`Invalid character: ${u}`);for(c=c<<e|h,a+=e;a>=8;)a-=8,l.push(c>>a&255)}return new Uint8Array(l)}let s=0n,o=BigInt(this.lexicon.characters.length),n=!1;t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),n=!0);for(let c of t){let a=this.lookup[c];if(a===void 0)throw new Error(`Invalid character: ${c}`);s=s*o+BigInt(a)}let i=[];for(;s>0n;)i.unshift(Number(s%256n)),s=s/256n;return new Uint8Array(i)}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let i=0,c=0,a="";for(let l of t)for(i=i<<8|l,c+=8;c>=e;){c-=e;let u=i>>c&(1<<e)-1;a+=this.lexicon.characters[u]}if(c>0){let l=i<<e-c&(1<<e)-1;a+=this.lexicon.characters[l]}if(this.lexicon.padding)for(;a.length%this.lexicon.padding.size!==0;)a+=this.lexicon.padding.character;return a}let s=0n;for(let i of t)s=(s<<8n)+BigInt(i);if(s===0n)return this.lexicon.characters[0];let o=BigInt(this.lexicon.characters.length),n="";for(;s>0n;)n=this.lexicon.characters[Number(s%o)]+n,s=s/o;return n}toInteger(t){if(!t)return 0;let e=0n,s=!1,o=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),s=!0);for(let n of t){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);e=e*o+BigInt(i)}return Number(s?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,s=BigInt(e?-t:t);if(s===0n)return this.lexicon.characters[0];let o=BigInt(this.lexicon.characters.length),n="";for(;s>0n;)n=this.lexicon.characters[Number(s%o)]+n,s=s/o;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(d.random(t))}};var At=Object.freeze({fromBytes(r){return typeof btoa=="function"?btoa(String.fromCharCode(...r)):Buffer.from(r).toString("base64")},toBytes(r){return typeof atob=="function"?Uint8Array.from(atob(r),t=>t.charCodeAt(0)):Uint8Array.from(Buffer.from(r,"base64"))},random(r=32){return this.fromBytes(d.random(r))},string(r){return At.fromBytes(r)},bytes(r){return At.toBytes(r)}});var Ft=Object.freeze({fromBytes(r){return new TextDecoder().decode(r)},toBytes(r){return new TextEncoder().encode(r)},string(r){return Ft.fromBytes(r)},bytes(r){return Ft.toBytes(r)}});function G(r,t){let e,s,o=[];function n(){e=[],s&&clearTimeout(s),s=void 0,o=[]}return n(),((...i)=>{e=i,s&&clearTimeout(s);let c=new Promise((a,l)=>{o.push({resolve:a,reject:l})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:l}of o)l(a);n()}).catch(a=>{for(let{reject:l}of o)l(a);n()})},r),c})}var wt=Object.freeze({set:r=>r!=null,unset:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});function H(){let r,t,e=new Promise((o,n)=>{r=o,t=n});function s(o){return o.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:s}}var C=class r extends Map{static require(t,e){if(t.has(e))return t.get(e);throw new Error(`required key not found: "${e}"`)}static guarantee(t,e,s){if(t.has(e))return t.get(e);{let o=s();return t.set(e,o),o}}array(){return[...this]}require(t){return r.require(this,t)}guarantee(t,e){return r.guarantee(this,t,e)}};var N=(r=0)=>new Promise(t=>setTimeout(t,r));function ve(r){return{map:t=>Zt(r,t),filter:t=>Kt(r,t)}}ve.pipe=Object.freeze({map:r=>(t=>Zt(t,r)),filter:r=>(t=>Kt(t,r))});var Zt=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,s])=>[e,t(s,e)])),Kt=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,s])=>t(s,e)));function Y(r){let t,e=!1,s=()=>{e=!0,clearTimeout(t)},o=async()=>{e||(await r(s),!e&&(t=setTimeout(o,0)))};return o(),s}function Qt(){let r=new Set;function t(n){return r.add(n),()=>{r.delete(n)}}async function e(...n){await Promise.all([...r].map(i=>i(...n)))}async function s(){let{promise:n,resolve:i}=H(),c=t((...a)=>{i(a),c()});return n}function o(){r.clear()}return t.pub=e,t.sub=t,t.on=t,t.next=s,t.clear=o,e.pub=e,e.sub=t,e.on=t,e.next=s,e.clear=o,[e,t]}function X(r){let t=Qt()[1];return r&&t.sub(r),t}function vt(r){let t=Qt()[0];return r&&t.sub(r),t}var tt=globalThis,et=tt.ShadowRoot&&(tt.ShadyCSS===void 0||tt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,St=Symbol(),Jt=new WeakMap,R=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==St)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(et&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=Jt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Jt.set(e,t))}return t}toString(){return this.cssText}},Gt=r=>new R(typeof r=="string"?r:r+"",void 0,St),y=(r,...t)=>{let e=r.length===1?r[0]:t.reduce(((s,o,n)=>s+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[n+1]),r[0]);return new R(e,r,St)},rt=(r,t)=>{if(et)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let s=document.createElement("style"),o=tt.litNonce;o!==void 0&&s.setAttribute("nonce",o),s.textContent=e.cssText,r.appendChild(s)}},P=et?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return Gt(e)})(r):r;var{is:Se,defineProperty:Ee,getOwnPropertyDescriptor:Be,getOwnPropertyNames:Ce,getOwnPropertySymbols:Pe,getPrototypeOf:Oe}=Object,st=globalThis,Yt=st.trustedTypes,ke=Yt?Yt.emptyScript:"",Te=st.reactiveElementPolyfillSupport,z=(r,t)=>r,Et={toAttribute(r,t){switch(t){case Boolean:r=r?ke:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},te=(r,t)=>!Se(r,t),Xt={attribute:!0,type:String,converter:Et,reflect:!1,useDefault:!1,hasChanged:te};Symbol.metadata??=Symbol("metadata"),st.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Xt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),o=this.getPropertyDescriptor(t,s,e);o!==void 0&&Ee(this.prototype,t,o)}}static getPropertyDescriptor(t,e,s){let{get:o,set:n}=Be(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:o,set(i){let c=o?.call(this);n?.call(this,i),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Xt}static _$Ei(){if(this.hasOwnProperty(z("elementProperties")))return;let t=Oe(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(z("properties"))){let e=this.properties,s=[...Ce(e),...Pe(e)];for(let o of s)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,o]of e)this.elementProperties.set(s,o)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let o=this._$Eu(e,s);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let o of s)e.unshift(P(o))}else t!==void 0&&e.push(P(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return rt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,s);if(o!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:Et).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,o=s._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let n=s.getPropertyOptions(o),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Et;this._$Em=o,this[o]=i.fromAttribute(e,n.type)??this._$Ej?.get(o)??null,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){let o=this.constructor,n=this[t];if(s??=o.getPropertyOptions(t),!((s.hasChanged??te)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:o,wrapped:n},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[o,n]of s){let{wrapped:i}=n,c=this[o];i!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,n,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};g.elementStyles=[],g.shadowRootOptions={mode:"open"},g[z("elementProperties")]=new Map,g[z("finalized")]=new Map,Te?.({ReactiveElement:g}),(st.reactiveElementVersions??=[]).push("2.1.0");var Ct=globalThis,ot=Ct.trustedTypes,ee=ot?ot.createPolicy("lit-html",{createHTML:r=>r}):void 0,Pt="$lit$",b=`lit$${Math.random().toFixed(9).slice(2)}$`,Ot="?"+b,je=`<${Ot}>`,w=document,I=()=>w.createComment(""),L=r=>r===null||typeof r!="object"&&typeof r!="function",kt=Array.isArray,ae=r=>kt(r)||typeof r?.[Symbol.iterator]=="function",Bt=`[
|
|
2
|
+
\f\r]`,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,re=/-->/g,se=/>/g,_=RegExp(`>|${Bt}(?:([^\\s"'>=/]+)(${Bt}*=${Bt}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),oe=/'/g,ne=/"/g,ce=/^(?:script|style|textarea|title)$/i,Tt=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),ht=Tt(1),Ws=Tt(2),Fs=Tt(3),v=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ie=new WeakMap,A=w.createTreeWalker(w,129);function le(r,t){if(!kt(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ee!==void 0?ee.createHTML(t):t}var he=(r,t)=>{let e=r.length-1,s=[],o,n=t===2?"<svg>":t===3?"<math>":"",i=D;for(let c=0;c<e;c++){let a=r[c],l,u,h=-1,m=0;for(;m<a.length&&(i.lastIndex=m,u=i.exec(a),u!==null);)m=i.lastIndex,i===D?u[1]==="!--"?i=re:u[1]!==void 0?i=se:u[2]!==void 0?(ce.test(u[2])&&(o=RegExp("</"+u[2],"g")),i=_):u[3]!==void 0&&(i=_):i===_?u[0]===">"?(i=o??D,h=-1):u[1]===void 0?h=-2:(h=i.lastIndex-u[2].length,l=u[1],i=u[3]===void 0?_:u[3]==='"'?ne:oe):i===ne||i===oe?i=_:i===re||i===se?i=D:(i=_,o=void 0);let $=i===_&&r[c+1].startsWith("/>")?" ":"";n+=i===D?a+je:h>=0?(s.push(l),a.slice(0,h)+Pt+a.slice(h)+b+$):a+b+(h===-2?c:$)}return[le(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},q=class r{constructor({strings:t,_$litType$:e},s){let o;this.parts=[];let n=0,i=0,c=t.length-1,a=this.parts,[l,u]=he(t,e);if(this.el=r.createElement(l,s),A.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=A.nextNode())!==null&&a.length<c;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Pt)){let m=u[i++],$=o.getAttribute(h).split(b),Q=/([.?@])?(.*)/.exec(m);a.push({type:1,index:n,name:Q[2],strings:$,ctor:Q[1]==="."?it:Q[1]==="?"?at:Q[1]==="@"?ct:E}),o.removeAttribute(h)}else h.startsWith(b)&&(a.push({type:6,index:n}),o.removeAttribute(h));if(ce.test(o.tagName)){let h=o.textContent.split(b),m=h.length-1;if(m>0){o.textContent=ot?ot.emptyScript:"";for(let $=0;$<m;$++)o.append(h[$],I()),A.nextNode(),a.push({type:2,index:++n});o.append(h[m],I())}}}else if(o.nodeType===8)if(o.data===Ot)a.push({type:2,index:n});else{let h=-1;for(;(h=o.data.indexOf(b,h+1))!==-1;)a.push({type:7,index:n}),h+=b.length-1}n++}}static createElement(t,e){let s=w.createElement("template");return s.innerHTML=t,s}};function S(r,t,e=r,s){if(t===v)return t;let o=s!==void 0?e._$Co?.[s]:e._$Cl,n=L(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(r),o._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=o:e._$Cl=o),o!==void 0&&(t=S(r,o._$AS(r,t.values),o,s)),t}var nt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,o=(t?.creationScope??w).importNode(e,!0);A.currentNode=o;let n=A.nextNode(),i=0,c=0,a=s[0];for(;a!==void 0;){if(i===a.index){let l;a.type===2?l=new O(n,n.nextSibling,this,t):a.type===1?l=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(l=new lt(n,this,t)),this._$AV.push(l),a=s[++c]}i!==a?.index&&(n=A.nextNode(),i++)}return A.currentNode=w,o}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},O=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),L(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==v&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ae(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&L(this._$AH)?this._$AA.nextSibling.data=t:this.T(w.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=q.createElement(le(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===o)this._$AH.p(e);else{let n=new nt(o,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=ie.get(t.strings);return e===void 0&&ie.set(t.strings,e=new q(t)),e}k(t){kt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,o=0;for(let n of t)o===e.length?e.push(s=new r(this.O(I()),this.O(I()),this,this.options)):s=e[o],s._$AI(n),o++;o<e.length&&(this._$AR(s&&s._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},E=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,o,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(t,e=this,s,o){let n=this.strings,i=!1;if(n===void 0)t=S(this,t,e,0),i=!L(t)||t!==this._$AH&&t!==v,i&&(this._$AH=t);else{let c=t,a,l;for(t=n[0],a=0;a<n.length-1;a++)l=S(this,c[s+a],e,a),l===v&&(l=this._$AH[a]),i||=!L(l)||l!==this._$AH[a],l===p?t=p:t!==p&&(t+=(l??"")+n[a+1]),this._$AH[a]=l}i&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},it=class extends E{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},at=class extends E{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},ct=class extends E{constructor(t,e,s,o,n){super(t,e,s,o,n),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??p)===v)return;let s=this._$AH,o=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==p&&(s===p||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},lt=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}},ue={M:Pt,P:b,A:Ot,C:1,L:he,R:nt,D:ae,V:S,I:O,H:E,N:at,U:ct,B:it,F:lt},Me=Ct.litHtmlPolyfillSupport;Me?.(q,O),(Ct.litHtmlVersions??=[]).push("3.3.0");var B=(r,t,e)=>{let s=e?.renderBefore??t,o=s._$litPart$;if(o===void 0){let n=e?.renderBefore??null;s._$litPart$=o=new O(t.insertBefore(I(),n),n,void 0,e??{})}return o._$AI(r),o};var jt=globalThis,k=class extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return v}};k._$litElement$=!0,k.finalized=!0,jt.litElementHydrateSupport?.({LitElement:k});var Ue=jt.litElementPolyfillSupport;Ue?.({LitElement:k});(jt.litElementVersions??=[]).push("4.2.0");var Mt=Ut;function He(r,t=document){return Array.from(t.querySelectorAll(r))}function Ut(r,t=document){let e=t.querySelector(r);if(!e)throw new Error(`$1 ${r} not found`);return e}Ut.maybe=(r,t=document)=>t.querySelector(r);Ut.all=He;var Ht=class{#t=[];#e=new WeakMap;#r=[];#o=new Set;see(t){this.#t.at(-1)?.add(t)}seen(t){this.#t.push(new Set);let e=t();return{seen:this.#t.pop(),result:e}}async change(t){if(this.#o.has(t))throw new Error("circularity forbidden");let e=this.#s(t).pub();return this.#r.at(-1)?.add(e),e}changed(t,e){return this.#s(t)(async()=>{let s=new Set;this.#r.push(s),this.#o.add(t),s.add(e()),this.#o.delete(t),await Promise.all(s),this.#r.pop()})}#s(t){let e=this.#e.get(t);return e||(e=X(),this.#e.set(t,e)),e}},Ne=Symbol.for("e280.tracker.v2"),f=globalThis[Ne]??=new Ht;var{I:uo}=ue;var pe=r=>r.strings===void 0;var fe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Nt=r=>(...t)=>({_$litDirective$:r,values:t}),ut=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var V=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),V(s,t);return!0},pt=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},de=r=>{for(let t;t=r._$AM;r=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(r))break;e.add(r),De(t)}};function Re(r){this._$AN!==void 0?(pt(this),this._$AM=r,de(this)):this._$AM=r}function ze(r,t=!1,e=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)V(s[n],!1),pt(s[n]);else s!=null&&(V(s,!1),pt(s));else V(this,r)}var De=r=>{r.type==fe.CHILD&&(r._$AP??=ze,r._$AQ??=Re)},ft=class extends ut{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),de(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(V(this,t),pt(this))}setValue(t){if(pe(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};function me(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function ye(r,t={}){let{soft:e=!1,upgrade:s=!0}=t;for(let[o,n]of Object.entries(r)){let i=me(o),c=customElements.get(i);e&&c||(customElements.define(i,n),s&&document.querySelectorAll(i).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}function ge(r,t){for(let[e,s]of Object.entries(t))s===void 0||s===null?r.removeAttribute(e):typeof s=="string"?r.setAttribute(e,s):typeof s=="number"?r.setAttribute(e,s.toString()):typeof s=="boolean"?s===!0?r.setAttribute(e,""):r.removeAttribute(e):console.warn(`invalid attribute type ${e} is ${typeof s}`)}function dt(r,t){rt(r,Ie(t))}function Ie(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let s of e)t.unshift(P(s))}else r!==void 0&&t.push(P(r));return t}function Rt(r,t=r){let{seen:e,result:s}=f.seen(r),o=G(0,t),n=[],i=()=>n.forEach(c=>c());for(let c of e){let a=f.changed(c,o);n.push(a)}return{result:s,dispose:i}}var Le={compare:(r,t)=>r===t};function T(r={}){return{...Le,...r}}var mt=class{sneak;constructor(t){this.sneak=t}get(){return f.see(this),this.sneak}get value(){return this.get()}},yt=class extends mt{on=X();dispose(){this.on.clear()}},W=class extends yt{_options;kind="signal";_lock=!1;constructor(t,e){super(t),this._options=e}async set(t){return!this._options.compare(this.sneak,t)&&await this.publish(t),t}get value(){return this.get()}set value(t){this.set(t)}async publish(t=this.get()){if(this._lock)throw new Error("forbid circularity");let e=Promise.resolve();try{this._lock=!0,this.sneak=t,e=Promise.all([f.change(this),this.on.pub(t)])}finally{this._lock=!1}return await e,t}},F=class extends mt{_formula;_options;kind="lazy";_dirty=!1;_effect;constructor(t,e){super(void 0),this._formula=t,this._options=e}get(){if(!this._effect){let{result:t,dispose:e}=Rt(this._formula,()=>this._dirty=!0);this._effect=e,this.sneak=t}if(this._dirty){this._dirty=!1;let t=this._formula();!this._options.compare(this.sneak,t)&&(this.sneak=t,f.change(this))}return super.get()}get value(){return this.get()}dispose(){this._effect&&this._effect()}},Z=class extends yt{_effect;static make(t,e,s){let{result:o,dispose:n}=Rt(e,async()=>{let i=e();!s.compare(t.sneak,i)&&(t.sneak=i,await Promise.all([f.change(t),t.on.pub(i)]))});return new this(o,n)}kind="derived";constructor(t,e){super(t),this._effect=e}get value(){return this.get()}dispose(){super.dispose(),this._effect()}};function be(r,t={}){function e(){return e.value}let s=T(t),o=new F(r,s);return Object.setPrototypeOf(e,F.prototype),Object.assign(e,o),e}function $e(r,t={}){function e(){return e.value}let s=T(t),o=Z.make(e,r,s);return Object.setPrototypeOf(e,Z.prototype),Object.assign(e,o),e}function j(r,t={}){function e(n){return n!==void 0?e.set(n):e.get()}let s=T(t),o=new W(r,s);return Object.setPrototypeOf(e,W.prototype),Object.assign(e,o),e}j.lazy=be;j.derive=$e;var zt={value:r=>r[0]==="ready"?r[1]:void 0,select:(r,t)=>{switch(r[0]){case"loading":return t.loading();case"error":return t.error(r[1]);case"ready":return t.ready(r[1]);default:throw new Error("unknown op status")}}};var K=class{static loading(){return new this}static ready(t){let e=new this;return e.signal(["ready",t]),e}static error(t){let e=new this;return e.signal(["error",t]),e}static promise(t){let e=new this;return e.promise(t),e}static fn(t){return this.promise(t())}signal=j(["loading"]);#t=vt();#e=vt();get wait(){return new Promise((t,e)=>{this.#t.next().then(t),this.#e.next().then(e)})}async setLoading(){await this.signal(["loading"])}async setReady(t){await this.signal(["ready",t]),await this.#t(t)}async setError(t){await this.signal(["error",t]),await this.#e(t)}async promise(t){await this.setLoading();try{let e=await t;return await this.setReady(e),e}catch(e){await this.setError(e)}}async fn(t){return this.promise(t())}get pod(){return this.signal()}get status(){return this.signal()[0]}get value(){return zt.value(this.signal())}require(){let t=this.signal();if(t[0]!=="ready")throw new Error("required value not ready");return t[1]}select(t){return zt.select(this.signal(),t)}};var gt=class{#t=[];#e=[];mount(t){this.#t.push(t),this.#e.push(t())}unmountAll(){for(let t of this.#e)t();this.#e=[]}remountAll(){for(let t of this.#t)this.#e.push(t())}};var Dt=Symbol(),It=Symbol(),Lt=Symbol(),bt=class{element;shadow;#t=0;#e=0;#r=new C;#o=H();#s=new gt;[Dt](t){this.#t++,this.#e=0,this.#o=H(),t(),this.#o.resolve()}[It](){this.#s.unmountAll()}[Lt](){this.#s.remountAll()}constructor(t,e){this.element=t,this.shadow=e}get renderCount(){return this.#t}get rendered(){return this.#o.promise}once(t){return this.#r.guarantee(this.#e++,t)}styles(...t){this.once(()=>dt(this.shadow,t))}name(t){this.once(()=>this.element.setAttribute("view",t))}signal(t){return this.once(()=>j(t))}mount(t){return this.once(()=>this.#s.mount(t))}op={promise:t=>this.once(()=>K.promise(t)),fn:t=>this.once(()=>K.fn(t))}};var M=xe({mode:"open"}),qt=class extends HTMLElement{};ye({SlyView:qt},{soft:!0,upgrade:!0});function xe(r){function t(e){class s extends ft{#t=document.createElement(r.tag??"sly-view");#e=this.#t.attachShadow(r);#r=new bt(this.#t,this.#e);#o=(()=>{let i=e(this.#r);return this.#t.setAttribute("view",r.name??""),r.styles&&dt(this.#e,r.styles),i})();#s=new C;#n=G(0,(i,c)=>{this.isConnected&&this.#r[Dt](()=>{ge(this.#t,i.attrs);let{result:a,seen:l}=f.seen(()=>this.#o(...c));B(a,this.#e);for(let u of l)this.#s.guarantee(u,()=>f.changed(u,async()=>this.#n(i,c)));B(i.children,this.#t)})});render(i,c){return this.#n(i,c),this.#t}disconnected(){this.#r[It]();for(let i of this.#s.values())i();this.#s.clear()}reconnected(){this.#r[Lt]()}}function o(n){let i=Nt(s),c=(...a)=>i(n,a);return c.props=c,c.with=a=>o({...n,...a}),c.children=a=>o({...n,children:a}),c.attrs=a=>o({...n,attrs:a}),c.attr=(a,l)=>o({...n,attrs:{...n.attrs,[a]:l}}),c}return o({attrs:{},children:null})}return t.view=t,t.settings=e=>xe({...r,...e}),t}var U=y`
|
|
4
|
+
@layer reset {
|
|
5
|
+
* {
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
|
|
10
|
+
scrollbar-width: thin;
|
|
11
|
+
scrollbar-color: #888 transparent;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
::-webkit-scrollbar { width: 8px; }
|
|
15
|
+
::-webkit-scrollbar-track { background: transparent; }
|
|
16
|
+
::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
|
|
17
|
+
::-webkit-scrollbar-thumb:hover { background: #444; }
|
|
18
|
+
}
|
|
19
|
+
`;var qe=y`
|
|
20
|
+
:host {
|
|
21
|
+
font-family: monospace;
|
|
22
|
+
}
|
|
23
|
+
`,_e=M(r=>(t,e)=>{r.name("loading"),r.styles(U,qe);let s=r.signal(0);return r.mount(()=>Y(async()=>{await N(1e3/t);let o=s()+1;s(o>=e.length?0:o)})),e.at(s())});var Ve=y`
|
|
24
|
+
:host {
|
|
25
|
+
font-family: monospace;
|
|
26
|
+
color: red;
|
|
27
|
+
}
|
|
28
|
+
`,Ae=M(r=>t=>(r.name("loading"),r.styles(U,Ve),typeof t=="string"?t:t instanceof Error?ht`<strong>${t.name}:</strong> <span>${t.message}</span>`:"error"));function $t(r,t){return(e,s)=>e.select({loading:()=>_e(r,t),error:o=>Ae(o),ready:s})}var Vt=15,we={cylon:$t(Vt,["=----","-=---","--=--","---=-","----=","-----","-----"]),dots:$t(Vt,[":....","::...",".::..","..::.","...::","....:",".....","....."]),binary:$t(Vt,["01111","10111","11011","11101","11110","11111","11111"])};console.log("\u{1F99D} sly");var We=y`
|
|
29
|
+
:host {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
text-align: center;
|
|
34
|
+
}
|
|
35
|
+
`,Fe=M(r=>t=>{r.name("my-view"),r.styles(U,We);let e=r.signal(0);r.mount(()=>Y(async()=>{await N(1e3),e.value++})),r.once(()=>r.rendered.then(()=>{console.log("slot",Mt("slot",r.shadow))}));let s=r.op.fn(async()=>{await N(5e3)});return ht`
|
|
36
|
+
<p>${t} <slot></slot> ${e()}</p>
|
|
37
|
+
<p>${we.dots(s,()=>"op loaded")}</p>
|
|
38
|
+
`});B(Fe.attr("class","incredi").children("world").props("hello"),Mt(".demo"));
|
|
39
|
+
/*! Bundled license information:
|
|
40
|
+
|
|
41
|
+
@lit/reactive-element/css-tag.js:
|
|
42
|
+
(**
|
|
43
|
+
* @license
|
|
44
|
+
* Copyright 2019 Google LLC
|
|
45
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
46
|
+
*)
|
|
47
|
+
|
|
48
|
+
@lit/reactive-element/reactive-element.js:
|
|
49
|
+
lit-html/lit-html.js:
|
|
50
|
+
lit-element/lit-element.js:
|
|
51
|
+
lit-html/directive.js:
|
|
52
|
+
lit-html/async-directive.js:
|
|
53
|
+
(**
|
|
54
|
+
* @license
|
|
55
|
+
* Copyright 2017 Google LLC
|
|
56
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
57
|
+
*)
|
|
58
|
+
|
|
59
|
+
lit-html/is-server.js:
|
|
60
|
+
(**
|
|
61
|
+
* @license
|
|
62
|
+
* Copyright 2022 Google LLC
|
|
63
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
|
+
*)
|
|
65
|
+
|
|
66
|
+
lit-html/directive-helpers.js:
|
|
67
|
+
(**
|
|
68
|
+
* @license
|
|
69
|
+
* Copyright 2020 Google LLC
|
|
70
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
+
*)
|
|
72
|
+
*/
|
|
2
73
|
//# sourceMappingURL=demo.bundle.min.js.map
|