Skip to content

Commit

Permalink
Merge pull request #189 from qor5/ui
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfmin authored Jun 6, 2024
2 parents 7cf7d14 + db70241 commit c645c63
Show file tree
Hide file tree
Showing 468 changed files with 52,730 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/vuetifyjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: vuetifyxjs

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: szenius/[email protected]
with:
timezoneLinux: "Asia/Shanghai"

- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
run: npm install -g pnpm
- name: Build and Test
run: cd ./ui/vuetifyx/vuetifyxjs/ && pnpm install && pnpm run build && pnpm run test:unit
105 changes: 105 additions & 0 deletions ui/cropper/cropper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package cropper

import (
"context"

h "github.com/theplant/htmlgo"
)

type CropperBuilder struct {
tag *h.HTMLTagBuilder
}

const (
VIEW_MODE_NO_RESTRICTIONS = 0
VIEW_MODE_RESTRICT_CROP_BOX = 1
VIEW_MODE_FIT_WITHIN_CONTAINER = 2
VIEW_MODE_FILL_FIT_CONTAINER = 3
)

// {"x":1141.504660866477,"y":540.6135919744316,"width":713.7745472301137,"height":466.93834339488643,"rotate":0,"scaleX":1,"scaleY":1}
type Value struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
// Rotate float64 `json:"rotate"`
// ScaleX float64 `json:"scaleX"`
// ScaleY float64 `json:"scaleY"`
}

func Cropper() (r *CropperBuilder) {
r = &CropperBuilder{
tag: h.Tag("vue-cropper"),
}

return
}

func (b *CropperBuilder) Src(v string) (r *CropperBuilder) {
b.tag.Attr(":src", h.JSONString(v))
return b
}

func (b *CropperBuilder) AspectRatio(width float64, height float64) (r *CropperBuilder) {
b.tag.Attr(":aspect-ratio", width/height)
return b
}

func (b *CropperBuilder) ViewMode(viewMode int) (r *CropperBuilder) {
b.tag.Attr(":view-mode", viewMode)
return b
}

func (b *CropperBuilder) AutoCropArea(autoCropArea float64) (r *CropperBuilder) {
b.tag.Attr(":auto-crop-area", autoCropArea)
return b
}

func (b *CropperBuilder) Alt(v string) (r *CropperBuilder) {
b.tag.Attr(":alt", h.JSONString(v))
return b
}

func (b *CropperBuilder) ModelValue(v Value) (r *CropperBuilder) {
b.tag.Attr(":model-value", h.JSONString(v))
return b
}

func (b *CropperBuilder) SetAttr(k string, v interface{}) {
b.tag.SetAttr(k, v)
}

func (b *CropperBuilder) Attr(vs ...interface{}) (r *CropperBuilder) {
b.tag.Attr(vs...)
return b
}

func (b *CropperBuilder) Children(children ...h.HTMLComponent) (r *CropperBuilder) {
b.tag.Children(children...)
return b
}

func (b *CropperBuilder) AppendChildren(children ...h.HTMLComponent) (r *CropperBuilder) {
b.tag.AppendChildren(children...)
return b
}

func (b *CropperBuilder) PrependChildren(children ...h.HTMLComponent) (r *CropperBuilder) {
b.tag.PrependChildren(children...)
return b
}

func (b *CropperBuilder) Class(names ...string) (r *CropperBuilder) {
b.tag.Class(names...)
return b
}

func (b *CropperBuilder) ClassIf(name string, add bool) (r *CropperBuilder) {
b.tag.ClassIf(name, add)
return b
}

func (b *CropperBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
return b.tag.MarshalHTML(ctx)
}
29 changes: 29 additions & 0 deletions ui/cropper/cropperjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
33 changes: 33 additions & 0 deletions ui/cropper/cropperjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# cropperjs

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
pnpm install
```

### Compile and Hot-Reload for Development

```sh
pnpm dev
```

### Type-Check, Compile and Minify for Production

```sh
pnpm build
```
9 changes: 9 additions & 0 deletions ui/cropper/cropperjs/dist/cropperjs.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions ui/cropper/cropperjs/dist/cropperjs.umd.cjs

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions ui/cropper/cropperjs/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/demo/main.ts"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions ui/cropper/cropperjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "cropperjs",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build ",
"preview": "vite preview",
"format": "prettier --write src/"
},
"dependencies": {
"cropperjs": "^1.6.1",
"vue": "^3.4.21"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.2",
"@types/node": "^20.11.28",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/tsconfig": "^0.5.1",
"npm-run-all2": "^6.1.2",
"typescript": "~5.4.0",
"vite": "^5.1.6",
"vite-plugin-vue-devtools": "^7.0.18",
"vue-tsc": "^2.0.6",
"prettier": "^3.2.5"
}
}
Loading

0 comments on commit c645c63

Please sign in to comment.