Commit 78ce8707 authored by ransome1's avatar ransome1
Browse files

Added multi level sorting

parent 4000fa5b
# Maintainer: ransome <ransome@uber.space>
pkgname="sleek"
pkgdesc="Todo app based on the todo.txt format for Linux, free and open-source"
arch=("x86_64")
url="https://github.com/ransome1/sleek/"
license=("MIT")
options=(!strip)
makedepends=("yarn" "nodejs<16.0.0")
depends=("electron" "nodejs")
source=("${url}archive/refs/tags/v${pkgver}.zip" "sleek.desktop" "sleek")
build() {
msg2 "Unzipping v${pkgver}.zip"
unzip -o "v${pkgver}.zip"
cd "$srcdir/$pkgname-${pkgver}"
msg2 "Installing node modules"
yarn install
}
package() {
cd "$srcdir/$pkgname-${pkgver}"
msg2 "Building sleek with packaged Electron"
yarn run pack
install -Dm644 "dist/linux-unpacked/resources/app.asar" "$pkgdir/usr/lib/$pkgname.asar"
install -d -Dm644 "${pkgdir}/usr/share"
chmod 755 "${pkgdir}/usr/share"
cp -r "dist/linux-unpacked/${pkgname}" "${pkgdir}/usr/share"
msg2 "Installing LICENSE"
install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
msg2 "Installing startup script and desktop file"
install -Dm755 "../${pkgname}" -t "$pkgdir/usr/bin/"
install -Dm644 "../${pkgname}.desktop" -t "$pkgdir/usr/share/applications/"
msg2 "Installing icons"
for size in 22 24 32 48 64 128 256 512; do
install -Dm644 "assets/icons/${size}x${size}.png" "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/${pkgname}.png"
done
install -Dm644 "assets/icons/512x512.png" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/${pkgname}.png"
}
#! /bin/bash
# shellcheck disable=SC2035
cd ./flatten || exit $?
sha1sum * >sha1sum.txt || exit $?
sha256sum * >sha256sum.txt || exit $?
sha512sum * >sha512sum.txt || exit $?
#! /bin/bash
mkdir ./flatten
[ -d ./downloads ] || {
echo Folder ./downloads does not exist >/dev/stderr
exit 1
}
# shellcheck disable=SC2012
ls ./downloads | while read -r name; do
case "$name" in
*wasm*) suffix=.wasm ;;
*windows*) suffix=.exe ;;
*) suffix='' ;;
esac
src="./downloads/${name}/sleek${suffix}"
dst="./flatten/${name}${suffix}"
echo Copying "$src" to "$dst"...
cp "$src" "$dst" || exit $?
done
#! /usr/bin/env python3
from os import environ, makedirs
import re
target = environ.get('TARGET')
if not target:
print('::error ::TARGET is required but missing')
exit(1)
release_tag = environ.get('RELEASE_TAG')
if not release_tag:
print('::error ::RELEASE_TAG is required but missing')
exit(1)
checksum = None
word_splitter = re.compile(r'\s+')
for line in open('sha1sum.txt').readlines():
line = line.strip()
if line.endswith(target):
checksum, _ = word_splitter.split(line)
maintainer = '# Maintainer: Robin Ahle <ransome@uber.space>\n'
readme_url = f'https://raw.githubusercontent.com/ransome1/sleek/{release_tag}/README.md'
license_url = f'https://raw.githubusercontent.com/ransome1/sleek/{release_tag}/LICENSE.md'
opening = maintainer + '\n# This file is automatically generated. Do not edit.\n'
print('Generating PKGBUILD for sleek...')
makedirs('./pkgbuild/sleek', exist_ok=True)
with open('./pkgbuild/sleek/PKGBUILD', 'w') as pkgbuild:
content = opening + '\n'
content += 'pkgname=sleek\n'
content += f'pkgver={release_tag}\n'
source_url = f'https://github.com/ransome1/sleek/archive/{release_tag}.tar.gz'
content += f'source=(sleek-{release_tag}.tar.gz::{source_url})\n'
content += 'sha1sums=(SKIP)\n'
content += open('./github/workflows/PKGBUILD/PKGBUILD').read() + '\n'
pkgbuild.write(content)
print('Generating PKGBUILD for sleek...')
makedirs('./pkgbuild/sleek', exist_ok=True)
with open('./pkgbuild/sleek/PKGBUILD', 'w') as pkgbuild:
content = opening + '\n'
content += 'pkgname=sleek\n'
content += f'pkgver={release_tag}\n'
source_url_prefix = f'https://github.com/ransome1/sleek/releases/download/{release_tag}'
source_url = f'{source_url_prefix}/sleek-{target}'
supported_completions = ['bash', 'fish', 'zsh']
completion_source = ' '.join(
f'completion.{release_tag}.{ext}::{source_url_prefix}/completion.{ext}'
for ext in supported_completions
)
content += f'source=(sleek-{checksum}::{source_url} {completion_source} {readme_url} {license_url})\n'
content += f'_checksum={checksum}\n'
completion_checksums = ' '.join('SKIP' for _ in supported_completions)
content += f'_completion_checksums=({completion_checksums})\n'
content += open('./github/workflows/PKGBUILD/PKGBUILD').read() + '\n'
pkgbuild.write(content)
#!/bin/sh
export AUR=true
exec electron /usr/lib/sleek.asar "$@"
[Desktop Entry]
Name=sleek
Exec=/usr/bin/sleek
Terminal=false
Type=Application
Icon=sleek
Comment=Todo app based on the todo.txt format for Linux, free and open-source
Categories=ProjectManagement
name: Publish to AUR
on:
push:
# tags:
# - '*.*.*'
branches:
- "*"
jobs:
upload_checksums:
name: Upload Checksums
if: needs.create_release.outputs.is_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download all artifacts
uses: actions/download-artifact@v2.0.9
with:
path: ./downloads
- name: Flatten directory
run: ./github/workflows/PKGBUILD/expose-release-artifacts.sh
- name: Create checksums
run: ./github/workflows/PKGBUILD/create-checksums.sh
- name: Upload as artifacts
uses: actions/upload-artifact@v2
with:
name: checksums
path: sha*sum.txt
- name: Release sha1sum
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./sha1sum.txt
asset_name: sha1sum.txt
asset_content_type: text/plain
- name: Release sha256sum
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./sha256sum.txt
asset_name: sha256sum.txt
asset_content_type: text/plain
- name: Release sha512sum
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./sha512sum.txt
asset_name: sha512sum.txt
asset_content_type: text/plain
publish_aur_package:
name: Publish AUR package
needs:
- upload_checksums
if: needs.create_release.outputs.release_type == 'official'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target:
- x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
- name: Download checksums
uses: actions/download-artifact@v2.0.9
with:
name: checksums
path: ./checksums
- name: Generate PKGBUILD
env:
TARGET: ${{ matrix.target }}
RELEASE_TAG: ${{ needs.create_release.outputs.release_tag }}
run: ./github/workflows/PKGBUILD/generate-pkgbuild.py3
- name: Publish sleek to the AUR
uses: KSXGitHub/github-actions-deploy-aur@v2.2.5
with:
pkgname: sleek
pkgbuild: ./github/workflows/PKGBUILD/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.create_release.outputs.release_tag }}
force_push: 'true'
{
"name": "sleek",
"productName": "sleek",
"version": "1.0.6",
"version": "1.0.7",
"description": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"synopsis": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"category": "ProjectManagement",
......
/* eslint-env browser */
/* jslint-env browser */
/* global window */
/* global document */
/* global console */
/*
* DragonflyJS - v1.2.0 - 2018-07-17
* https://getbutterfly.com/dragonflyjs-vanilla-javascript-drag-and-drop/
* Copyright (c) 2018 Ciprian Popescu
* Licensed GPLv3
*
* iMouseDown represents the current mouse button state: up or down
* lMouseState represents the previous mouse button state so that we can check for button clicks and button releases:
*
* if (iMouseDown && !lMouseState) {} // button clicked
* if (!iMouseDown && lMouseState) {} // button released
*/
var iMouseDown = false;
var lMouseState = false;
var dragObject = null;
var DragDrops = [];
var curTarget = null;
var lastTarget = null;
var rootParent = null;
var rootSibling = null;
Number.prototype.NaN0 = function () {
"use strict";
return isNaN(this) ? 0 : this;
};
function createDragContainer(element) {
"use strict";
var j = 0,
cDrag = DragDrops.length;
DragDrops[cDrag] = [];
element.setAttribute("DropObj", cDrag);
DragDrops[cDrag].push(element);
for (j = 0; j < element.childNodes.length; j += 1) {
if (element.childNodes[j].nodeName !== "#text") {
element.childNodes[j].setAttribute("DragObj", cDrag);
}
}
}
function getPosition(e) {
"use strict";
var left = 0,
top = 0;
while (e.offsetParent) {
left += e.offsetLeft + (e.currentStyle ? (parseInt(e.currentStyle.borderLeftWidth, 10)).NaN0() : 0);
top += e.offsetTop + (e.currentStyle ? (parseInt(e.currentStyle.borderTopWidth, 10)).NaN0() : 0);
e = e.offsetParent;
}
left += e.offsetLeft + (e.currentStyle ? (parseInt(e.currentStyle.borderLeftWidth, 10)).NaN0() : 0);
top += e.offsetTop + (e.currentStyle ? (parseInt(e.currentStyle.borderTopWidth, 10)).NaN0() : 0);
return {
x: left,
y: top
};
}
function mouseCoords(ev) {
"use strict";
if (ev.pageX || ev.pageY) {
return {
x: ev.pageX,
y: ev.pageY
};
}
return {
x: ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y: ev.clientY + document.body.scrollTop - document.body.clientTop
};
}
function mouseMove(ev) {
"use strict";
ev = ev || window.event;
/*
* We are setting target to whatever item the mouse is currently on
* Firefox uses event.target here, MSIE uses event.srcElement
*/
var elementInstance,
dragHelper = document.querySelector(".drag-helper"),
activeCont = null,
target = ev.target || ev.srcElement,
mousePos = mouseCoords(ev),
origClass,
dragConts,
dragObj,
pos,
i,
j;
// mouseOut event - fires if the item the mouse is on has changed
if (lastTarget && (target !== lastTarget)) {
// Reset the classname for the target element
origClass = lastTarget.getAttribute("origClass");
if (origClass) {
lastTarget.className = origClass;
}
}
/*
* dragObj is the grouping the item is in (set from the createDragContainer function)
* if the item is not in a grouping we ignore it since it can"t be dragged with this script
*/
dragObj = target.getAttribute("DragObj");
// If the mouse was moved over an element that is draggable
if (dragObj !== null) {
// If the user is just starting to drag the element
if (iMouseDown && !lMouseState) {
// mouseDown target
curTarget = target;
// Record the mouse x and y offset for the element
rootParent = curTarget.parentNode;
rootSibling = curTarget.nextSibling;
// Remove anything that is in the dragHelper div so we can put a new item in it
for (i = 0; i < dragHelper.childNodes.length; i += 1) {
dragHelper.removeChild(dragHelper.childNodes[i]);
}
// Make a copy of the current item and put it in the drag helper
dragHelper.appendChild(curTarget.cloneNode(true));
dragHelper.style.display = "block";
// Set the class on the helper div if necessary
dragHelper.classList.add("drag-box-dragging");
// Disable dragging from the helper div (it"s already being dragged)
dragHelper.firstChild.removeAttribute("DragObj");
// Record the current position of all drag/drop targets related to the element
dragConts = DragDrops[dragObj];
// First record the width/height of the drag item, then hide it since it is going to (potentially) be moved out of its parent
curTarget.setAttribute("startWidth", parseInt(curTarget.offsetWidth, 10));
curTarget.setAttribute("startHeight", parseInt(curTarget.offsetHeight, 10));
curTarget.style.display = "none";
// Loop through each possible drop container
for (i = 0; i < dragConts.length; i += 1) {
elementInstance = dragConts[i];
pos = getPosition(dragConts[i]);
// Save the width, height and position of each container
elementInstance.setAttribute("startWidth", parseInt(elementInstance.offsetWidth, 10));
elementInstance.setAttribute("startHeight", parseInt(elementInstance.offsetHeight, 10));
elementInstance.setAttribute("startLeft", pos.x);
elementInstance.setAttribute("startTop", pos.y);
// Loop through each child element of each container
for (j = 0; j < dragConts[i].childNodes.length; j += 1) {
elementInstance = dragConts[i].childNodes[j];
if ((elementInstance.nodeName === "#text") || (dragConts[i].childNodes[j] === curTarget)) {
continue;
}
pos = getPosition(dragConts[i].childNodes[j]);
// Save the width, height and position of each element
elementInstance.setAttribute("startWidth", parseInt(elementInstance.offsetWidth, 10));
elementInstance.setAttribute("startHeight", parseInt(elementInstance.offsetHeight, 10));
elementInstance.setAttribute("startLeft", pos.x);
elementInstance.setAttribute("startTop", pos.y);
}
}
}
}
// If we get in here we are dragging something
if (curTarget) {
dragConts = DragDrops[curTarget.getAttribute("DragObj")];
var xPos = mousePos.x + (parseInt(curTarget.getAttribute("startWidth"), 10) / 2),
yPos = mousePos.y + (parseInt(curTarget.getAttribute("startHeight"), 10) / 2);
// Move helper div to wherever the mouse is
dragHelper.style.top = mousePos.y - parseInt(curTarget.getAttribute("startHeight"))/2 + "px";
dragHelper.style.left = mousePos.x - parseInt(curTarget.getAttribute("startWidth"))/2 + "px";
// Check each drop container to see if target object is "inside" the container
for (i = 0; i < dragConts.length; i += 1) {
activeCont = dragConts[i];
}
// beforeNode will hold the first node AFTER where div belongs
var beforeNode = null;
// Loop through each child node (skipping text nodes)
for (i = activeCont.childNodes.length - 1; i >= 0; i -= 1) {
elementInstance = activeCont.childNodes[i];
if (elementInstance.nodeName === "#text") {
continue;
}
// If the current item is "After" the item being dragged
if (curTarget !== activeCont.childNodes[i] && ((parseInt(elementInstance.getAttribute("startLeft"), 10) + parseInt(elementInstance.getAttribute("startWidth"), 10)) > xPos) && ((parseInt(elementInstance.getAttribute("startTop"), 10) + parseInt(elementInstance.getAttribute("startHeight"), 10)) > yPos)) {
beforeNode = activeCont.childNodes[i];
}
}
// The item being dragged belongs before another item
if (beforeNode) {
if (beforeNode !== curTarget.nextSibling) {
activeCont.insertBefore(curTarget, beforeNode);
}
// The item being dragged belongs at the end of the current container
} else {
if ((curTarget.nextSibling) || (curTarget.parentNode !== activeCont)) {
activeCont.appendChild(curTarget);
}
}
// Make drag item visible
if (curTarget.style.display !== "") {
curTarget.style.display = "";
curTarget.style.visibility = "hidden";
}
}
// Track the current mouse state so we can compare against it next time
lMouseState = iMouseDown;
// mouseMove target
lastTarget = target;
if (dragObject) {
dragObject.style.position = "absolute";
dragObject.style.top = mousePos.y;
dragObject.style.left = mousePos.x;
}
// Track the current mouse state so we can compare against it next time
lMouseState = iMouseDown;
// Prevent items on the page from being highlighted while dragging
if (curTarget || dragObject) {
return false;
}
}
function mouseUp(callback, event) {
"use strict";
if(!iMouseDown) return false;
var dragHelper = document.querySelector(".drag-helper");
if (curTarget) {
dragHelper.style.display = "none";
if (curTarget.style.display === "none") {
if (rootSibling) {
rootParent.insertBefore(curTarget, rootSibling);
} else {
rootParent.appendChild(curTarget);
}
}
curTarget.style.display = "";
curTarget.style.visibility = "visible";
}
curTarget = null;
dragObject = null;
iMouseDown = false;
// Add AJAX event here
if (typeof callback === "function") {
callback();
}
}
function mouseDown(ev) {
"use strict";
ev = ev || window.event;
var target = ev.target || ev.srcElement;
iMouseDown = true;
if (target.onmousedown || target.getAttribute("DragObj")) {
return false;
}
}
export function dragonfly(element, callback) {
"use strict";
createDragContainer(document.querySelector(element));
var dragHelper = document.createElement("div");
dragHelper.style.cssText = "position: absolute; display: none;";
dragHelper.classList.add("drag-helper");
document.body.appendChild(dragHelper);
document.getElementById("sortByContainer").addEventListener("mousemove", function () {
mouseMove();
});
document.getElementById("sortByContainer").addEventListener("mousedown", function () {
mouseDown();
});
document.addEventListener("mouseup", function (event) {
mouseUp(callback);
});
}
......@@ -7,7 +7,7 @@ const i18nextOptions = {
fallbackLng: "en",
namespace: "translation",
defaultNS: "translation",
supportedLngs: ["de", "en", "it", "es", "fr", "zh", "pt"],