effect-start 0.19.0 → 0.20.1
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 +3 -3
- package/dist/Development.d.ts +3 -3
- package/dist/Development.js +3 -2
- package/dist/Effectify.d.ts +212 -0
- package/dist/Effectify.js +19 -0
- package/dist/FilePathPattern.d.ts +29 -0
- package/dist/FilePathPattern.js +86 -0
- package/dist/FileRouter.d.ts +39 -41
- package/dist/FileRouter.js +104 -158
- package/dist/FileRouterCodegen.d.ts +7 -8
- package/dist/FileRouterCodegen.js +97 -66
- package/dist/PlatformError.d.ts +46 -0
- package/dist/PlatformError.js +43 -0
- package/dist/PlatformRuntime.d.ts +23 -0
- package/dist/PlatformRuntime.js +42 -0
- package/dist/RouteBody.d.ts +1 -1
- package/dist/Start.d.ts +34 -3
- package/dist/Start.js +31 -6
- package/dist/bun/BunPlatformHttpServer.d.ts +10 -0
- package/dist/bun/BunPlatformHttpServer.js +53 -0
- package/dist/bun/BunRoute.d.ts +3 -5
- package/dist/bun/BunRoute.js +9 -17
- package/dist/bun/BunRuntime.d.ts +2 -1
- package/dist/bun/BunRuntime.js +10 -5
- package/dist/bun/BunServer.d.ts +33 -0
- package/dist/bun/BunServer.js +133 -0
- package/dist/bun/BunServerRequest.d.ts +60 -0
- package/dist/bun/BunServerRequest.js +252 -0
- package/dist/bun/index.d.ts +1 -1
- package/dist/bun/index.js +1 -1
- package/dist/datastar/actions/fetch.d.ts +30 -0
- package/dist/datastar/actions/fetch.js +411 -0
- package/dist/datastar/actions/peek.d.ts +1 -0
- package/dist/datastar/actions/peek.js +14 -0
- package/dist/datastar/actions/setAll.d.ts +1 -0
- package/dist/datastar/actions/setAll.js +13 -0
- package/dist/datastar/actions/toggleAll.d.ts +1 -0
- package/dist/datastar/actions/toggleAll.js +13 -0
- package/dist/datastar/attributes/attr.d.ts +1 -0
- package/dist/datastar/attributes/attr.js +49 -0
- package/dist/datastar/attributes/bind.d.ts +1 -0
- package/dist/datastar/attributes/bind.js +183 -0
- package/dist/datastar/attributes/class.d.ts +1 -0
- package/dist/datastar/attributes/class.js +50 -0
- package/dist/datastar/attributes/computed.d.ts +1 -0
- package/dist/datastar/attributes/computed.js +27 -0
- package/dist/datastar/attributes/effect.d.ts +1 -0
- package/dist/datastar/attributes/effect.js +10 -0
- package/dist/datastar/attributes/indicator.d.ts +1 -0
- package/dist/datastar/attributes/indicator.js +32 -0
- package/dist/datastar/attributes/init.d.ts +1 -0
- package/dist/datastar/attributes/init.js +27 -0
- package/dist/datastar/attributes/jsonSignals.d.ts +1 -0
- package/dist/datastar/attributes/jsonSignals.js +31 -0
- package/dist/datastar/attributes/on.d.ts +1 -0
- package/dist/datastar/attributes/on.js +59 -0
- package/dist/datastar/attributes/onIntersect.d.ts +1 -0
- package/dist/datastar/attributes/onIntersect.js +54 -0
- package/dist/datastar/attributes/onInterval.d.ts +1 -0
- package/dist/datastar/attributes/onInterval.js +31 -0
- package/dist/datastar/attributes/onSignalPatch.d.ts +1 -0
- package/dist/datastar/attributes/onSignalPatch.js +44 -0
- package/dist/datastar/attributes/ref.d.ts +1 -0
- package/dist/datastar/attributes/ref.js +11 -0
- package/dist/datastar/attributes/show.d.ts +1 -0
- package/dist/datastar/attributes/show.js +32 -0
- package/dist/datastar/attributes/signals.d.ts +1 -0
- package/dist/datastar/attributes/signals.js +18 -0
- package/dist/datastar/attributes/style.d.ts +1 -0
- package/dist/datastar/attributes/style.js +56 -0
- package/dist/datastar/attributes/text.d.ts +1 -0
- package/dist/datastar/attributes/text.js +27 -0
- package/dist/datastar/engine.d.ts +156 -0
- package/dist/datastar/engine.js +971 -0
- package/dist/datastar/index.d.ts +24 -0
- package/dist/datastar/index.js +24 -0
- package/dist/datastar/load.d.ts +24 -0
- package/dist/datastar/load.js +24 -0
- package/dist/datastar/utils.d.ts +51 -0
- package/dist/datastar/utils.js +205 -0
- package/dist/datastar/watchers/patchElements.d.ts +1 -0
- package/dist/datastar/watchers/patchElements.js +420 -0
- package/dist/datastar/watchers/patchSignals.d.ts +1 -0
- package/dist/datastar/watchers/patchSignals.js +15 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node/NodeFileSystem.d.ts +7 -0
- package/dist/node/NodeFileSystem.js +420 -0
- package/dist/node/NodeUtils.d.ts +2 -0
- package/dist/node/NodeUtils.js +20 -0
- package/dist/x/tailwind/plugin.js +1 -1
- package/package.json +11 -7
- package/src/Development.ts +26 -25
- package/src/{node/Effectify.ts → Effectify.ts} +10 -3
- package/src/FilePathPattern.ts +115 -0
- package/src/FileRouter.ts +178 -255
- package/src/FileRouterCodegen.ts +135 -92
- package/src/{node/PlatformError.ts → PlatformError.ts} +34 -19
- package/src/PlatformRuntime.ts +97 -0
- package/src/RouteBody.ts +1 -1
- package/src/RouteHttp.ts +3 -1
- package/src/Start.ts +61 -14
- package/src/bun/BunPlatformHttpServer.ts +88 -0
- package/src/bun/BunRoute.ts +12 -22
- package/src/bun/BunRuntime.ts +21 -5
- package/src/bun/BunServer.ts +228 -0
- package/src/bun/index.ts +1 -1
- package/src/datastar/README.md +18 -0
- package/src/datastar/actions/fetch.ts +609 -0
- package/src/datastar/actions/peek.ts +17 -0
- package/src/datastar/actions/setAll.ts +20 -0
- package/src/datastar/actions/toggleAll.ts +20 -0
- package/src/datastar/attributes/attr.ts +50 -0
- package/src/datastar/attributes/bind.ts +220 -0
- package/src/datastar/attributes/class.ts +57 -0
- package/src/datastar/attributes/computed.ts +33 -0
- package/src/datastar/attributes/effect.ts +11 -0
- package/src/datastar/attributes/indicator.ts +39 -0
- package/src/datastar/attributes/init.ts +35 -0
- package/src/datastar/attributes/jsonSignals.ts +38 -0
- package/src/datastar/attributes/on.ts +71 -0
- package/src/datastar/attributes/onIntersect.ts +65 -0
- package/src/datastar/attributes/onInterval.ts +39 -0
- package/src/datastar/attributes/onSignalPatch.ts +63 -0
- package/src/datastar/attributes/ref.ts +12 -0
- package/src/datastar/attributes/show.ts +33 -0
- package/src/datastar/attributes/signals.ts +22 -0
- package/src/datastar/attributes/style.ts +63 -0
- package/src/datastar/attributes/text.ts +30 -0
- package/src/datastar/engine.ts +1341 -0
- package/src/datastar/index.ts +25 -0
- package/src/datastar/utils.ts +286 -0
- package/src/datastar/watchers/patchElements.ts +554 -0
- package/src/datastar/watchers/patchSignals.ts +15 -0
- package/src/index.ts +1 -1
- package/src/node/{FileSystem.ts → NodeFileSystem.ts} +2 -2
- package/src/node/{Utils.ts → NodeUtils.ts} +2 -0
- package/src/x/tailwind/plugin.ts +1 -1
- package/src/FileRouterCodegen.todo.ts +0 -1133
- package/src/FileRouterPattern.ts +0 -59
- package/src/RouterPattern.ts +0 -416
- package/src/StartApp.ts +0 -47
- package/src/bun/BunHttpServer.ts +0 -303
- /package/src/bun/{BunHttpServer_web.ts → BunServerRequest.ts} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { attribute } from "../engine.ts"
|
|
2
|
+
import { effect } from "../engine.ts"
|
|
3
|
+
|
|
4
|
+
const NONE = "none"
|
|
5
|
+
const DISPLAY = "display"
|
|
6
|
+
|
|
7
|
+
attribute({
|
|
8
|
+
name: "show",
|
|
9
|
+
requirement: {
|
|
10
|
+
key: "denied",
|
|
11
|
+
value: "must",
|
|
12
|
+
},
|
|
13
|
+
returnsValue: true,
|
|
14
|
+
apply({ el, rx }) {
|
|
15
|
+
const update = () => {
|
|
16
|
+
observer.disconnect()
|
|
17
|
+
const shouldShow = rx()
|
|
18
|
+
if (shouldShow) {
|
|
19
|
+
if (el.style.display === NONE) el.style.removeProperty(DISPLAY)
|
|
20
|
+
} else {
|
|
21
|
+
el.style.setProperty(DISPLAY, NONE)
|
|
22
|
+
}
|
|
23
|
+
observer.observe(el, { attributeFilter: ["style"] })
|
|
24
|
+
}
|
|
25
|
+
const observer = new MutationObserver(update)
|
|
26
|
+
const cleanup = effect(update)
|
|
27
|
+
|
|
28
|
+
return () => {
|
|
29
|
+
observer.disconnect()
|
|
30
|
+
cleanup()
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { attribute } from "../engine.ts"
|
|
2
|
+
import {
|
|
3
|
+
mergePatch,
|
|
4
|
+
mergePaths,
|
|
5
|
+
} from "../engine.ts"
|
|
6
|
+
import { modifyCasing } from "../utils.ts"
|
|
7
|
+
|
|
8
|
+
attribute({
|
|
9
|
+
name: "signals",
|
|
10
|
+
returnsValue: true,
|
|
11
|
+
apply({ key, mods, rx }) {
|
|
12
|
+
const ifMissing = mods.has("ifmissing")
|
|
13
|
+
|
|
14
|
+
if (key) {
|
|
15
|
+
key = modifyCasing(key, mods)
|
|
16
|
+
mergePaths([[key, rx?.()]], { ifMissing })
|
|
17
|
+
} else {
|
|
18
|
+
const patch = Object.assign({}, rx?.() as Record<string, any>)
|
|
19
|
+
mergePatch(patch, { ifMissing })
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { attribute } from "../engine.ts"
|
|
2
|
+
import { effect } from "../engine.ts"
|
|
3
|
+
import { kebab } from "../utils.ts"
|
|
4
|
+
|
|
5
|
+
attribute({
|
|
6
|
+
name: "style",
|
|
7
|
+
requirement: {
|
|
8
|
+
value: "must",
|
|
9
|
+
},
|
|
10
|
+
returnsValue: true,
|
|
11
|
+
apply({ key, el, rx }) {
|
|
12
|
+
const { style } = el
|
|
13
|
+
const initialStyles = new Map<string, string>()
|
|
14
|
+
|
|
15
|
+
const apply = (prop: string, value: any) => {
|
|
16
|
+
const initial = initialStyles.get(prop)
|
|
17
|
+
if (!value && value !== 0) {
|
|
18
|
+
initial !== undefined
|
|
19
|
+
&& (initial
|
|
20
|
+
? style.setProperty(prop, initial)
|
|
21
|
+
: style.removeProperty(prop))
|
|
22
|
+
} else {
|
|
23
|
+
initial === undefined
|
|
24
|
+
&& initialStyles.set(prop, style.getPropertyValue(prop))
|
|
25
|
+
style.setProperty(prop, String(value))
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const update = () => {
|
|
30
|
+
observer.disconnect()
|
|
31
|
+
|
|
32
|
+
if (key) {
|
|
33
|
+
apply(key, rx())
|
|
34
|
+
} else {
|
|
35
|
+
const styles = rx() as Record<string, any>
|
|
36
|
+
|
|
37
|
+
for (const [prop, initial] of initialStyles) {
|
|
38
|
+
prop in styles
|
|
39
|
+
|| (initial
|
|
40
|
+
? style.setProperty(prop, initial)
|
|
41
|
+
: style.removeProperty(prop))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
for (const prop in styles) {
|
|
45
|
+
apply(kebab(prop), styles[prop])
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
observer.observe(el, { attributeFilter: ["style"] })
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const observer = new MutationObserver(update)
|
|
53
|
+
const cleanup = effect(update)
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
observer.disconnect()
|
|
57
|
+
cleanup()
|
|
58
|
+
for (const [prop, initial] of initialStyles) {
|
|
59
|
+
initial ? style.setProperty(prop, initial) : style.removeProperty(prop)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { attribute } from "../engine.ts"
|
|
2
|
+
import { effect } from "../engine.ts"
|
|
3
|
+
|
|
4
|
+
attribute({
|
|
5
|
+
name: "text",
|
|
6
|
+
requirement: {
|
|
7
|
+
key: "denied",
|
|
8
|
+
value: "must",
|
|
9
|
+
},
|
|
10
|
+
returnsValue: true,
|
|
11
|
+
apply({ el, rx }) {
|
|
12
|
+
const update = () => {
|
|
13
|
+
observer.disconnect()
|
|
14
|
+
el.textContent = `${rx()}`
|
|
15
|
+
observer.observe(el, {
|
|
16
|
+
childList: true,
|
|
17
|
+
characterData: true,
|
|
18
|
+
subtree: true,
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const observer = new MutationObserver(update)
|
|
23
|
+
const cleanup = effect(update)
|
|
24
|
+
|
|
25
|
+
return () => {
|
|
26
|
+
observer.disconnect()
|
|
27
|
+
cleanup()
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
})
|