Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CD(): vue template #9502

Merged
merged 11 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"new",
"/.codesandbox/templates/node",
"/.codesandbox/templates/next",
"/.codesandbox/templates/vanilla"
"/.codesandbox/templates/vanilla",
"/.codesandbox/templates/vue"
],
"node": "16"
}
5 changes: 2 additions & 3 deletions .codesandbox/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import match from 'micromatch';
import path from 'path';
import { getGitInfo } from '../scripts/git.mjs';

const BINARY_EXT = ['png', 'jpg', 'jpeg'];
const BINARY_EXT = ['png', 'jpg', 'jpeg', 'ico'];

function bufferToBase64DataUrl(buffer, mimeType) {
return 'data:' + mimeType + ';base64,' + buffer.toString('base64');
Expand Down Expand Up @@ -94,7 +94,6 @@ export async function createCodeSandbox(appPath) {
);
return `https://codesandbox.io/s/${sandbox_id}`;
} catch (error) {
// console.log(error.response.data);
throw new Error(error.response.data);
throw error.response?.data || error;
}
}
24 changes: 24 additions & 0 deletions .codesandbox/templates/vue/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
package-lock.json
.DS_Store
dist
dist-ssr
coverage
*.local

# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions .codesandbox/templates/vue/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}
15 changes: 15 additions & 0 deletions .codesandbox/templates/vue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fabric Vue.js Sandbox

A [`vue`](https://vuejs.org/) app for reproducing `fabric` issues and creating examples.

## Reproducing

Creating a clear, easy to use reproduction is very **IMPORTANT**.
Keep it simple and concise.
Don't add stuff that is out of scope.

Make sure you are reproducing with the correct version of fabric.

Provide a **detailed description** including steps to reproduce in the [`REPRODUCE.md`](./REPRODUCE.md) file.

Navigate to [`src/App.vue`](./src/App.vue) and start editing.
5 changes: 5 additions & 0 deletions .codesandbox/templates/vue/REPRODUCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Reproducing

## Steps

1.
1 change: 1 addition & 0 deletions .codesandbox/templates/vue/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
13 changes: 13 additions & 0 deletions .codesandbox/templates/vue/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions .codesandbox/templates/vue/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "vue",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
},
"dependencies": {
"fabric": "file:../../..",
"vue": "^3.3.4"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
"@types/node": "^18.18.5",
"@vitejs/plugin-vue": "^4.4.0",
"@vitejs/plugin-vue-jsx": "^3.0.2",
"@vue/tsconfig": "^0.4.0",
"npm-run-all2": "^6.1.1",
"typescript": "~5.2.0",
"vite": "^4.4.11",
"vue-tsc": "^1.8.19"
}
}
Binary file added .codesandbox/templates/vue/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions .codesandbox/templates/vue/sandbox.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"template": "vue-cli"
}
41 changes: 41 additions & 0 deletions .codesandbox/templates/vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<canvas ref="canvas"></canvas>
</template>

<script>
import * as fabric from 'fabric';

export default {
name: 'Canvas',
mounted() {
// Do we need to use https://vuejs.org/api/reactivity-advanced.html#markraw?
const canvas = new fabric.Canvas(this.$refs.canvas, {
width: 500,
height: 500,
});

const textValue = 'fabric.js sandbox';
const text = new fabric.Textbox(textValue, {
originX: 'center',
splitByGrapheme: true,
width: 200,
top: 20,
styles: fabric.util.stylesFromArray(
[
{
style: {
fontWeight: 'bold',
fontSize: 64,
},
start: 0,
end: 9,
},
],
textValue
),
});
canvas.add(text);
canvas.centerObjectH(text);
},
};
</script>
4 changes: 4 additions & 0 deletions .codesandbox/templates/vue/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createApp } from 'vue';
import App from './App.vue';

createApp(App).mount('#app');
12 changes: 12 additions & 0 deletions .codesandbox/templates/vue/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
11 changes: 11 additions & 0 deletions .codesandbox/templates/vue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
]
}
16 changes: 16 additions & 0 deletions .codesandbox/templates/vue/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
],
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
}
}
15 changes: 15 additions & 0 deletions .codesandbox/templates/vue/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { fileURLToPath, URL } from 'node:url';

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
});
4 changes: 4 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ tasks:
- name: Vanilla
init: npm install
command: npm start vanilla -- --no-watch

- name: Vue.js
init: gp sync-await deps
command: npm start vue -- --no-watch
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ before_commit
**/dist/
/lib/
/test/
/website/
.next/
.parcel-cache/
/docs/
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [next]

- CD(): vue template [#9502](https://github.com/fabricjs/fabric.js/pull/9502)
- test(FabricObject): add a snapshot of the default values so that reordering and shuffling is verified. [#9492](https://github.com/fabricjs/fabric.js/pull/9492)
- feat(FabricObject, Canvas) BREAKING: remove calculate true/false from the api. [#9483](https://github.com/fabricjs/fabric.js/pull/9483)
- chore(): remove some Type assertions [#8950](https://github.com/fabricjs/fabric.js/pull/8950)
Expand Down
Loading