@ray-js/code-sandbox 0.0.3-beta-5 → 0.0.3-beta-7
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/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
English | [简体中文](./README-zh_CN.md)
|
|
2
2
|
|
|
3
|
-
# @ray/code-sandbox
|
|
3
|
+
# @ray-js/code-sandbox
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@ray/code-sandbox) [](https://www.npmjs.com/package/@ray/code-sandbox)
|
|
5
|
+
[](https://www.npmjs.com/package/@ray-js/code-sandbox) [](https://www.npmjs.com/package/@ray-js/code-sandbox)
|
|
6
6
|
|
|
7
7
|
> CodeSandBox container
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
$ npm install @ray/code-sandbox
|
|
12
|
+
$ npm install @ray-js/code-sandbox
|
|
13
13
|
# or
|
|
14
|
-
$ yarn add @ray/code-sandbox
|
|
14
|
+
$ yarn add @ray-js/code-sandbox
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Develop
|
|
@@ -30,14 +30,14 @@ yarn start:tuya
|
|
|
30
30
|
Must -dependencies in installation
|
|
31
31
|
|
|
32
32
|
```sh
|
|
33
|
-
yarn add @ray/code-sandbox @ray-js/ray
|
|
33
|
+
yarn add @ray-js/code-sandbox @ray-js/ray
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Create a new Playground page in the PAGES directory, the content is as follows
|
|
37
37
|
|
|
38
38
|
```tsx
|
|
39
39
|
import React from 'react';
|
|
40
|
-
import CodeSandbox from '@ray/code-sandbox';
|
|
40
|
+
import CodeSandbox from '@ray-js/code-sandbox';
|
|
41
41
|
|
|
42
42
|
import * as RayComponents from '@ray-js/ray';
|
|
43
43
|
|
|
@@ -68,13 +68,13 @@ export default {
|
|
|
68
68
|
Must -dependencies in installation
|
|
69
69
|
|
|
70
70
|
```sh
|
|
71
|
-
yarn add @ray/code-sandbox antd axios styled-components lodash @saber2pr/monaco
|
|
71
|
+
yarn add @ray-js/code-sandbox antd axios styled-components lodash @saber2pr/monaco
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
Method 1: Introduce Codesandbox editor to the page:
|
|
75
75
|
|
|
76
76
|
```tsx
|
|
77
|
-
import { CodeSandboxButton } from '@ray/code-sandbox/lib/txp'
|
|
77
|
+
import { CodeSandboxButton } from '@ray-js/code-sandbox/lib/txp'
|
|
78
78
|
|
|
79
79
|
<CodeSandboxButton
|
|
80
80
|
title="Playground" // The title of Editor's pop -up window
|
|
@@ -96,7 +96,7 @@ After clicking the button, you will pop up the window to open the CodesandBox ed
|
|
|
96
96
|
Method 2: Do not use the button pop -up window, directly access the editor+simulator:
|
|
97
97
|
|
|
98
98
|
```tsx
|
|
99
|
-
import { CodeSandbox } from '@ray/code-sandbox/lib/txp'
|
|
99
|
+
import { CodeSandbox } from '@ray-js/code-sandbox/lib/txp'
|
|
100
100
|
|
|
101
101
|
<CodeSandbox
|
|
102
102
|
title="Button 组件" // The title in DEMO container
|
package/lib/loading/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { Button, View } from '@ray-js/ray';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import Loading from '@ray-js/components-ty-loading';
|
|
4
4
|
import styles from './index.module.less';
|
|
5
5
|
export const SandboxLoading = _ref => {
|
|
6
6
|
let {
|
|
@@ -11,7 +11,9 @@ export const SandboxLoading = _ref => {
|
|
|
11
11
|
} = _ref;
|
|
12
12
|
return /*#__PURE__*/React.createElement(View, {
|
|
13
13
|
className: styles.loading
|
|
14
|
-
}, /*#__PURE__*/React.createElement(View, null, type === 'compile' ? /*#__PURE__*/React.createElement(Loading,
|
|
14
|
+
}, /*#__PURE__*/React.createElement(View, null, type === 'compile' ? /*#__PURE__*/React.createElement(Loading, {
|
|
15
|
+
size: "100rpx"
|
|
16
|
+
}) : /*#__PURE__*/React.createElement(Button, {
|
|
15
17
|
onClick: () => {
|
|
16
18
|
// reloadSandbox 方法是 ci 打包时注入的 api,和 txp 平台交互(postmessage)
|
|
17
19
|
// @ts-ignore
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Spin } from 'antd';
|
|
2
|
-
import { getComponentResource } from '../../services';
|
|
3
2
|
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
3
|
+
import { getComponentResource } from '../../services';
|
|
4
4
|
import { Editor } from '@saber2pr/monaco';
|
|
5
5
|
const timeout = function () {
|
|
6
6
|
let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/code-sandbox",
|
|
3
|
-
"version": "0.0.3-beta-
|
|
3
|
+
"version": "0.0.3-beta-7",
|
|
4
4
|
"description": "小程序 CodeSandbox 容器",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"@ray-js/ray": "^1.4.9"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"clsx": "^1.2.1"
|
|
37
|
+
"clsx": "^1.2.1",
|
|
38
|
+
"js-base64": "^3.7.7"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@commitlint/cli": "^7.2.1",
|
|
41
42
|
"@commitlint/config-conventional": "^9.0.1",
|
|
42
43
|
"@ray-js/cli": "^1.4.9",
|
|
44
|
+
"@ray-js/components-ty-loading": "^0.1.1",
|
|
43
45
|
"@ray-js/ray": "^1.4.9",
|
|
44
|
-
"@ray-js/smart-ui": "^1.2.0",
|
|
45
46
|
"@saber2pr/monaco": "^0.0.90",
|
|
46
|
-
"@tuya-miniapp/smart-ui": "^1.2.0",
|
|
47
47
|
"antd": "^5.20.2",
|
|
48
48
|
"axios": "^1.7.4",
|
|
49
49
|
"core-js": "^3.19.1",
|