eddev 0.3.4 → 0.3.5

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.
@@ -1,4 +1,4 @@
1
- import { ElementType, FunctionComponent } from "react";
1
+ import { ElementType, FunctionComponent, ComponentPropsWithoutRef } from "react";
2
2
  import { ContentBlocksSettings } from ".";
3
3
  declare type PropTypes<T extends ElementType> = {
4
4
  /** The 'key' of this editable text value */
@@ -13,7 +13,7 @@ declare type PropTypes<T extends ElementType> = {
13
13
  defaultValue?: string;
14
14
  /** Append a new block when the user hits 'Enter' */
15
15
  appendOnEnter?: boolean;
16
- } & React.ComponentPropsWithoutRef<T>;
16
+ } & ComponentPropsWithoutRef<T>;
17
17
  export declare function EditableText<T extends ElementType>({ id, as, appendOnEnter, ...props }: PropTypes<T>): import("react/jsx-runtime").JSX.Element | null;
18
18
  declare type AppenderConfig = {
19
19
  type: "default" | "button" | FunctionComponent<any>;
@@ -41,6 +41,24 @@ function BrowserRouter(props) {
41
41
  var url = state.url, data = state.data;
42
42
  var _b = (0, react_1.useState)(null), pending = _b[0], setPendingUrl = _b[1];
43
43
  var setIsLoading = (0, usePageLoad_1.usePageLoad)(function (s) { return s.setIsLoading; });
44
+ var scrollTo = function (value) {
45
+ if (typeof value !== "number")
46
+ return;
47
+ if (routing_1.customRouterScrollHandler.handler) {
48
+ routing_1.customRouterScrollHandler.handler.set(value);
49
+ }
50
+ else if (document.scrollingElement) {
51
+ document.scrollingElement.scrollTop = value;
52
+ }
53
+ };
54
+ var getScroll = function () {
55
+ if (routing_1.customRouterScrollHandler.handler) {
56
+ return routing_1.customRouterScrollHandler.handler.get();
57
+ }
58
+ else if (document.scrollingElement) {
59
+ return document.scrollingElement.scrollTop;
60
+ }
61
+ };
44
62
  (0, react_1.useEffect)(function () {
45
63
  if (data.errorStack) {
46
64
  (0, reportErrorStack_1.reportErrorStack)(data.errorStack);
@@ -74,7 +92,7 @@ function BrowserRouter(props) {
74
92
  var view = views_1.default[data.view];
75
93
  var nextUrl = data.canonical || pending.url;
76
94
  var finish = function () {
77
- var _a, _b;
95
+ var _a;
78
96
  setState({
79
97
  url: nextUrl,
80
98
  data: data,
@@ -92,7 +110,7 @@ function BrowserRouter(props) {
92
110
  (0, updateHeadTags_1.updateHeadTags)(data.meta.head);
93
111
  setIsLoading(false);
94
112
  if (!pending.popped) {
95
- history.replaceState({ scrollPosition: (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop }, "", document.location.href);
113
+ history.replaceState({ scrollPosition: getScroll() }, "", document.location.href);
96
114
  history.pushState({}, "", nextUrl);
97
115
  }
98
116
  };
@@ -109,16 +127,6 @@ function BrowserRouter(props) {
109
127
  cancelled = true;
110
128
  };
111
129
  }, [pending]);
112
- var scrollTo = function (value) {
113
- if (typeof value !== "number")
114
- return;
115
- if (routing_1.customRouterScrollHandler.handler) {
116
- routing_1.customRouterScrollHandler.handler(value);
117
- }
118
- else if (document.scrollingElement) {
119
- document.scrollingElement.scrollTop = value;
120
- }
121
- };
122
130
  // const [scrollPosition, setScrollPosition] = useState({ value: null as null | number })
123
131
  // useEffect(() => {
124
132
  // if (document.scrollingElement && typeof scrollPosition.value === "number") {
package/entry/Root.js CHANGED
@@ -41,7 +41,7 @@ function Root() {
41
41
  var _a, _b;
42
42
  var route = (0, routing_1.useRoute)();
43
43
  var Component = views_1.default[(_a = route.data) === null || _a === void 0 ? void 0 : _a.view];
44
- return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [process.devUI && (0, jsx_runtime_1.jsx)(loader_1.DevUILoader, {}, void 0), (0, jsx_runtime_1.jsx)(views_1.App, { children: Component ? (0, jsx_runtime_1.jsx)(Component, __assign({}, (_b = route.data) === null || _b === void 0 ? void 0 : _b.viewData.data), void 0) : null }, void 0)] }, void 0));
44
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(routing_1.RouteItemContext, __assign({ route: route }, { children: [process.devUI && (0, jsx_runtime_1.jsx)(loader_1.DevUILoader, {}, void 0), (0, jsx_runtime_1.jsx)(views_1.App, __assign({ path: route.pathname }, { children: Component ? (0, jsx_runtime_1.jsx)(Component, __assign({}, (_b = route.data) === null || _b === void 0 ? void 0 : _b.viewData.data), void 0) : null }), void 0)] }), void 0) }, void 0));
45
45
  }
46
46
  exports.default = process.rpcEnabled
47
47
  ? (0, next_1.withTRPC)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -24,7 +24,6 @@
24
24
  "@types/react-dom": "^18.2.7",
25
25
  "@types/react-inspector": "^4.0.2",
26
26
  "@types/rimraf": "^3.0.2",
27
- "@types/url-parse": "^1.4.4",
28
27
  "@types/webpack-dev-server": "^3.11.2",
29
28
  "csstype": "^3.0.9",
30
29
  "next": "^12.1.6",
@@ -33,6 +32,7 @@
33
32
  "typescript": "4.5.5"
34
33
  },
35
34
  "dependencies": {
35
+ "@types/url-parse": "^1.4.4",
36
36
  "@babel/core": "^7.15.5",
37
37
  "@babel/generator": "^7.15.4",
38
38
  "@babel/preset-env": "^7.15.4",
@@ -52,7 +52,10 @@ declare type RouteContextType = {
52
52
  };
53
53
  export declare function useRoute(): RouteItem;
54
54
  export declare function useRouter(): RouteContextType | undefined;
55
- export declare type RouterScrollHandler = (value: number) => void;
55
+ export declare type RouterScrollHandler = {
56
+ set: (value: number) => void;
57
+ get: () => number;
58
+ };
56
59
  export declare const customRouterScrollHandler: {
57
60
  handler: RouterScrollHandler | null;
58
61
  };