@rsmax/runtime 1.3.11 → 1.3.13

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/cjs/AppContainer.d.ts +2 -2
  3. package/cjs/Container.d.ts +2 -2
  4. package/cjs/Container.js +2 -2
  5. package/cjs/ReactPortal.d.ts +1 -1
  6. package/cjs/SyntheticEvent/createCallbackProxy.d.ts +1 -1
  7. package/cjs/SyntheticEvent/createCallbackProxy.js +2 -2
  8. package/cjs/SyntheticEvent/stopPropagation.d.ts +1 -1
  9. package/cjs/VNode.d.ts +1 -1
  10. package/cjs/VNode.js +3 -3
  11. package/cjs/createAppConfig.js +4 -3
  12. package/cjs/createComponentConfig.js +1 -1
  13. package/cjs/createComponentConfig.wechat.js +1 -1
  14. package/cjs/createHostComponent.js +1 -1
  15. package/cjs/createPageConfig.js +7 -6
  16. package/cjs/hooks/useNativeEffect.d.ts +2 -2
  17. package/cjs/hooks/useQuery.js +1 -1
  18. package/cjs/hostConfig/diffProperties.js +1 -1
  19. package/cjs/hostConfig/index.d.ts +1 -1
  20. package/cjs/hostConfig/index.js +1 -1
  21. package/cjs/propsAlias.js +1 -1
  22. package/cjs/render.d.ts +3 -3
  23. package/cjs/utils/isClassComponent.d.ts +1 -1
  24. package/cjs/utils/plainStyle/CSSProperty.js +1 -1
  25. package/cjs/utils/plainStyle/index.js +5 -7
  26. package/esm/AppContainer.d.ts +2 -2
  27. package/esm/Container.d.ts +2 -2
  28. package/esm/Container.js +2 -2
  29. package/esm/ReactPortal.d.ts +1 -1
  30. package/esm/SyntheticEvent/createCallbackProxy.d.ts +1 -1
  31. package/esm/SyntheticEvent/createCallbackProxy.js +2 -2
  32. package/esm/SyntheticEvent/stopPropagation.d.ts +1 -1
  33. package/esm/VNode.d.ts +1 -1
  34. package/esm/VNode.js +3 -3
  35. package/esm/createAppConfig.js +4 -3
  36. package/esm/createComponentConfig.js +1 -1
  37. package/esm/createComponentConfig.wechat.js +1 -1
  38. package/esm/createHostComponent.js +1 -1
  39. package/esm/createPageConfig.js +7 -6
  40. package/esm/hooks/useNativeEffect.d.ts +2 -2
  41. package/esm/hooks/useQuery.js +1 -1
  42. package/esm/hostConfig/diffProperties.js +1 -1
  43. package/esm/hostConfig/index.d.ts +1 -1
  44. package/esm/hostConfig/index.js +1 -1
  45. package/esm/propsAlias.js +1 -1
  46. package/esm/render.d.ts +3 -3
  47. package/esm/utils/isClassComponent.d.ts +1 -1
  48. package/esm/utils/plainStyle/CSSProperty.js +1 -1
  49. package/esm/utils/plainStyle/index.js +5 -7
  50. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.3.13](https://github.com/remaxjs/remax/compare/v1.3.12...v1.3.13) (2025-06-16)
7
+
8
+ **Note:** Version bump only for package @rsmax/runtime
9
+
10
+ ## [1.3.12](https://github.com/remaxjs/remax/compare/v1.3.11...v1.3.12) (2025-06-08)
11
+
12
+ **Note:** Version bump only for package @rsmax/runtime
13
+
6
14
  ## [1.3.11](https://github.com/remaxjs/remax/compare/v1.3.8...v1.3.11) (2025-06-04)
7
15
 
8
16
  **Note:** Version bump only for package @rsmax/runtime
@@ -1,5 +1,5 @@
1
- import VNode, { RawNode } from './VNode';
2
- import { FiberRoot } from 'react-reconciler';
1
+ import type { FiberRoot } from 'react-reconciler';
2
+ import VNode, { type RawNode } from './VNode';
3
3
  interface SpliceUpdate {
4
4
  path: string;
5
5
  start: number;
@@ -1,5 +1,5 @@
1
- import VNode, { RawNode } from './VNode';
2
- import { FiberRoot } from 'react-reconciler';
1
+ import type { FiberRoot } from 'react-reconciler';
2
+ import VNode, { type RawNode } from './VNode';
3
3
  interface SpliceUpdate {
4
4
  path: string[];
5
5
  start: number;
package/cjs/Container.js CHANGED
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const framework_shared_1 = require("@rsmax/framework-shared");
6
7
  const VNode_1 = __importDefault(require("./VNode"));
8
+ const index_1 = require("./index");
7
9
  const instanceId_1 = require("./instanceId");
8
10
  const nativeEffect_1 = __importDefault(require("./nativeEffect"));
9
- const framework_shared_1 = require("@rsmax/framework-shared");
10
- const index_1 = require("./index");
11
11
  class Container {
12
12
  constructor(context, rootKey = 'root') {
13
13
  this.updateQueue = [];
@@ -1,2 +1,2 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  export declare function createPortal(children: React.ReactNode, containerInfo: any, key?: string): any;
@@ -1,2 +1,2 @@
1
- import VNode from '../VNode';
1
+ import type VNode from '../VNode';
2
2
  export declare function createCallbackProxy(eventType: string, node: VNode, callback: (...params: any) => any): (...params: any) => any;
@@ -25,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.createCallbackProxy = void 0;
27
27
  const framework_shared_1 = require("@rsmax/framework-shared");
28
- const stopPropagation_1 = __importStar(require("./stopPropagation"));
29
28
  const constants_1 = require("./constants");
29
+ const stopPropagation_1 = __importStar(require("./stopPropagation"));
30
30
  function isSyntheticType(inputType) {
31
31
  if (constants_1.DEPRECATED_CATCH_TYPE === inputType) {
32
32
  console.warn('DEPRECATION: remax 已支持在 onClick 事件中使用 stopPropagation 阻止事件冒泡,请尽量不要使用 catchClick');
@@ -47,7 +47,7 @@ function createCallbackProxy(eventType, node, callback) {
47
47
  if (!isSyntheticType(eventType)) {
48
48
  return callback;
49
49
  }
50
- return function (nativeEvent, ...restParams) {
50
+ return (nativeEvent, ...restParams) => {
51
51
  const syntheticEvent = createBaseSyntheticEvent(node, eventType, nativeEvent);
52
52
  if (stopPropagation_1.isPropagationStopped[eventType]) {
53
53
  (0, stopPropagation_1.validate)(node, eventType);
@@ -1,4 +1,4 @@
1
- import VNode from '../VNode';
1
+ import type VNode from '../VNode';
2
2
  export declare const isPropagationStopped: {
3
3
  [key: string]: boolean;
4
4
  };
package/cjs/VNode.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Container from './Container';
1
+ import type Container from './Container';
2
2
  export interface RawNode {
3
3
  id: number;
4
4
  type: string;
package/cjs/VNode.js CHANGED
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const propsAlias_1 = __importStar(require("./propsAlias"));
27
- const constants_1 = require("./constants");
28
26
  const framework_shared_1 = require("@rsmax/framework-shared");
29
27
  const createCallbackProxy_1 = require("./SyntheticEvent/createCallbackProxy");
28
+ const constants_1 = require("./constants");
29
+ const propsAlias_1 = __importStar(require("./propsAlias"));
30
30
  function toRawNode(node) {
31
31
  if (node.type === constants_1.TYPE_TEXT) {
32
32
  return {
@@ -225,7 +225,7 @@ class VNode {
225
225
  }
226
226
  isDeleted() {
227
227
  var _a, _b;
228
- return this.deleted === true ? this.deleted : (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.isDeleted()) !== null && _b !== void 0 ? _b : false;
228
+ return this.deleted === true ? this.deleted : ((_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.isDeleted()) !== null && _b !== void 0 ? _b : false);
229
229
  }
230
230
  registerCallback(propKey, propValue) {
231
231
  const id = `${constants_1.REMAX_METHOD}_${this.id}_${propKey}`;
@@ -27,11 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  require("./polyfills/Function");
30
+ const framework_shared_1 = require("@rsmax/framework-shared");
30
31
  const React = __importStar(require("react"));
31
32
  const react_is_1 = require("react-is");
32
- const render_1 = __importDefault(require("./render"));
33
33
  const AppContainer_1 = __importDefault(require("./AppContainer"));
34
- const framework_shared_1 = require("@rsmax/framework-shared");
34
+ const render_1 = __importDefault(require("./render"));
35
35
  class DefaultAppComponent extends React.Component {
36
36
  render() {
37
37
  return React.createElement(React.Fragment, this.props);
@@ -50,6 +50,7 @@ function createAppConfig(App) {
50
50
  return this.callLifecycle(framework_shared_1.AppLifecycle.launch, options);
51
51
  },
52
52
  callLifecycle(lifecycle, ...args) {
53
+ var _a;
53
54
  const callbacks = framework_shared_1.AppInstanceContext.lifecycleCallback[lifecycle] || [];
54
55
  let result;
55
56
  callbacks.forEach((callback) => {
@@ -59,7 +60,7 @@ function createAppConfig(App) {
59
60
  return result;
60
61
  }
61
62
  const callback = (0, framework_shared_1.callbackName)(lifecycle);
62
- if (this._instance.current && this._instance.current[callback]) {
63
+ if ((_a = this._instance.current) === null || _a === void 0 ? void 0 : _a[callback]) {
63
64
  return this._instance.current[callback](...args);
64
65
  }
65
66
  },
@@ -26,8 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const React = __importStar(require("react"));
30
29
  const framework_shared_1 = require("@rsmax/framework-shared");
30
+ const React = __importStar(require("react"));
31
31
  const Container_1 = __importDefault(require("./Container"));
32
32
  const render_1 = __importDefault(require("./render"));
33
33
  function createComponentConfig(Component) {
@@ -26,8 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const React = __importStar(require("react"));
30
29
  const framework_shared_1 = require("@rsmax/framework-shared");
30
+ const React = __importStar(require("react"));
31
31
  const Container_1 = __importDefault(require("./Container"));
32
32
  const render_1 = __importDefault(require("./render"));
33
33
  function createComponentConfig(Component) {
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
7
6
  const framework_shared_1 = require("@rsmax/framework-shared");
7
+ const react_1 = __importDefault(require("react"));
8
8
  function createHostComponent(name, component) {
9
9
  if (component) {
10
10
  return component;
@@ -4,17 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resetPageId = void 0;
7
- const react_1 = __importDefault(require("react"));
8
7
  const framework_shared_1 = require("@rsmax/framework-shared");
9
- const stopPullDownRefresh_1 = __importDefault(require("./stopPullDownRefresh"));
8
+ const react_1 = __importDefault(require("react"));
10
9
  const Container_1 = __importDefault(require("./Container"));
11
10
  const ReactPortal_1 = require("./ReactPortal");
12
- const render_1 = __importDefault(require("./render"));
13
11
  const index_1 = require("./index");
12
+ const render_1 = __importDefault(require("./render"));
13
+ const stopPullDownRefresh_1 = __importDefault(require("./stopPullDownRefresh"));
14
14
  let idCounter = 0;
15
15
  function generatePageId() {
16
16
  const id = idCounter;
17
- const pageId = 'page_' + id;
17
+ const pageId = `page_${id}`;
18
18
  idCounter += 1;
19
19
  return pageId;
20
20
  }
@@ -64,7 +64,7 @@ function createPageConfig(Page, name) {
64
64
  modalContainer: this.modalContainer,
65
65
  ref: this.wrapperRef,
66
66
  });
67
- if (app && app._mount) {
67
+ if (app === null || app === void 0 ? void 0 : app._mount) {
68
68
  this.element = (0, ReactPortal_1.createPortal)(pageElement, this.container, this.pageId);
69
69
  app._mount(this);
70
70
  }
@@ -98,6 +98,7 @@ function createPageConfig(Page, name) {
98
98
  };
99
99
  },
100
100
  callLifecycle(lifecycle, ...args) {
101
+ var _a;
101
102
  const callbacks = this.lifecycleCallback[lifecycle] || [];
102
103
  let result;
103
104
  // 生命周期中可能改变 state 导致 callbacks 发生变化
@@ -110,7 +111,7 @@ function createPageConfig(Page, name) {
110
111
  return result;
111
112
  }
112
113
  const callback = (0, framework_shared_1.callbackName)(lifecycle);
113
- if (this.wrapperRef.current && this.wrapperRef.current[callback]) {
114
+ if ((_a = this.wrapperRef.current) === null || _a === void 0 ? void 0 : _a[callback]) {
114
115
  return this.wrapperRef.current[callback](...args);
115
116
  }
116
117
  },
@@ -1,3 +1,3 @@
1
- import { DependencyList } from 'react';
2
- import { Listener } from '../nativeEffect';
1
+ import { type DependencyList } from 'react';
2
+ import { type Listener } from '../nativeEffect';
3
3
  export default function useNativeEffect(listener: Listener, deps?: DependencyList): void;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
4
3
  const framework_shared_1 = require("@rsmax/framework-shared");
4
+ const react_1 = require("react");
5
5
  function useQuery() {
6
6
  const pageInstance = (0, react_1.useContext)(framework_shared_1.PageInstanceContext);
7
7
  return pageInstance.query;
@@ -79,7 +79,7 @@ function diffProperties(lastRawProps, nextRawProps) {
79
79
  }
80
80
  else if (propKey === CHILDREN) {
81
81
  if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
82
- updatePayload.push(propKey, '' + nextProp);
82
+ updatePayload.push(propKey, `${nextProp}`);
83
83
  }
84
84
  }
85
85
  else {
@@ -1,5 +1,5 @@
1
+ import type Container from '../Container';
1
2
  import VNode from '../VNode';
2
- import Container from '../Container';
3
3
  declare const _default: {
4
4
  now: any;
5
5
  getPublicInstance: <T>(inst: T) => T;
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const scheduler_1 = __importDefault(require("scheduler"));
7
+ const VNode_1 = __importDefault(require("../VNode"));
7
8
  const constants_1 = require("../constants");
8
9
  const instanceId_1 = require("../instanceId");
9
- const VNode_1 = __importDefault(require("../VNode"));
10
10
  const diffProperties_1 = __importDefault(require("./diffProperties"));
11
11
  const { unstable_scheduleCallback: scheduleDeferredCallback, unstable_cancelCallback: cancelDeferredCallback, unstable_shouldYield: shouldYield, unstable_now: now, } = scheduler_1.default;
12
12
  const DOM_TAG_MAP = {
package/cjs/propsAlias.js CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.propAlias = exports.getAlias = void 0;
7
- const plainStyle_1 = __importDefault(require("./utils/plainStyle"));
8
7
  const framework_shared_1 = require("@rsmax/framework-shared");
8
+ const plainStyle_1 = __importDefault(require("./utils/plainStyle"));
9
9
  function getAlias(prop, type) {
10
10
  var _a, _b;
11
11
  const hostComponent = framework_shared_1.RuntimeOptions.get('hostComponents')[type];
package/cjs/render.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
1
+ import type * as React from 'react';
2
2
  import ReactReconciler from 'react-reconciler';
3
- import Container from './Container';
4
- import AppContainer from './AppContainer';
3
+ import type AppContainer from './AppContainer';
4
+ import type Container from './Container';
5
5
  export declare const ReactReconcilerInst: ReactReconciler.Reconciler<unknown, unknown, unknown, unknown, unknown>;
6
6
  export default function render(rootElement: React.ReactElement | null, container: Container | AppContainer): any;
@@ -1,2 +1,2 @@
1
- import { ComponentClass } from 'react';
1
+ import type { ComponentClass } from 'react';
2
2
  export default function isClassComponent(Component: any): Component is ComponentClass;
@@ -65,7 +65,7 @@ function prefixKey(prefix, key) {
65
65
  */
66
66
  const prefixes = ['Webkit', 'ms', 'Moz', 'O'];
67
67
  for (const prop in exports.isUnitlessNumber) {
68
- prefixes.forEach(function (prefix) {
68
+ prefixes.forEach(prefix => {
69
69
  exports.isUnitlessNumber[prefixKey(prefix, prop)] = exports.isUnitlessNumber[prop];
70
70
  });
71
71
  }
@@ -1,22 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const CSSProperty_1 = require("./CSSProperty");
4
3
  const framework_shared_1 = require("@rsmax/framework-shared");
4
+ const CSSProperty_1 = require("./CSSProperty");
5
5
  const vendorPrefixes = ['webkit', 'moz', 'ms', 'o'];
6
6
  const transformReactStyleKey = (key) => {
7
7
  // css3 var
8
8
  if (key === null || key === void 0 ? void 0 : key.startsWith('--')) {
9
9
  return key;
10
10
  }
11
- let styleValue = key.replace(/\.?([A-Z]+)/g, function (_x, y) {
12
- return '-' + y.toLowerCase();
13
- });
11
+ let styleValue = key.replace(/\.?([A-Z]+)/g, (_x, y) => `-${y.toLowerCase()}`);
14
12
  // vendor prefix
15
13
  if (styleValue === null || styleValue === void 0 ? void 0 : styleValue.startsWith('-')) {
16
14
  const firstWord = styleValue.split('-').filter(s => s)[0];
17
15
  styleValue = styleValue.replace(/^-/, '');
18
16
  if ((0, framework_shared_1.find)(vendorPrefixes, prefix => prefix === firstWord)) {
19
- styleValue = '-' + styleValue;
17
+ styleValue = `-${styleValue}`;
20
18
  }
21
19
  }
22
20
  return styleValue;
@@ -25,7 +23,7 @@ const transformPx = (value) => {
25
23
  if (typeof value !== 'string') {
26
24
  return value;
27
25
  }
28
- return value.replace(/\b(\d+(\.\d+)?)px\b/g, function (match, x) {
26
+ return value.replace(/\b(\d+(\.\d+)?)px\b/g, (match, x) => {
29
27
  const targetUnit = 'rpx';
30
28
  const size = Number(x);
31
29
  return size % 1 === 0 ? size + targetUnit : size.toFixed(2) + targetUnit;
@@ -36,7 +34,7 @@ const plainStyle = (style) => {
36
34
  .reduce((acc, key) => {
37
35
  let value = style[key];
38
36
  if (!Number.isNaN(Number(value)) && !CSSProperty_1.isUnitlessNumber[key] && !(key === null || key === void 0 ? void 0 : key.startsWith('--'))) {
39
- value = value + 'rpx';
37
+ value = `${value}rpx`;
40
38
  }
41
39
  return [...acc, `${transformReactStyleKey(key)}:${framework_shared_1.RuntimeOptions.get('pxToRpx') ? transformPx(value) : value};`];
42
40
  }, [])
@@ -1,5 +1,5 @@
1
- import VNode, { RawNode } from './VNode';
2
- import { FiberRoot } from 'react-reconciler';
1
+ import type { FiberRoot } from 'react-reconciler';
2
+ import VNode, { type RawNode } from './VNode';
3
3
  interface SpliceUpdate {
4
4
  path: string;
5
5
  start: number;
@@ -1,5 +1,5 @@
1
- import VNode, { RawNode } from './VNode';
2
- import { FiberRoot } from 'react-reconciler';
1
+ import type { FiberRoot } from 'react-reconciler';
2
+ import VNode, { type RawNode } from './VNode';
3
3
  interface SpliceUpdate {
4
4
  path: string[];
5
5
  start: number;
package/esm/Container.js CHANGED
@@ -1,8 +1,8 @@
1
+ import { RuntimeOptions } from '@rsmax/framework-shared';
1
2
  import VNode from './VNode';
3
+ import { unstable_batchedUpdates } from './index';
2
4
  import { generate } from './instanceId';
3
5
  import nativeEffector from './nativeEffect';
4
- import { RuntimeOptions } from '@rsmax/framework-shared';
5
- import { unstable_batchedUpdates } from './index';
6
6
  export default class Container {
7
7
  constructor(context, rootKey = 'root') {
8
8
  this.updateQueue = [];
@@ -1,2 +1,2 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  export declare function createPortal(children: React.ReactNode, containerInfo: any, key?: string): any;
@@ -1,2 +1,2 @@
1
- import VNode from '../VNode';
1
+ import type VNode from '../VNode';
2
2
  export declare function createCallbackProxy(eventType: string, node: VNode, callback: (...params: any) => any): (...params: any) => any;
@@ -1,6 +1,6 @@
1
1
  import { find } from '@rsmax/framework-shared';
2
+ import { DEPRECATED_CATCH_TYPE, SYNTHETIC_TYPES } from './constants';
2
3
  import stopPropagation, { validate as validatePropagation, isPropagationStopped } from './stopPropagation';
3
- import { SYNTHETIC_TYPES, DEPRECATED_CATCH_TYPE } from './constants';
4
4
  function isSyntheticType(inputType) {
5
5
  if (DEPRECATED_CATCH_TYPE === inputType) {
6
6
  console.warn('DEPRECATION: remax 已支持在 onClick 事件中使用 stopPropagation 阻止事件冒泡,请尽量不要使用 catchClick');
@@ -21,7 +21,7 @@ export function createCallbackProxy(eventType, node, callback) {
21
21
  if (!isSyntheticType(eventType)) {
22
22
  return callback;
23
23
  }
24
- return function (nativeEvent, ...restParams) {
24
+ return (nativeEvent, ...restParams) => {
25
25
  const syntheticEvent = createBaseSyntheticEvent(node, eventType, nativeEvent);
26
26
  if (isPropagationStopped[eventType]) {
27
27
  validatePropagation(node, eventType);
@@ -1,4 +1,4 @@
1
- import VNode from '../VNode';
1
+ import type VNode from '../VNode';
2
2
  export declare const isPropagationStopped: {
3
3
  [key: string]: boolean;
4
4
  };
package/esm/VNode.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Container from './Container';
1
+ import type Container from './Container';
2
2
  export interface RawNode {
3
3
  id: number;
4
4
  type: string;
package/esm/VNode.js CHANGED
@@ -1,7 +1,7 @@
1
- import propsAlias, { propAlias } from './propsAlias';
2
- import { REMAX_METHOD, TYPE_TEXT } from './constants';
3
1
  import { RuntimeOptions } from '@rsmax/framework-shared';
4
2
  import { createCallbackProxy } from './SyntheticEvent/createCallbackProxy';
3
+ import { REMAX_METHOD, TYPE_TEXT } from './constants';
4
+ import propsAlias, { propAlias } from './propsAlias';
5
5
  function toRawNode(node) {
6
6
  if (node.type === TYPE_TEXT) {
7
7
  return {
@@ -200,7 +200,7 @@ export default class VNode {
200
200
  }
201
201
  isDeleted() {
202
202
  var _a, _b;
203
- return this.deleted === true ? this.deleted : (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.isDeleted()) !== null && _b !== void 0 ? _b : false;
203
+ return this.deleted === true ? this.deleted : ((_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.isDeleted()) !== null && _b !== void 0 ? _b : false);
204
204
  }
205
205
  registerCallback(propKey, propValue) {
206
206
  const id = `${REMAX_METHOD}_${this.id}_${propKey}`;
@@ -1,9 +1,9 @@
1
1
  import './polyfills/Function';
2
+ import { AppInstanceContext, AppLifecycle, RuntimeOptions, callbackName, isClassComponent, } from '@rsmax/framework-shared';
2
3
  import * as React from 'react';
3
4
  import { ForwardRef } from 'react-is';
4
- import render from './render';
5
5
  import AppContainer from './AppContainer';
6
- import { AppInstanceContext, AppLifecycle, callbackName, isClassComponent, RuntimeOptions, } from '@rsmax/framework-shared';
6
+ import render from './render';
7
7
  class DefaultAppComponent extends React.Component {
8
8
  render() {
9
9
  return React.createElement(React.Fragment, this.props);
@@ -22,6 +22,7 @@ export default function createAppConfig(App) {
22
22
  return this.callLifecycle(AppLifecycle.launch, options);
23
23
  },
24
24
  callLifecycle(lifecycle, ...args) {
25
+ var _a;
25
26
  const callbacks = AppInstanceContext.lifecycleCallback[lifecycle] || [];
26
27
  let result;
27
28
  callbacks.forEach((callback) => {
@@ -31,7 +32,7 @@ export default function createAppConfig(App) {
31
32
  return result;
32
33
  }
33
34
  const callback = callbackName(lifecycle);
34
- if (this._instance.current && this._instance.current[callback]) {
35
+ if ((_a = this._instance.current) === null || _a === void 0 ? void 0 : _a[callback]) {
35
36
  return this._instance.current[callback](...args);
36
37
  }
37
38
  },
@@ -1,5 +1,5 @@
1
+ import { ComponentInstanceContext, RuntimeOptions } from '@rsmax/framework-shared';
1
2
  import * as React from 'react';
2
- import { RuntimeOptions, ComponentInstanceContext } from '@rsmax/framework-shared';
3
3
  import Container from './Container';
4
4
  import render from './render';
5
5
  export default function createComponentConfig(Component) {
@@ -1,5 +1,5 @@
1
+ import { ComponentInstanceContext, RuntimeOptions } from '@rsmax/framework-shared';
1
2
  import * as React from 'react';
2
- import { RuntimeOptions, ComponentInstanceContext } from '@rsmax/framework-shared';
3
3
  import Container from './Container';
4
4
  import render from './render';
5
5
  export default function createComponentConfig(Component) {
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import { RuntimeOptions } from '@rsmax/framework-shared';
2
+ import React from 'react';
3
3
  export default function createHostComponent(name, component) {
4
4
  if (component) {
5
5
  return component;
@@ -1,14 +1,14 @@
1
+ import { Lifecycle, RuntimeOptions, callbackName, createPageWrapper } from '@rsmax/framework-shared';
1
2
  import React from 'react';
2
- import { callbackName, createPageWrapper, Lifecycle, RuntimeOptions } from '@rsmax/framework-shared';
3
- import stopPullDownRefresh from './stopPullDownRefresh';
4
3
  import Container from './Container';
5
4
  import { createPortal } from './ReactPortal';
6
- import render from './render';
7
5
  import { unstable_batchedUpdates } from './index';
6
+ import render from './render';
7
+ import stopPullDownRefresh from './stopPullDownRefresh';
8
8
  let idCounter = 0;
9
9
  function generatePageId() {
10
10
  const id = idCounter;
11
- const pageId = 'page_' + id;
11
+ const pageId = `page_${id}`;
12
12
  idCounter += 1;
13
13
  return pageId;
14
14
  }
@@ -57,7 +57,7 @@ export default function createPageConfig(Page, name) {
57
57
  modalContainer: this.modalContainer,
58
58
  ref: this.wrapperRef,
59
59
  });
60
- if (app && app._mount) {
60
+ if (app === null || app === void 0 ? void 0 : app._mount) {
61
61
  this.element = createPortal(pageElement, this.container, this.pageId);
62
62
  app._mount(this);
63
63
  }
@@ -91,6 +91,7 @@ export default function createPageConfig(Page, name) {
91
91
  };
92
92
  },
93
93
  callLifecycle(lifecycle, ...args) {
94
+ var _a;
94
95
  const callbacks = this.lifecycleCallback[lifecycle] || [];
95
96
  let result;
96
97
  // 生命周期中可能改变 state 导致 callbacks 发生变化
@@ -103,7 +104,7 @@ export default function createPageConfig(Page, name) {
103
104
  return result;
104
105
  }
105
106
  const callback = callbackName(lifecycle);
106
- if (this.wrapperRef.current && this.wrapperRef.current[callback]) {
107
+ if ((_a = this.wrapperRef.current) === null || _a === void 0 ? void 0 : _a[callback]) {
107
108
  return this.wrapperRef.current[callback](...args);
108
109
  }
109
110
  },
@@ -1,3 +1,3 @@
1
- import { DependencyList } from 'react';
2
- import { Listener } from '../nativeEffect';
1
+ import { type DependencyList } from 'react';
2
+ import { type Listener } from '../nativeEffect';
3
3
  export default function useNativeEffect(listener: Listener, deps?: DependencyList): void;
@@ -1,5 +1,5 @@
1
- import { useContext } from 'react';
2
1
  import { PageInstanceContext } from '@rsmax/framework-shared';
2
+ import { useContext } from 'react';
3
3
  export default function useQuery() {
4
4
  const pageInstance = useContext(PageInstanceContext);
5
5
  return pageInstance.query;
@@ -77,7 +77,7 @@ export default function diffProperties(lastRawProps, nextRawProps) {
77
77
  }
78
78
  else if (propKey === CHILDREN) {
79
79
  if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
80
- updatePayload.push(propKey, '' + nextProp);
80
+ updatePayload.push(propKey, `${nextProp}`);
81
81
  }
82
82
  }
83
83
  else {
@@ -1,5 +1,5 @@
1
+ import type Container from '../Container';
1
2
  import VNode from '../VNode';
2
- import Container from '../Container';
3
3
  declare const _default: {
4
4
  now: any;
5
5
  getPublicInstance: <T>(inst: T) => T;
@@ -1,7 +1,7 @@
1
1
  import scheduler from 'scheduler';
2
+ import VNode from '../VNode';
2
3
  import { TYPE_TEXT } from '../constants';
3
4
  import { generate } from '../instanceId';
4
- import VNode from '../VNode';
5
5
  import diffProperties from './diffProperties';
6
6
  const { unstable_scheduleCallback: scheduleDeferredCallback, unstable_cancelCallback: cancelDeferredCallback, unstable_shouldYield: shouldYield, unstable_now: now, } = scheduler;
7
7
  const DOM_TAG_MAP = {
package/esm/propsAlias.js CHANGED
@@ -1,5 +1,5 @@
1
- import plainStyle from './utils/plainStyle';
2
1
  import { RuntimeOptions } from '@rsmax/framework-shared';
2
+ import plainStyle from './utils/plainStyle';
3
3
  export function getAlias(prop, type) {
4
4
  var _a, _b;
5
5
  const hostComponent = RuntimeOptions.get('hostComponents')[type];
package/esm/render.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
1
+ import type * as React from 'react';
2
2
  import ReactReconciler from 'react-reconciler';
3
- import Container from './Container';
4
- import AppContainer from './AppContainer';
3
+ import type AppContainer from './AppContainer';
4
+ import type Container from './Container';
5
5
  export declare const ReactReconcilerInst: ReactReconciler.Reconciler<unknown, unknown, unknown, unknown, unknown>;
6
6
  export default function render(rootElement: React.ReactElement | null, container: Container | AppContainer): any;
@@ -1,2 +1,2 @@
1
- import { ComponentClass } from 'react';
1
+ import type { ComponentClass } from 'react';
2
2
  export default function isClassComponent(Component: any): Component is ComponentClass;
@@ -62,7 +62,7 @@ function prefixKey(prefix, key) {
62
62
  */
63
63
  const prefixes = ['Webkit', 'ms', 'Moz', 'O'];
64
64
  for (const prop in isUnitlessNumber) {
65
- prefixes.forEach(function (prefix) {
65
+ prefixes.forEach(prefix => {
66
66
  isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
67
67
  });
68
68
  }
@@ -1,20 +1,18 @@
1
+ import { RuntimeOptions, find } from '@rsmax/framework-shared';
1
2
  import { isUnitlessNumber } from './CSSProperty';
2
- import { find, RuntimeOptions } from '@rsmax/framework-shared';
3
3
  const vendorPrefixes = ['webkit', 'moz', 'ms', 'o'];
4
4
  const transformReactStyleKey = (key) => {
5
5
  // css3 var
6
6
  if (key === null || key === void 0 ? void 0 : key.startsWith('--')) {
7
7
  return key;
8
8
  }
9
- let styleValue = key.replace(/\.?([A-Z]+)/g, function (_x, y) {
10
- return '-' + y.toLowerCase();
11
- });
9
+ let styleValue = key.replace(/\.?([A-Z]+)/g, (_x, y) => `-${y.toLowerCase()}`);
12
10
  // vendor prefix
13
11
  if (styleValue === null || styleValue === void 0 ? void 0 : styleValue.startsWith('-')) {
14
12
  const firstWord = styleValue.split('-').filter(s => s)[0];
15
13
  styleValue = styleValue.replace(/^-/, '');
16
14
  if (find(vendorPrefixes, prefix => prefix === firstWord)) {
17
- styleValue = '-' + styleValue;
15
+ styleValue = `-${styleValue}`;
18
16
  }
19
17
  }
20
18
  return styleValue;
@@ -23,7 +21,7 @@ const transformPx = (value) => {
23
21
  if (typeof value !== 'string') {
24
22
  return value;
25
23
  }
26
- return value.replace(/\b(\d+(\.\d+)?)px\b/g, function (match, x) {
24
+ return value.replace(/\b(\d+(\.\d+)?)px\b/g, (match, x) => {
27
25
  const targetUnit = 'rpx';
28
26
  const size = Number(x);
29
27
  return size % 1 === 0 ? size + targetUnit : size.toFixed(2) + targetUnit;
@@ -34,7 +32,7 @@ const plainStyle = (style) => {
34
32
  .reduce((acc, key) => {
35
33
  let value = style[key];
36
34
  if (!Number.isNaN(Number(value)) && !isUnitlessNumber[key] && !(key === null || key === void 0 ? void 0 : key.startsWith('--'))) {
37
- value = value + 'rpx';
35
+ value = `${value}rpx`;
38
36
  }
39
37
  return [...acc, `${transformReactStyleKey(key)}:${RuntimeOptions.get('pxToRpx') ? transformPx(value) : value};`];
40
38
  }, [])
package/package.json CHANGED
@@ -1,18 +1,14 @@
1
1
  {
2
2
  "name": "@rsmax/runtime",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "description": "Rsmax 是一个全新的基于 React 的小程序开发框架",
5
- "main": "./cjs/index.js",
6
- "esnext": "./esm/index.js",
7
- "module": "./esm/index.js",
8
- "typings": "./esm/index.d.ts",
9
5
  "keywords": [
10
6
  "react",
11
7
  "miniapp",
12
8
  "mini-program",
13
9
  "wechat"
14
10
  ],
15
- "license": "MIT",
11
+ "homepage": "https://remax.wdchiphop.cn",
16
12
  "bugs": {
17
13
  "url": "https://github.com/remaxjs/remax/issues"
18
14
  },
@@ -20,25 +16,28 @@
20
16
  "type": "git",
21
17
  "url": "git+https://github.com/remaxjs/remax.git"
22
18
  },
23
- "homepage": "https://remaxjs.org",
19
+ "license": "MIT",
20
+ "main": "./cjs/index.js",
21
+ "module": "./esm/index.js",
22
+ "typings": "./esm/index.d.ts",
24
23
  "scripts": {
25
- "clean": "rimraf esm cjs tsconfig.tsbuildinfo",
26
24
  "prebuild": "npm run clean",
27
25
  "build": "tsc",
28
26
  "build:cjs": "tsc --module CommonJS --outDir cjs",
27
+ "clean": "rimraf esm cjs tsconfig.tsbuildinfo",
29
28
  "test": "vitest run"
30
29
  },
31
30
  "dependencies": {
32
- "@rsmax/framework-shared": "1.3.11",
33
- "@rsmax/shared": "1.3.11",
34
- "@rsmax/web": "1.3.11",
31
+ "@rsmax/framework-shared": "1.3.13",
32
+ "@rsmax/shared": "1.3.13",
33
+ "@rsmax/web": "1.3.13",
35
34
  "qs": "^6.9.3",
36
35
  "react-is": "^18.3.0",
37
36
  "react-reconciler": "0.29.0",
38
37
  "scheduler": "0.23.2"
39
38
  },
40
39
  "devDependencies": {
41
- "@rsmax/types": "1.3.11",
40
+ "@rsmax/types": "1.3.13",
42
41
  "@types/lodash.merge": "^4.6.6",
43
42
  "@types/node": "^18",
44
43
  "@types/qs": "^6.9.3",
@@ -52,5 +51,6 @@
52
51
  "publishConfig": {
53
52
  "access": "public"
54
53
  },
55
- "gitHead": "f7430582843aaab07f32ba74f81c47863bcd4a8b"
54
+ "esnext": "./esm/index.js",
55
+ "gitHead": "ff3656307036567c5b9d9b62dcaa599f539d56b7"
56
56
  }