@blocklet/pages-kit-inner-components 0.6.1 → 0.6.3
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/lib/cjs/add-component.js +1 -420
- package/lib/cjs/chunks/draft-data-CfIMszE7.js +1 -0
- package/lib/cjs/chunks/home-DUjl5PbP.js +6 -0
- package/lib/cjs/chunks/publish-button-C522nNv6.js +1 -0
- package/lib/cjs/chunks/site-state-BG2d2tBl.js +57 -0
- package/lib/cjs/chunks/state-CtNs8GrN.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +11 -4
- package/lib/cjs/resources.js +1 -1
- package/lib/es/add-component.js +2 -1089
- package/lib/es/chunks/{draft-data-CafrGKeh.js → draft-data-bRUHvvzp.js} +5 -4
- package/lib/es/chunks/home-VWWdvIPQ.js +69 -0
- package/lib/es/chunks/{publish-button-XSZrDaTQ.js → publish-button-Ceet-m88.js} +158 -140
- package/lib/es/chunks/site-state-BoVWlYLn.js +2096 -0
- package/lib/es/chunks/state-BdNIIXJP.js +502 -0
- package/lib/es/home.js +3 -28
- package/lib/es/project-html.js +114 -130
- package/lib/es/resources.js +93 -137
- package/package.json +11 -11
- package/lib/cjs/chunks/draft-data-D44_IEV2.js +0 -1
- package/lib/cjs/chunks/home-BYk01EUy.js +0 -39
- package/lib/cjs/chunks/index-BRgYwvuv.js +0 -475
- package/lib/cjs/chunks/publish-button-C8XPA4g_.js +0 -1
- package/lib/cjs/chunks/session-BRtsDvA-.js +0 -1
- package/lib/cjs/chunks/site-state-gSkcvhcV.js +0 -57
- package/lib/cjs/chunks/state-B6BF5wJ-.js +0 -1
- package/lib/cjs/chunks-map.json +0 -1
- package/lib/cjs/components.js +0 -1
- package/lib/cjs/locales.js +0 -3
- package/lib/cjs/setting.js +0 -11
- package/lib/cjs/site-state.js +0 -1
- package/lib/cjs/theme.js +0 -1
- package/lib/cjs/uploader.js +0 -1
- package/lib/es/chunks/home-DW8SdyfO.js +0 -594
- package/lib/es/chunks/index-D5gXPe_7.js +0 -2326
- package/lib/es/chunks/session-C72Dq8zg.js +0 -19
- package/lib/es/chunks/site-state-W2H7XCSQ.js +0 -2077
- package/lib/es/chunks/state-0gvZF3k2.js +0 -573
- package/lib/es/chunks-map.json +0 -1
- package/lib/es/components.js +0 -22
- package/lib/es/locales.js +0 -1032
- package/lib/es/setting.js +0 -2294
- package/lib/es/site-state.js +0 -48
- package/lib/es/theme.js +0 -484
- package/lib/es/uploader.js +0 -8
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { b as o } from "./home-VWWdvIPQ.js";
|
|
3
|
+
import { u as a, S as s, a as n } from "./state-BdNIIXJP.js";
|
|
4
|
+
function m({ children: t }) {
|
|
4
5
|
const r = a();
|
|
5
|
-
return /* @__PURE__ */ e(
|
|
6
|
+
return /* @__PURE__ */ e(s, { url: o(r ?? ""), name: "root", waitingSynced: !0, children: /* @__PURE__ */ e(i, { children: t }) });
|
|
6
7
|
}
|
|
7
8
|
function i({ children: t }) {
|
|
8
9
|
const { state: r } = n();
|
|
9
10
|
return t({ state: r });
|
|
10
11
|
}
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
m as default
|
|
13
14
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { styled as a } from "@arcblock/ux/lib/Theme";
|
|
2
|
+
import l from "@blocklet/ui-react/lib/Header";
|
|
3
|
+
import { Button as f } from "@mui/material";
|
|
4
|
+
import { useContext as w, lazy as c, useMemo as h } from "react";
|
|
5
|
+
import { useSearchParams as g } from "react-router-dom";
|
|
6
|
+
import { createAuthServiceSessionContext as P } from "@arcblock/did-connect/lib/Session";
|
|
7
|
+
import { createAxios as S } from "@blocklet/js-sdk";
|
|
8
|
+
import { joinURL as m } from "ufo";
|
|
9
|
+
import "lodash/isEmpty";
|
|
10
|
+
import "yaml";
|
|
11
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
12
|
+
const { SessionProvider: G, SessionContext: b, SessionConsumer: L, withSession: U } = P();
|
|
13
|
+
function s() {
|
|
14
|
+
return w(b);
|
|
15
|
+
}
|
|
16
|
+
function M(...o) {
|
|
17
|
+
const { session: t } = s();
|
|
18
|
+
return o.includes(t.user?.role);
|
|
19
|
+
}
|
|
20
|
+
function k(...o) {
|
|
21
|
+
const { session: t } = s(), e = M(...o);
|
|
22
|
+
return window.blocklet?.tenantMode === "multiple" ? !!t.user : e;
|
|
23
|
+
}
|
|
24
|
+
const u = window.blocklet?.prefix || "/", p = S({
|
|
25
|
+
timeout: 200 * 1e3
|
|
26
|
+
}), x = window.location.protocol === "https:" ? "wss" : "ws", W = (o) => m(`${x}://${window.location.hostname}`, u, `api/${o}/ws/pages`), E = "z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";
|
|
27
|
+
blocklet?.componentMountPoints.find((o) => o.did === E)?.mountPoint || m(u, "/image-bin");
|
|
28
|
+
function d() {
|
|
29
|
+
const { pathname: o } = window.location, e = o.match(/\/admin\/(maker|previewer)\/([^/]+)/)?.[2], n = window.__PROJECT_ID__;
|
|
30
|
+
if (!e && !n)
|
|
31
|
+
throw new Error("Unable to get projectId from pathname");
|
|
32
|
+
return e || n;
|
|
33
|
+
}
|
|
34
|
+
function v(o) {
|
|
35
|
+
return `${o}:pages:version`;
|
|
36
|
+
}
|
|
37
|
+
const R = ["production", "draft"];
|
|
38
|
+
function z({ mode: o, version: t } = {}) {
|
|
39
|
+
const e = t && typeof t == "number" ? { mode: o, version: t } : { mode: o };
|
|
40
|
+
return p.get(`/api/${d()}/pages`, { params: e }).then((n) => n.data);
|
|
41
|
+
}
|
|
42
|
+
function V({ mode: o, routes: t }) {
|
|
43
|
+
return p.post(`/api/${d()}/pages/publish`, { mode: o, routes: t }).then((e) => e.data);
|
|
44
|
+
}
|
|
45
|
+
function X() {
|
|
46
|
+
const [o] = g(), { session: t } = s(), e = k("owner", "admin", "pagesEditor", "member"), n = h(() => {
|
|
47
|
+
const i = o.get("mode");
|
|
48
|
+
return R.includes(i) ? i : "production";
|
|
49
|
+
}, [o]), r = n === "production" ? n : t.user ? e ? n : "production" : null;
|
|
50
|
+
return r ? I(HomeView, { mode: r }) : null;
|
|
51
|
+
}
|
|
52
|
+
c(() => import("./publish-button-Ceet-m88.js"));
|
|
53
|
+
c(() => import("./draft-data-bRUHvvzp.js"));
|
|
54
|
+
a(l)`
|
|
55
|
+
&.sticky {
|
|
56
|
+
position: sticky;
|
|
57
|
+
top: 0;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
a(f)``;
|
|
61
|
+
export {
|
|
62
|
+
z as a,
|
|
63
|
+
W as b,
|
|
64
|
+
p as c,
|
|
65
|
+
d,
|
|
66
|
+
X as e,
|
|
67
|
+
v as g,
|
|
68
|
+
V as p
|
|
69
|
+
};
|