@potok-web-framework/core 0.1.0 → 0.2.0
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/dist/block.d.ts +17 -0
- package/dist/bootstrap-app.d.ts +8 -0
- package/dist/client-only.d.ts +3 -0
- package/dist/client.mjs +133 -0
- package/dist/constants-BOAOReQ3.mjs +26 -0
- package/dist/constants.d.ts +2 -0
- package/dist/context.d.ts +12 -0
- package/dist/detect-child.d.ts +6 -0
- package/dist/error-boundary.d.ts +5 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/hmr.d.ts +1 -0
- package/dist/exports/index.d.ts +14 -0
- package/dist/exports/jsx-runtime.d.ts +4 -0
- package/dist/exports/server.d.ts +1 -0
- package/dist/fragment-BahmURhz.mjs +17 -0
- package/dist/fragment.d.ts +4 -0
- package/dist/hmr/hmr-dev.d.ts +9 -0
- package/dist/hmr/register-component.d.ts +2 -0
- package/dist/hmr/registered-component.d.ts +23 -0
- package/dist/hmr/registry.d.ts +12 -0
- package/dist/hmr/types.d.ts +4 -0
- package/dist/hmr/utils.d.ts +3 -0
- package/dist/hmr.mjs +42 -0
- package/dist/html-element-Cm0RtMkT.mjs +42 -0
- package/dist/html-element.d.ts +6 -0
- package/dist/index.mjs +199 -0
- package/dist/jsx-runtime.mjs +10 -0
- package/dist/jsx-types.d.ts +11 -0
- package/dist/lazy.d.ts +7 -0
- package/dist/lib-context-reader.d.ts +5 -0
- package/dist/lib-scripts.d.ts +2 -0
- package/dist/lifecycle-4vjEuXGy.mjs +57 -0
- package/dist/lifecycle.d.ts +8 -0
- package/dist/list.d.ts +9 -0
- package/dist/portal-CbcYOHLv.mjs +44 -0
- package/dist/portal.d.ts +10 -0
- package/dist/prop-types.d.ts +939 -0
- package/dist/ref.d.ts +6 -0
- package/dist/render-to-dom.d.ts +8 -0
- package/dist/render-to-string.d.ts +2 -0
- package/dist/server-node.d.ts +10 -0
- package/dist/server.mjs +1192 -0
- package/dist/show.d.ts +6 -0
- package/dist/signals.d.ts +32 -0
- package/dist/store.d.ts +26 -0
- package/dist/text.d.ts +5 -0
- package/dist/types.d.ts +39 -0
- package/dist/utils-CAe_kbSH.mjs +345 -0
- package/dist/utils.d.ts +11 -0
- package/package.json +7 -2
- package/CHANGELOG.md +0 -7
- package/bun.lock +0 -25
- package/src/block.ts +0 -102
- package/src/bootstrap-app.ts +0 -115
- package/src/client-only.ts +0 -17
- package/src/constants.ts +0 -27
- package/src/context.ts +0 -85
- package/src/detect-child.ts +0 -21
- package/src/error-boundary.ts +0 -51
- package/src/exports/client.ts +0 -1
- package/src/exports/hmr.ts +0 -1
- package/src/exports/index.ts +0 -21
- package/src/exports/jsx-runtime.ts +0 -4
- package/src/exports/server.ts +0 -1
- package/src/fragment.ts +0 -28
- package/src/global.dev.d.ts +0 -12
- package/src/hmr/hmr-dev.ts +0 -10
- package/src/hmr/register-component.ts +0 -109
- package/src/hmr/registered-component.ts +0 -59
- package/src/hmr/registry.ts +0 -78
- package/src/hmr/types.ts +0 -6
- package/src/hmr/utils.ts +0 -20
- package/src/html-element.ts +0 -95
- package/src/jsx-types.ts +0 -13
- package/src/lazy.ts +0 -44
- package/src/lib-context-reader.ts +0 -33
- package/src/lib-scripts.ts +0 -8
- package/src/lifecycle.ts +0 -44
- package/src/list.ts +0 -175
- package/src/portal.ts +0 -101
- package/src/prop-types.ts +0 -1165
- package/src/ref.ts +0 -11
- package/src/render-to-dom.ts +0 -325
- package/src/render-to-string.ts +0 -65
- package/src/server-node.ts +0 -98
- package/src/show.ts +0 -46
- package/src/signals.ts +0 -323
- package/src/store.ts +0 -68
- package/src/text.ts +0 -35
- package/src/types.ts +0 -69
- package/src/utils.ts +0 -118
- package/tests/signals.test.ts +0 -403
- package/tsconfig.json +0 -17
- package/vite.config.ts +0 -21
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { _ as LibBlock, c as createEffect, i as normalizeChildren, n as mergeContext, p as untrack, r as normalizeArray } from "./utils-CAe_kbSH.mjs";
|
|
2
|
+
var LibContextReaderClass = class extends LibBlock {
|
|
3
|
+
constructor(e, t) {
|
|
4
|
+
super(), this.props = e, this.context = t, normalizeArray(e.children).forEach((e, n) => {
|
|
5
|
+
this.children.push(e(t)(mergeContext(t, {
|
|
6
|
+
parentBlock: this,
|
|
7
|
+
index: n
|
|
8
|
+
})));
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function LibContextReader(e) {
|
|
13
|
+
return function(t) {
|
|
14
|
+
return new LibContextReaderClass(e, t);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
var ShowClass = class extends LibBlock {
|
|
18
|
+
constructor(e, r) {
|
|
19
|
+
super(), this.props = e, this.context = r;
|
|
20
|
+
let i = normalizeChildren(e.children);
|
|
21
|
+
this.addEffect(createEffect(() => {
|
|
22
|
+
e.when ? untrack(() => {
|
|
23
|
+
i.forEach((e, t) => {
|
|
24
|
+
this.children.push(e(mergeContext(r, {
|
|
25
|
+
parentBlock: this,
|
|
26
|
+
index: t
|
|
27
|
+
})));
|
|
28
|
+
});
|
|
29
|
+
}) : this.unmountChildren();
|
|
30
|
+
}, !0));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
function Show(e) {
|
|
34
|
+
return function(t) {
|
|
35
|
+
return new ShowClass(e, t);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
var LifecycleClass = class extends LibBlock {
|
|
39
|
+
onMountedReturn;
|
|
40
|
+
constructor(e, t) {
|
|
41
|
+
super(), this.props = e, this.context = t, normalizeChildren(e.children).forEach((e, n) => {
|
|
42
|
+
this.children.push(e(mergeContext(t, {
|
|
43
|
+
parentBlock: this,
|
|
44
|
+
index: n
|
|
45
|
+
})));
|
|
46
|
+
}), this.onMountedReturn = e.onMounted?.();
|
|
47
|
+
}
|
|
48
|
+
unmount() {
|
|
49
|
+
super.unmount(), this.onMountedReturn?.(), this.props.onUnmounted?.();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function Lifecycle(e) {
|
|
53
|
+
return function(t) {
|
|
54
|
+
return new LifecycleClass(e, t);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export { Show as n, LibContextReader as r, Lifecycle as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PotokElement, WithChildren } from './types';
|
|
2
|
+
type OnMoutedReturnCallback = () => void;
|
|
3
|
+
export type LifecycleProps = WithChildren<{
|
|
4
|
+
onMounted?: () => OnMoutedReturnCallback | void;
|
|
5
|
+
onUnmounted?: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function Lifecycle(props: LifecycleProps): PotokElement;
|
|
8
|
+
export {};
|
package/dist/list.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { _ as LibBlock, c as createEffect, i as normalizeChildren, n as mergeContext, p as untrack } from "./utils-CAe_kbSH.mjs";
|
|
2
|
+
var PortalInClass = class extends LibBlock {
|
|
3
|
+
constructor(e, n) {
|
|
4
|
+
super(), this.props = e, this.context = n;
|
|
5
|
+
let r;
|
|
6
|
+
n.portals[e.name] ? console.warn(`Портал ${e.name} уже существует`) : this.addEffect(createEffect(() => {
|
|
7
|
+
let t = e.name;
|
|
8
|
+
t !== r && untrack(() => {
|
|
9
|
+
delete n.portals[t], n.portals[t] = e.children;
|
|
10
|
+
}), r = t;
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
unmount() {
|
|
14
|
+
super.unmount(), delete this.context.portals[this.props.name];
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function PortalIn(e) {
|
|
18
|
+
return function(t) {
|
|
19
|
+
return new PortalInClass(e, t);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var PortalOutClass = class extends LibBlock {
|
|
23
|
+
constructor(e, i) {
|
|
24
|
+
super(), this.props = e, this.context = i;
|
|
25
|
+
let a;
|
|
26
|
+
this.addEffect(createEffect(() => {
|
|
27
|
+
let t = e.name, o = normalizeChildren(i.portals[t]);
|
|
28
|
+
o ? o !== a && (this.unmountChildren(), untrack(() => {
|
|
29
|
+
o.forEach((e, t) => {
|
|
30
|
+
this.children.push(e(mergeContext(i, {
|
|
31
|
+
parentBlock: this,
|
|
32
|
+
index: t
|
|
33
|
+
})));
|
|
34
|
+
});
|
|
35
|
+
}), a = o) : (this.unmountChildren(), a = null);
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function PortalOut(e) {
|
|
40
|
+
return function(t) {
|
|
41
|
+
return new PortalOutClass(e, t);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export { PortalOut as n, PortalIn as t };
|
package/dist/portal.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PotokElement, WithChildren } from './types';
|
|
2
|
+
type PortalInProps = WithChildren<{
|
|
3
|
+
name: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function PortalIn(props: PortalInProps): PotokElement;
|
|
6
|
+
type PortalOutProps = {
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function PortalOut(props: PortalOutProps): PotokElement;
|
|
10
|
+
export {};
|