-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6396 from alibaba/release/next
Release 3.2.8
- Loading branch information
Showing
54 changed files
with
1,196 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
defaults | ||
ios_saf 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from '@ice/app'; | ||
import canvasPlugin from '@ice/plugin-canvas'; | ||
|
||
export default defineConfig(() => ({ | ||
plugins: [ | ||
canvasPlugin(), | ||
], | ||
ssr: true, | ||
ssg: false, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@examples/canvas-project", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"start": "ice start", | ||
"build": "ice build" | ||
}, | ||
"description": "", | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@ice/app": "workspace:*", | ||
"@ice/plugin-canvas": "workspace:*", | ||
"@ice/runtime": "workspace:*", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"@ice/cache-canvas": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.0.0", | ||
"@types/react-dom": "^18.0.0", | ||
"webpack": "^5.86.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineAppConfig } from 'ice'; | ||
|
||
export default defineAppConfig(() => ({})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Bar() { | ||
return ( | ||
<div> | ||
bar | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Meta, Title, Links, Main, Scripts } from 'ice'; | ||
|
||
function Document() { | ||
return ( | ||
<html> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="description" content="ICE Demo" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Title /> | ||
<Links /> | ||
</head> | ||
<body> | ||
<Main /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default Document; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { definePageConfig, CacheCanvas } from 'ice'; | ||
import { useRef } from 'react'; | ||
import styles from './index.module.css'; | ||
|
||
export type RefCacheCanvas = { | ||
cacheCanvasToStorage: () => void; | ||
}; | ||
|
||
const GAME_CANVAS_ID = 'canvas-id'; | ||
|
||
export default function Home() { | ||
const childRef = useRef<RefCacheCanvas>(); | ||
const initFunc = () => { | ||
return new Promise((resolve) => { | ||
const canvas: HTMLCanvasElement | null = document.getElementById(GAME_CANVAS_ID) as HTMLCanvasElement; | ||
if (canvas && typeof canvas.getContext === 'function') { | ||
let ctx: CanvasRenderingContext2D | null = canvas.getContext('2d'); | ||
|
||
ctx?.fillRect(25, 25, 100, 100); | ||
ctx?.clearRect(45, 45, 60, 60); | ||
ctx?.strokeRect(50, 50, 50, 50); | ||
} | ||
|
||
setTimeout(() => { | ||
console.log('canvas paint ready!'); | ||
resolve(true); | ||
}, 5000); | ||
}); | ||
}; | ||
return ( | ||
<> | ||
<h2 className={styles.title}>Home Page</h2> | ||
<CacheCanvas | ||
ref={childRef} | ||
id={GAME_CANVAS_ID} | ||
init={initFunc} | ||
fallback={() => <div>fallback</div>} | ||
/> | ||
<button | ||
style={{ display: 'block' }} | ||
onClick={() => { | ||
console.log('active cache!'); | ||
childRef.current?.cacheCanvasToStorage(); | ||
}} | ||
>cache canvas</button> | ||
</> | ||
); | ||
} | ||
|
||
export const pageConfig = definePageConfig(() => { | ||
return { | ||
title: 'Home', | ||
meta: [ | ||
{ | ||
name: 'theme-color', | ||
content: '#000', | ||
}, | ||
{ | ||
name: 'title-color', | ||
content: '#f00', | ||
}, | ||
], | ||
auth: ['admin'], | ||
}; | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.title { | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface AppData { | ||
title: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="@ice/app/types" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"compileOnSave": false, | ||
"buildOnSave": false, | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "build", | ||
"module": "esnext", | ||
"target": "es6", | ||
"jsx": "react-jsx", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"lib": ["es6", "dom"], | ||
"sourceMap": true, | ||
"allowJs": true, | ||
"rootDir": "./", | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noImplicitAny": false, | ||
"importHelpers": true, | ||
"strictNullChecks": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"noUnusedLocals": true, | ||
"skipLibCheck": true, | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"ice": [".ice"] | ||
} | ||
}, | ||
"include": ["src", ".ice", "ice.config.*"], | ||
"exclude": ["build", "public"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const home = () => { | ||
return ( | ||
<>home</> | ||
); | ||
}; | ||
|
||
export default home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @ice/cache-canvas | ||
|
||
## 0.0.9 | ||
|
||
### Patch Changes | ||
|
||
- 018238f9: feat: support cache of 2d cavans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# @ice/cache-canvas | ||
|
||
React component for supporting canvas for cache. | ||
|
||
## Usage | ||
|
||
```bash | ||
npm i @ice/cache-canvas -S | ||
``` | ||
|
||
```jsx | ||
import MainGame from './game'; // eva.js 的封装 | ||
|
||
const GAME_CANVAS = 'game-canvas'; | ||
|
||
export default (props) => { | ||
useEffect(() => { | ||
const gameEl = document.getElementById(GAME_CANVAS); | ||
new MainGame(gameEl, getGameHeight()); | ||
}, []); | ||
|
||
const init = () => { | ||
return new Promise((resolve) => { | ||
const canvas: HTMLCanvasElement | null = document.getElementById(GAME_CANVAS_ID) as HTMLCanvasElement; | ||
if (canvas && typeof canvas.getContext === 'function') { | ||
let ctx: CanvasRenderingContext2D | null = canvas.getContext('2d'); | ||
|
||
ctx?.fillRect(25, 25, 100, 100); | ||
ctx?.clearRect(45, 45, 60, 60); | ||
ctx?.strokeRect(50, 50, 50, 50); | ||
} | ||
|
||
setTimeout(() => { | ||
console.log('canvas paint ready!'); | ||
resolve(true); | ||
}, 5000); | ||
}); | ||
} | ||
|
||
return ( | ||
<> | ||
<CanvasCache id={GAME_CANVAS} useCache={false} init={init} /> | ||
</> | ||
); | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@ice/cache-canvas", | ||
"version": "0.0.9", | ||
"description": "", | ||
"main": "./esm/index.js", | ||
"types": "./esm/index.d.ts", | ||
"scripts": { | ||
"watch": "tsc -w", | ||
"build": "tsc", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
}, | ||
"dependencies": { | ||
"universal-env": "^3.3.3" | ||
}, | ||
"peerDependencies": { | ||
"react": "^18", | ||
"react-dom": "^18" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.