🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@ray-core/framework-shared

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ray-core/framework-shared - npm Package Compare versions

Comparing version

to
0.3.0-beta.5

6

CHANGELOG.md

@@ -6,4 +6,8 @@ # Change Log

# [0.3.0-beta.4](https://registry.code.tuya-inc.top/godzilla/ray-core/compare/v0.2.9...v0.3.0-beta.4) (2023-05-17)
# [0.3.0-beta.5](https://registry.code.tuya-inc.top/godzilla/ray-core/compare/v0.2.9...v0.3.0-beta.5) (2023-05-24)
### Bug Fixes
- 1. 修复 useModal 内容渲染未更新问题;2. 修复更新属性内容 html 标签映射问题 ([581a85f](https://registry.code.tuya-inc.top/godzilla/ray-core/commits/581a85f12e8be21867933b89f13cfd1bfefb007c))
### Features

@@ -10,0 +14,0 @@

25

cjs/hooks.js

@@ -61,18 +61,21 @@ "use strict";

var id = (0, react_1.useRef)(inst.__modal_hook_index__++);
var _a = __read((0, react_1.useState)(content), 2), x = _a[0], update = _a[1];
var _b = __read((0, react_1.useState)(initShow), 2), show = _b[0], setState = _b[1];
(0, react_1.useEffect)(function () {
var _a = __read((0, react_1.useState)(initShow), 2), show = _a[0], setState = _a[1];
var update = function (con) {
var _a, _b, _c;
var ref = (_c = (_b = (_a = inst.wrapperRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerModalRef) === null || _c === void 0 ? void 0 : _c.current;
var content = (x === null || x === void 0 ? void 0 : x.type) ? (0, react_1.cloneElement)(x, { key: id.current + '' }) : x;
ref === null || ref === void 0 ? void 0 : ref.renderModal(id.current, show ? content : null);
inst.__modal_hook_index__ = ref.children.length; // 每次执行都会递增,但最大值只会是hook使用的次数
}, [x, show]);
return {
var modal = (_c = (_b = (_a = inst.wrapperRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerModalRef) === null || _c === void 0 ? void 0 : _c.current;
var jsx = (content === null || content === void 0 ? void 0 : content.type) ? (0, react_1.cloneElement)(content, { key: id.current + '' }) : content;
modal === null || modal === void 0 ? void 0 : modal.renderModal(id.current, show ? (con !== undefined ? con : jsx) : null);
inst.__modal_hook_index__ = modal.children.length; // 每次执行都会递增,但最大值只会是hook使用的次数
};
(0, react_1.useEffect)(update, [content]);
var ref = (0, react_1.useRef)({});
ref.current = {
id: id.current,
update: update,
remove: function () { return update(null); },
toggle: function () { return setState(!show); },
isShow: !!x && show
toggle: function () { return setState(!ref.current.isShow); },
isShow: show,
};
return ref.current;
}
exports.useModal = useModal;

@@ -51,17 +51,20 @@ var __read = (this && this.__read) || function (o, n) {

var id = useRef(inst.__modal_hook_index__++);
var _a = __read(useState(content), 2), x = _a[0], update = _a[1];
var _b = __read(useState(initShow), 2), show = _b[0], setState = _b[1];
useEffect(function () {
var _a = __read(useState(initShow), 2), show = _a[0], setState = _a[1];
var update = function (con) {
var _a, _b, _c;
var ref = (_c = (_b = (_a = inst.wrapperRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerModalRef) === null || _c === void 0 ? void 0 : _c.current;
var content = (x === null || x === void 0 ? void 0 : x.type) ? cloneElement(x, { key: id.current + '' }) : x;
ref === null || ref === void 0 ? void 0 : ref.renderModal(id.current, show ? content : null);
inst.__modal_hook_index__ = ref.children.length; // 每次执行都会递增,但最大值只会是hook使用的次数
}, [x, show]);
return {
var modal = (_c = (_b = (_a = inst.wrapperRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.innerModalRef) === null || _c === void 0 ? void 0 : _c.current;
var jsx = (content === null || content === void 0 ? void 0 : content.type) ? cloneElement(content, { key: id.current + '' }) : content;
modal === null || modal === void 0 ? void 0 : modal.renderModal(id.current, show ? (con !== undefined ? con : jsx) : null);
inst.__modal_hook_index__ = modal.children.length; // 每次执行都会递增,但最大值只会是hook使用的次数
};
useEffect(update, [content]);
var ref = useRef({});
ref.current = {
id: id.current,
update: update,
remove: function () { return update(null); },
toggle: function () { return setState(!show); },
isShow: !!x && show
toggle: function () { return setState(!ref.current.isShow); },
isShow: show,
};
return ref.current;
}
{
"name": "@ray-core/framework-shared",
"version": "0.3.0-beta.4",
"version": "0.3.0-beta.5",
"description": "使用真正的 React 构建跨平台小程序",

@@ -21,3 +21,3 @@ "license": "MIT",

"devDependencies": {
"@ray-core/types": "0.3.0-beta.4",
"@ray-core/types": "0.3.0-beta.5",
"@types/react": "^16.9.33",

@@ -30,3 +30,3 @@ "@types/react-is": "^16.7.1",

},
"gitHead": "c305e96bf74b23abeebe38d05fe63707ff4f5249"
"gitHead": "f313a2f28c509bb7ffea2827955e44ee426eec23"
}