@potok-web-framework/core 0.14.0 → 0.15.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/client.mjs +1 -1
- package/dist/context-IwELKojA.mjs +41 -0
- package/dist/exports/index.d.ts +1 -0
- package/dist/index.mjs +2 -1
- package/dist/server.mjs +1 -1
- package/dist/store.mjs +14 -52
- package/package.json +1 -1
- /package/dist/{css-BercB0Kp.mjs → css-DMDIE7dH.mjs} +0 -0
package/dist/client.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as createSignal, n as batch, r as createEffect } from "./lib-node-A2uZ5QH1.mjs";
|
|
2
2
|
import { i as PRELOAD_SCRIPTS_SCRIPT_ID, n as HYDRATION_STATE_SCRIPT_ID, r as NON_BUBBLING_EVENTS } from "./constants-Bxn0R4hW.mjs";
|
|
3
3
|
import { t as deserializeWithTypes } from "./serialization-qOayQbjE.mjs";
|
|
4
|
-
import { n as normalizeCssPropertyValue, t as normalizeCssPropertyName } from "./css-
|
|
4
|
+
import { n as normalizeCssPropertyValue, t as normalizeCssPropertyName } from "./css-DMDIE7dH.mjs";
|
|
5
5
|
function isTextNode(e) {
|
|
6
6
|
return e.nodeType === Node.TEXT_NODE;
|
|
7
7
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { l as LibBlock } from "./lib-node-A2uZ5QH1.mjs";
|
|
2
|
+
import { i as mergeContext, r as normalizeArray, t as normalizeChildren } from "./normalize-children-C7XDL3rl.mjs";
|
|
3
|
+
var ContextProvider = class extends LibBlock {
|
|
4
|
+
constructor(e, n, i) {
|
|
5
|
+
super(), this.props = e, this.context = i, normalizeChildren(e.children).forEach((r, a) => {
|
|
6
|
+
this.children.push(r(mergeContext(i, {
|
|
7
|
+
parentBlock: this,
|
|
8
|
+
index: a,
|
|
9
|
+
contexts: { [n]: e.value }
|
|
10
|
+
})));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}, ContextConsumer = class extends LibBlock {
|
|
14
|
+
constructor(e, r, i) {
|
|
15
|
+
super(), this.props = e, this.context = i;
|
|
16
|
+
let a = i.contexts[r];
|
|
17
|
+
if (!a) throw Error("Контекст не найден");
|
|
18
|
+
normalizeArray(e.children).forEach((e, n) => {
|
|
19
|
+
this.children.push(e(a)(mergeContext(i, {
|
|
20
|
+
parentBlock: this,
|
|
21
|
+
index: n
|
|
22
|
+
})));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function createContext() {
|
|
27
|
+
let e = Symbol("context");
|
|
28
|
+
return {
|
|
29
|
+
provider(t) {
|
|
30
|
+
return function(n) {
|
|
31
|
+
return new ContextProvider(t, e, n);
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
reader(t) {
|
|
35
|
+
return function(n) {
|
|
36
|
+
return new ContextConsumer(t, e, n);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export { createContext as t };
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { PortalIn, PortalOut } from '../portal';
|
|
|
10
10
|
export { createElementReference } from '../ref';
|
|
11
11
|
export { Show } from '../show';
|
|
12
12
|
export { createSignal, createEffect, batch, untrack, deepTrack, getSignal, } from '../signals';
|
|
13
|
+
export { createContext } from '../context';
|
|
13
14
|
export { DocumentType } from '../document-type-node';
|
|
14
15
|
export type { PotokElement, WithChildren } from '../types';
|
|
15
16
|
export type * from '../jsx-types';
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { t as fragment } from "./fragment-BPbIbst6.mjs";
|
|
|
7
7
|
import { i as PRELOAD_SCRIPTS_SCRIPT_ID, n as HYDRATION_STATE_SCRIPT_ID } from "./constants-Bxn0R4hW.mjs";
|
|
8
8
|
import { t as escapeFromScriptTag } from "./escape-from-script-tag-CRT2evI1.mjs";
|
|
9
9
|
import { n as serializeWithTypes } from "./serialization-qOayQbjE.mjs";
|
|
10
|
+
import { t as createContext } from "./context-IwELKojA.mjs";
|
|
10
11
|
import { clientEntry } from "virtual:client-variables";
|
|
11
12
|
function ClientOnly(e) {
|
|
12
13
|
return LibContextReader({ children: (t) => Show({
|
|
@@ -281,4 +282,4 @@ function DocumentType(e) {
|
|
|
281
282
|
return new LibDocumentTypeNode(e, t);
|
|
282
283
|
};
|
|
283
284
|
}
|
|
284
|
-
export { ClientOnly, DocumentType, ErrorBoundary, FooterScripts, HeaderScripts, Lazy, LibContextReader, Lifecycle, List, PortalIn, PortalOut, Show, batch, createEffect, createElementReference, createSignal, deepTrack, getSignal, untrack };
|
|
285
|
+
export { ClientOnly, DocumentType, ErrorBoundary, FooterScripts, HeaderScripts, Lazy, LibContextReader, Lifecycle, List, PortalIn, PortalOut, Show, batch, createContext, createEffect, createElementReference, createSignal, deepTrack, getSignal, untrack };
|
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as createSignal, n as batch } from "./lib-node-A2uZ5QH1.mjs";
|
|
2
2
|
import { t as escapeFromScriptTag } from "./escape-from-script-tag-CRT2evI1.mjs";
|
|
3
|
-
import { n as normalizeCssPropertyValue, t as normalizeCssPropertyName } from "./css-
|
|
3
|
+
import { n as normalizeCssPropertyValue, t as normalizeCssPropertyName } from "./css-DMDIE7dH.mjs";
|
|
4
4
|
import { clientDependencies } from "virtual:client-variables";
|
|
5
5
|
import path from "path";
|
|
6
6
|
async function bootstrapApp(e) {
|
package/dist/store.mjs
CHANGED
|
@@ -1,45 +1,7 @@
|
|
|
1
|
-
import { a as deepTrack, i as createSignal,
|
|
2
|
-
import { i as mergeContext, r as normalizeArray, t as normalizeChildren } from "./normalize-children-C7XDL3rl.mjs";
|
|
1
|
+
import { a as deepTrack, i as createSignal, n as batch, r as createEffect } from "./lib-node-A2uZ5QH1.mjs";
|
|
3
2
|
import { a as Lifecycle, o as LibContextReader, r as HMR_STATE_CACHE, t as getComponentInstanceId } from "./get-component-instance-id-BsCBJaZv.mjs";
|
|
4
3
|
import { t as isPureObject } from "./is-pure-object-s_MkQp1w.mjs";
|
|
5
|
-
|
|
6
|
-
constructor(e, t, n) {
|
|
7
|
-
super(), this.props = e, this.context = n, normalizeChildren(e.children).forEach((r, i) => {
|
|
8
|
-
this.children.push(r(mergeContext(n, {
|
|
9
|
-
parentBlock: this,
|
|
10
|
-
index: i,
|
|
11
|
-
contexts: { [t]: e.value }
|
|
12
|
-
})));
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}, ContextConsumer = class extends LibBlock {
|
|
16
|
-
constructor(e, t, n) {
|
|
17
|
-
super(), this.props = e, this.context = n;
|
|
18
|
-
let r = n.contexts[t];
|
|
19
|
-
if (!r) throw Error("Контекст не найден");
|
|
20
|
-
normalizeArray(e.children).forEach((e, t) => {
|
|
21
|
-
this.children.push(e(r)(mergeContext(n, {
|
|
22
|
-
parentBlock: this,
|
|
23
|
-
index: t
|
|
24
|
-
})));
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
function createContext() {
|
|
29
|
-
let e = Symbol("context");
|
|
30
|
-
return {
|
|
31
|
-
provider(t) {
|
|
32
|
-
return function(n) {
|
|
33
|
-
return new ContextProvider(t, e, n);
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
reader(t) {
|
|
37
|
-
return function(n) {
|
|
38
|
-
return new ContextConsumer(t, e, n);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
4
|
+
import { t as createContext } from "./context-IwELKojA.mjs";
|
|
43
5
|
function deepAssignObject(e, t) {
|
|
44
6
|
for (let n in t) {
|
|
45
7
|
if (!Object.prototype.hasOwnProperty.call(t, n)) continue;
|
|
@@ -49,34 +11,34 @@ function deepAssignObject(e, t) {
|
|
|
49
11
|
return e;
|
|
50
12
|
}
|
|
51
13
|
function createStore() {
|
|
52
|
-
return function(
|
|
53
|
-
let
|
|
14
|
+
return function(a) {
|
|
15
|
+
let s = createContext();
|
|
54
16
|
return {
|
|
55
17
|
provider(o) {
|
|
56
|
-
return LibContextReader({ children: (
|
|
57
|
-
let c = getComponentInstanceId(
|
|
18
|
+
return LibContextReader({ children: (i) => {
|
|
19
|
+
let c = getComponentInstanceId(i), l = [], u = Object.entries(a.extensions).reduce((e, [t, n]) => {
|
|
58
20
|
let r = n();
|
|
59
21
|
return r.onUnmounted && l.push(r.onUnmounted), e[t] = r.api, e;
|
|
60
|
-
}, {}), d =
|
|
61
|
-
process.env.NODE_ENV === "development" && HMR_STATE_CACHE.has(c) ? f = HMR_STATE_CACHE.get(c).value : (f = createSignal(deepAssignObject(
|
|
22
|
+
}, {}), d = i.states[c] ?? {}, f;
|
|
23
|
+
process.env.NODE_ENV === "development" && HMR_STATE_CACHE.has(c) ? f = HMR_STATE_CACHE.get(c).value : (f = createSignal(deepAssignObject(a.state({
|
|
62
24
|
props: o,
|
|
63
25
|
extensions: u
|
|
64
26
|
}), d)), process.env.NODE_ENV === "development" && HMR_STATE_CACHE.set(c, {
|
|
65
27
|
value: f,
|
|
66
28
|
isRemovable: !1
|
|
67
29
|
}));
|
|
68
|
-
let p =
|
|
30
|
+
let p = a.actions({
|
|
69
31
|
props: o,
|
|
70
32
|
state: f
|
|
71
|
-
}), m = Object.entries(p).reduce((e, [t,
|
|
33
|
+
}), m = Object.entries(p).reduce((e, [t, r]) => (e[t] = (...e) => batch(() => r.apply(p, e)), e), {});
|
|
72
34
|
return Lifecycle({
|
|
73
35
|
onMounted() {
|
|
74
36
|
if (process.env.NODE_ENV === "development") {
|
|
75
37
|
let e = HMR_STATE_CACHE.get(c);
|
|
76
38
|
e && (e.isRemovable = !1);
|
|
77
39
|
}
|
|
78
|
-
if (
|
|
79
|
-
deepTrack(f),
|
|
40
|
+
if (i.isServer) return createEffect(() => {
|
|
41
|
+
deepTrack(f), i.states[c] = f;
|
|
80
42
|
}, !0).dispose;
|
|
81
43
|
},
|
|
82
44
|
onUnmounted() {
|
|
@@ -87,7 +49,7 @@ function createStore() {
|
|
|
87
49
|
}));
|
|
88
50
|
}
|
|
89
51
|
},
|
|
90
|
-
children:
|
|
52
|
+
children: s.provider({
|
|
91
53
|
value: {
|
|
92
54
|
state: f,
|
|
93
55
|
actions: m
|
|
@@ -98,7 +60,7 @@ function createStore() {
|
|
|
98
60
|
} });
|
|
99
61
|
},
|
|
100
62
|
reader(e) {
|
|
101
|
-
return
|
|
63
|
+
return s.reader({ children: (t) => e.children(t) });
|
|
102
64
|
}
|
|
103
65
|
};
|
|
104
66
|
};
|
package/package.json
CHANGED
|
File without changes
|