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

Rewrite 2024 #1

Merged
merged 56 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
8fc46dc
use vite, upgrade deps
afternoon2 Aug 18, 2024
931e9f5
use shadcn/ui
afternoon2 Aug 18, 2024
7c8df3c
wip: list state
afternoon2 Aug 18, 2024
015f91c
wip: aside component
afternoon2 Aug 18, 2024
fa5ccd1
add global blend mode and preset selects
afternoon2 Aug 18, 2024
98abb2a
add save and delete all buttons
afternoon2 Aug 18, 2024
8eb3f09
add gradients list
afternoon2 Aug 25, 2024
ffb1d04
add delete all gradients option
afternoon2 Aug 25, 2024
f5b61cc
use single delete button
afternoon2 Aug 25, 2024
f1c1e79
change component file placement
afternoon2 Aug 25, 2024
29c9cec
add View for rendering gradients
afternoon2 Aug 26, 2024
b23db46
refactor for composition
afternoon2 Aug 26, 2024
85ccfa4
add gradient type select
afternoon2 Aug 26, 2024
3b112d2
fix default gradient settings
afternoon2 Aug 26, 2024
f39a3a8
use single util for random color
afternoon2 Aug 26, 2024
8b8f060
fix viewbox
afternoon2 Aug 26, 2024
8ce74b5
use jotai for state management
afternoon2 Aug 26, 2024
baaae4a
remove react-router-dom
afternoon2 Aug 26, 2024
138acda
wip: islands ui
afternoon2 Aug 27, 2024
112339a
wip: islands ui - add simple gradients list
afternoon2 Aug 27, 2024
3ad66e3
wip: refactor gradients list item
afternoon2 Aug 27, 2024
d3588db
add gradient list with selection
afternoon2 Aug 27, 2024
7cf46da
wip: selected gradient panel
afternoon2 Aug 28, 2024
68b2727
add colors list section
afternoon2 Aug 29, 2024
7bea851
rename color space switch
afternoon2 Aug 29, 2024
2b5d963
add chroma switch
afternoon2 Aug 29, 2024
cbba917
wip: gradient properties section
afternoon2 Aug 30, 2024
aeccb75
add focal points settings
afternoon2 Aug 30, 2024
7fcfeed
Create chroma.ts
afternoon2 Sep 1, 2024
d8dffe6
refactor state for selection panel
afternoon2 Sep 4, 2024
b82fc67
state refactor 2
afternoon2 Sep 4, 2024
6ebf7a1
use jotai devtools
afternoon2 Sep 5, 2024
0041106
rename gradient state file and remove obsolete types
afternoon2 Sep 5, 2024
7f906b6
Update render-stops.tsx
afternoon2 Sep 5, 2024
f45c92d
refactor state again (use reducer for gradient list)
afternoon2 Sep 6, 2024
a7b3b41
make chroma switch working with web worker
afternoon2 Sep 7, 2024
b3de2d4
theme update
afternoon2 Sep 7, 2024
1fb776e
remove unused stuff
afternoon2 Sep 7, 2024
bd02f7e
use checkbox instead of switch
afternoon2 Sep 7, 2024
e06630e
add spread method for both types of gradients
afternoon2 Sep 8, 2024
2ac9df8
add samples slider
afternoon2 Sep 8, 2024
3243162
use single select row component...
afternoon2 Sep 8, 2024
0df2327
add rest of chroma attribute controls
afternoon2 Sep 8, 2024
72758e2
add <ChromaListener />
afternoon2 Sep 8, 2024
c956229
visual fixes
afternoon2 Sep 8, 2024
f34a290
fix missing gradient on deleting all gradients
afternoon2 Sep 8, 2024
d788c2b
add preset save dialog
afternoon2 Sep 8, 2024
fdf33c2
refactor theme switching mechanism
afternoon2 Sep 8, 2024
0a52e4f
add svg download
afternoon2 Sep 8, 2024
8aae267
use chroma.css()
afternoon2 Sep 8, 2024
a7903dd
add repo link
afternoon2 Sep 8, 2024
f76048b
fix download + small fixes
afternoon2 Sep 8, 2024
9ade1d8
style picker depending on the theme
afternoon2 Sep 8, 2024
e9952c3
ignore dist, remove unused state
afternoon2 Sep 8, 2024
2cd2bf2
test gh actions for gh pages
afternoon2 Sep 8, 2024
bdf9a33
README update
afternoon2 Sep 8, 2024
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
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
};
26 changes: 26 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: GH Pages
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20.9.x"
- run: npm install --global yarn
- run: yarn install
- run: yarn run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/coverage

# production
/build
/dist

# misc
.DS_Store
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

Create, save and download SVG gradients

![screen](./demo/demo.gif)
![screen](./demo/screenshot_v2.png)

Create

- using native web features
- and/or using awesome Gregor Aisch's [chroma.js](https://github.com/gka/chroma.js) library
- by applying blend modes

Save as:

- a preset object in local storage
- a svg file on your computer
- or download svg file on your computer

## Installation and starting in local environment

Expand Down
18 changes: 18 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"state": "@/state"
}
}
File renamed without changes
Binary file added demo/screenshot_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SVG Gradient Editor</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
83 changes: 40 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,34 @@
"private": true,
"homepage": "https://afternoon2.github.io/svg-gradient-editor",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
"@fortawesome/react-fontawesome": "^0.1.3",
"@types/jest": "^23.3.10",
"@types/node": "^10.12.11",
"@types/react": "^16.7.10",
"@types/react-dom": "^16.0.11",
"chroma-js": "^2.0.2",
"file-saver": "^2.0.0",
"gh-pages": "^2.0.1",
"immutability-helper": "^2.9.0",
"lodash.throttle": "^4.1.1",
"nanoid": "^2.0.0",
"polished": "^2.3.0",
"react": "16.7.0-alpha.0",
"react-color": "^2.17.0",
"react-dom": "16.7.0-alpha.0",
"react-numeric-input": "^2.2.3",
"react-redux": "6.0.0",
"react-router": "^4.3.1",
"react-scripts": "2.1.1",
"react-switch": "^3.0.4",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.7",
"redux-thunk": "^2.3.0",
"styled-components": "^4.1.2",
"typescript": "^3.2.1"
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-menubar": "^1.1.1",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slider": "^1.2.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
"chroma-js": "3.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"jotai": "^2.9.3",
"jotai-devtools": "^0.10.1",
"lucide-react": "^0.428.0",
"nanoid": "^5.0.7",
"react": "^18.3.1",
"react-color": "^2.19.3",
"react-dom": "^18.3.1",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"ts-pattern": "^5.3.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"dev": "vite",
"build": "vite build",
"predeploy": "yarn build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
Expand All @@ -50,16 +44,19 @@
"not op_mini all"
],
"devDependencies": {
"@types/chroma-js": "^1.4.1",
"@types/file-saver": "^2.0.0",
"@types/history": "^4.7.2",
"@types/lodash.throttle": "^4.1.4",
"@types/nanoid": "^1.2.0",
"@types/react-color": "^2.14.0",
"@types/react-numeric-input": "^2.2.3",
"@types/react-redux": "^6.0.10",
"@types/redux": "^3.6.0",
"@types/styled-components": "^4.1.2",
"typesafe-actions": "^2.0.4"
"@types/chroma-js": "^2.4.4",
"@types/nanoid": "^3.0.0",
"@types/node": "^22.4.0",
"@types/react": "^18.3.3",
"@types/react-color": "^3.0.12",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.41",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.4",
"vite": "^5.4.1"
}
}
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Binary file removed public/favicon.ico
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
83 changes: 0 additions & 83 deletions public/index.html

This file was deleted.

15 changes: 0 additions & 15 deletions public/manifest.json

This file was deleted.

76 changes: 29 additions & 47 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,31 @@
import * as React from 'react';
import { Provider } from 'react-redux';
import { store } from './store/store';
import { library } from '@fortawesome/fontawesome-svg-core';
import {
faChevronLeft,
faList,
faPaintRoller,
faCaretDown,
faCaretUp,
faPlus,
faSearch,
faTrash,
faEdit,
faCode,
faSave,
faTimes,
} from '@fortawesome/free-solid-svg-icons';
import { StoreThemeProvider } from './components/layout/StoreThemeProvider';
import { Editor } from './views/editor/Editor';
import { GlobalStyles } from './components/layout/GlobalStyles';
import { ThemeSwitch } from './components/layout/ThemeSwitch';
import View from "@/components/app/view";
import Artboard from "@/components/app/view/artboard";
import Defs from "@/components/app/view/defs";
import Figures from "@/components/app/view/figures";
import SizeControls from "@/components/app/view/size-controls";
import { Provider } from "jotai";
import LayersPanel from "./components/app/layers-panel";
import SelectionPanel from "./components/app/selection-panel";
import { DevTools } from "jotai-devtools";
import "jotai-devtools/styles.css";
import ThemeListener from "@/components/app/theme-listener";

library.add(faChevronLeft);
library.add(faList);
library.add(faPaintRoller);
library.add(faCaretDown);
library.add(faCaretUp);
library.add(faPlus);
library.add(faSearch);
library.add(faTrash);
library.add(faEdit);
library.add(faCode);
library.add(faSave);
library.add(faTimes);
function App() {
return (
<Provider>
<DevTools />
<View>
<LayersPanel />
<SelectionPanel />
<SizeControls />
<Artboard>
<Defs />
<Figures />
</Artboard>
</View>
<ThemeListener />
</Provider>
);
}

const App = () => (
<Provider store={store}>
<StoreThemeProvider>
<React.Fragment>
<Editor />
<ThemeSwitch />
<GlobalStyles />
</React.Fragment>
</StoreThemeProvider>
</Provider>
);

export { App };
export default App;
Loading
Loading