mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
Merge pull request #206 from teaxyz/coding-style-cleanup
coding style cleanup
This commit is contained in:
commit
5894d19320
82 changed files with 782 additions and 782 deletions
|
@ -3,21 +3,21 @@ module.exports = {
|
|||
globals: {
|
||||
NodeJS: true
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
|
||||
plugins: ['svelte3', '@typescript-eslint'],
|
||||
ignorePatterns: ['*.cjs'],
|
||||
parser: "@typescript-eslint/parser",
|
||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
plugins: ["svelte3", "@typescript-eslint"],
|
||||
ignorePatterns: ["*.cjs"],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.svelte'],
|
||||
processor: 'svelte3/svelte3'
|
||||
files: ["*.svelte"],
|
||||
processor: "svelte3/svelte3"
|
||||
}
|
||||
],
|
||||
settings: {
|
||||
'svelte3/typescript': () => require('typescript')
|
||||
"svelte3/typescript": () => require("typescript")
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
sourceType: "module",
|
||||
ecmaVersion: 2020
|
||||
},
|
||||
env: {
|
||||
|
@ -26,6 +26,6 @@ module.exports = {
|
|||
node: true
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }]
|
||||
"@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"tabWidth": 2,
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
// const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
appId: 'xyz.tea.gui',
|
||||
productName: 'tea',
|
||||
appId: "xyz.tea.gui",
|
||||
productName: "tea",
|
||||
asar: false,
|
||||
directories: { output: 'dist' },
|
||||
files: ['electron/dist/electron.cjs', { from: 'build', to: '' }]
|
||||
directories: { output: "dist" },
|
||||
files: ["electron/dist/electron.cjs", { from: "build", to: "" }]
|
||||
// TODO: if xcrun altool exists eventually in our self-hosted macos
|
||||
// SOLUTION: is notarize separately in next pipeline step
|
||||
// afterSign: async (params) => {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import windowStateManager from 'electron-window-state';
|
||||
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
import contextMenu from 'electron-context-menu';
|
||||
import serve from 'electron-serve';
|
||||
import windowStateManager from "electron-window-state";
|
||||
import { app, BrowserWindow, ipcMain } from "electron";
|
||||
import contextMenu from "electron-context-menu";
|
||||
import serve from "electron-serve";
|
||||
|
||||
import { getInstalledPackages } from './libs/teaDir';
|
||||
import { readSessionData, writeSessionData } from './libs/auth';
|
||||
import type { Session } from '../src/libs/types';
|
||||
import { installPackage, openTerminal } from './libs/cli';
|
||||
import { getInstalledPackages } from "./libs/teaDir";
|
||||
import { readSessionData, writeSessionData } from "./libs/auth";
|
||||
import type { Session } from "../src/libs/types";
|
||||
import { installPackage, openTerminal } from "./libs/cli";
|
||||
|
||||
// try {
|
||||
// //@ts-ignore only used in dev should not be packaged inprod
|
||||
|
@ -17,7 +17,7 @@ import { installPackage, openTerminal } from './libs/cli';
|
|||
// console.error(e);
|
||||
// }
|
||||
|
||||
const serveURL = serve({ directory: '.' });
|
||||
const serveURL = serve({ directory: "." });
|
||||
const port = process.env.PORT || 3000;
|
||||
const dev = !app.isPackaged;
|
||||
let mainWindow: BrowserWindow | null;
|
||||
|
@ -29,7 +29,7 @@ function createWindow() {
|
|||
});
|
||||
|
||||
const mainWindow = new BrowserWindow({
|
||||
backgroundColor: 'whitesmoke',
|
||||
backgroundColor: "whitesmoke",
|
||||
autoHideMenuBar: true,
|
||||
trafficLightPosition: {
|
||||
x: 17,
|
||||
|
@ -54,12 +54,12 @@ function createWindow() {
|
|||
|
||||
windowState.manage(mainWindow);
|
||||
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
});
|
||||
|
||||
mainWindow.on('close', () => {
|
||||
mainWindow.on("close", () => {
|
||||
windowState.saveState(mainWindow);
|
||||
});
|
||||
|
||||
|
@ -72,14 +72,14 @@ contextMenu({
|
|||
showCopyImage: false,
|
||||
prepend: (defaultActions, params, browserWindow) => [
|
||||
{
|
||||
label: 'Make App 💻'
|
||||
label: "Make App 💻"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
function loadVite(port) {
|
||||
mainWindow?.loadURL(`http://localhost:${port}`).catch((e) => {
|
||||
console.log('Error loading URL, retrying', e);
|
||||
console.log("Error loading URL, retrying", e);
|
||||
setTimeout(() => {
|
||||
loadVite(port);
|
||||
}, 200);
|
||||
|
@ -88,7 +88,7 @@ function loadVite(port) {
|
|||
|
||||
function createMainWindow() {
|
||||
mainWindow = createWindow();
|
||||
mainWindow.once('close', () => {
|
||||
mainWindow.once("close", () => {
|
||||
mainWindow = null;
|
||||
});
|
||||
|
||||
|
@ -96,46 +96,46 @@ function createMainWindow() {
|
|||
else serveURL(mainWindow);
|
||||
}
|
||||
|
||||
app.once('ready', createMainWindow);
|
||||
app.on('activate', () => {
|
||||
app.once("ready", createMainWindow);
|
||||
app.on("activate", () => {
|
||||
if (!mainWindow) {
|
||||
createMainWindow();
|
||||
}
|
||||
});
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit();
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin") app.quit();
|
||||
});
|
||||
|
||||
ipcMain.on('to-main', (event, count) => {
|
||||
return mainWindow?.webContents.send('from-main', `next count is ${count + 1}`);
|
||||
ipcMain.on("to-main", (event, count) => {
|
||||
return mainWindow?.webContents.send("from-main", `next count is ${count + 1}`);
|
||||
});
|
||||
|
||||
ipcMain.handle('get-installed-packages', async () => {
|
||||
ipcMain.handle("get-installed-packages", async () => {
|
||||
const pkgs = await getInstalledPackages();
|
||||
return pkgs;
|
||||
});
|
||||
|
||||
ipcMain.handle('get-session', async () => {
|
||||
ipcMain.handle("get-session", async () => {
|
||||
const session = await readSessionData();
|
||||
return session;
|
||||
});
|
||||
|
||||
ipcMain.handle('update-session', async (_, data) => {
|
||||
ipcMain.handle("update-session", async (_, data) => {
|
||||
await writeSessionData(data as Session);
|
||||
});
|
||||
|
||||
ipcMain.handle('install-package', async (_, data) => {
|
||||
ipcMain.handle("install-package", async (_, data) => {
|
||||
const result = await installPackage(data.full_name);
|
||||
return result;
|
||||
});
|
||||
|
||||
ipcMain.handle('open-terminal', async (_, data) => {
|
||||
ipcMain.handle("open-terminal", async (_, data) => {
|
||||
const { cmd } = data as { cmd: string };
|
||||
try {
|
||||
// TODO: detect if mac or linux
|
||||
// current openTerminal is only design for Mac
|
||||
await openTerminal(cmd);
|
||||
} catch (error) {
|
||||
console.error('elast:', error);
|
||||
console.error("elast:", error);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { mkdirp } from 'mkdirp';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { getTeaPath } from './teaDir';
|
||||
import * as v1Client from './v1Client';
|
||||
import { mkdirp } from "mkdirp";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import { getTeaPath } from "./teaDir";
|
||||
import * as v1Client from "./v1Client";
|
||||
|
||||
const sessionFilePath = path.join(getTeaPath(), 'tea.xyz/gui/tmp.dat');
|
||||
const sessionFolder = path.join(getTeaPath(), 'tea.xyz/gui');
|
||||
const sessionFilePath = path.join(getTeaPath(), "tea.xyz/gui/tmp.dat");
|
||||
const sessionFolder = path.join(getTeaPath(), "tea.xyz/gui");
|
||||
|
||||
interface Session {
|
||||
device_id?: string;
|
||||
|
@ -17,7 +17,7 @@ export async function initSessionData() {
|
|||
fs.readFileSync(sessionFilePath);
|
||||
|
||||
await mkdirp(sessionFolder);
|
||||
const req = await v1Client.get<{ deviceId: string }>('/auth/registerDevice');
|
||||
const req = await v1Client.get<{ deviceId: string }>("/auth/registerDevice");
|
||||
}
|
||||
|
||||
export async function readSessionData(): Promise<Session> {
|
||||
|
@ -27,7 +27,7 @@ export async function readSessionData(): Promise<Session> {
|
|||
return session;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
const req = await v1Client.get<{ deviceId: string }>('/auth/registerDevice');
|
||||
const req = await v1Client.get<{ deviceId: string }>("/auth/registerDevice");
|
||||
const data = { device_id: req.deviceId };
|
||||
await writeSessionData(data);
|
||||
return data;
|
||||
|
@ -38,7 +38,7 @@ export async function writeSessionData(data: Session) {
|
|||
try {
|
||||
await mkdirp(sessionFolder);
|
||||
await fs.writeFileSync(sessionFilePath, JSON.stringify(data), {
|
||||
encoding: 'utf-8'
|
||||
encoding: "utf-8"
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
import { spawn } from 'child_process';
|
||||
import { clean } from 'semver';
|
||||
import { getGuiPath } from './teaDir';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { spawn } from "child_process";
|
||||
import { clean } from "semver";
|
||||
import { getGuiPath } from "./teaDir";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export async function installPackage(full_name: string) {
|
||||
return await new Promise((resolve, reject) => {
|
||||
let version = '';
|
||||
let lastError = '';
|
||||
const teaInstallation = spawn('tea', [`+${full_name}`, 'true']);
|
||||
let version = "";
|
||||
let lastError = "";
|
||||
const teaInstallation = spawn("tea", [`+${full_name}`, "true"]);
|
||||
|
||||
teaInstallation.stdout.on('data', (data) => {
|
||||
console.log('stdout:', data);
|
||||
teaInstallation.stdout.on("data", (data) => {
|
||||
console.log("stdout:", data);
|
||||
});
|
||||
|
||||
teaInstallation.stderr.on('data', (err) => {
|
||||
teaInstallation.stderr.on("data", (err) => {
|
||||
lastError = err.toString();
|
||||
if (lastError && lastError.includes('installed') && lastError.includes(full_name)) {
|
||||
version = lastError.split('/').pop() || '';
|
||||
if (lastError && lastError.includes("installed") && lastError.includes(full_name)) {
|
||||
version = lastError.split("/").pop() || "";
|
||||
}
|
||||
});
|
||||
|
||||
teaInstallation.on('exit', (code) => {
|
||||
teaInstallation.on("exit", (code) => {
|
||||
if (code === 0) {
|
||||
resolve({ version: clean(version) });
|
||||
} else {
|
||||
|
@ -32,7 +32,7 @@ export async function installPackage(full_name: string) {
|
|||
}
|
||||
|
||||
export async function openTerminal(cmd: string) {
|
||||
let scriptPath = '';
|
||||
let scriptPath = "";
|
||||
try {
|
||||
// TODO SECURITY: escape the cmd if possible or create whitelist of acceptable commands
|
||||
scriptPath = await createCommandScriptFile(cmd);
|
||||
|
@ -40,25 +40,25 @@ export async function openTerminal(cmd: string) {
|
|||
let stderr = ``;
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const child = spawn('/usr/bin/osascript', [scriptPath]);
|
||||
child.stdout.on('data', (data) => {
|
||||
const child = spawn("/usr/bin/osascript", [scriptPath]);
|
||||
child.stdout.on("data", (data) => {
|
||||
stdout += data.toString().trim();
|
||||
});
|
||||
child.stderr.on('data', (data) => {
|
||||
child.stderr.on("data", (data) => {
|
||||
stderr += data.toString().trim();
|
||||
});
|
||||
|
||||
child.on('exit', () => {
|
||||
console.log('exit:', stdout);
|
||||
child.on("exit", () => {
|
||||
console.log("exit:", stdout);
|
||||
resolve(stdout);
|
||||
});
|
||||
|
||||
child.on('error', () => {
|
||||
child.on("error", () => {
|
||||
reject(new Error(stderr));
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('root:', error);
|
||||
console.error("root:", error);
|
||||
} finally {
|
||||
if (scriptPath) await fs.unlinkSync(scriptPath);
|
||||
}
|
||||
|
@ -85,6 +85,6 @@ const createCommandScriptFile = async (cmd: string): Promise<string> => {
|
|||
end tell
|
||||
`.trim();
|
||||
|
||||
await fs.writeFileSync(tmpFilePath, script, 'utf-8');
|
||||
await fs.writeFileSync(tmpFilePath, script, "utf-8");
|
||||
return tmpFilePath;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// import { readDir, BaseDirectory } from '@tauri-apps/api/fs';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { app } from 'electron';
|
||||
import semver from 'semver';
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { app } from "electron";
|
||||
import semver from "semver";
|
||||
|
||||
type Dir = {
|
||||
name: string;
|
||||
|
@ -11,13 +11,13 @@ type Dir = {
|
|||
};
|
||||
|
||||
export const getTeaPath = () => {
|
||||
const homePath = app.getPath('home');
|
||||
const teaPath = path.join(homePath, './.tea');
|
||||
const homePath = app.getPath("home");
|
||||
const teaPath = path.join(homePath, "./.tea");
|
||||
return teaPath;
|
||||
};
|
||||
|
||||
export const getGuiPath = () => {
|
||||
return path.join(getTeaPath(), 'tea.xyz/gui');
|
||||
return path.join(getTeaPath(), "tea.xyz/gui");
|
||||
};
|
||||
|
||||
export async function getInstalledPackages() {
|
||||
|
@ -30,14 +30,14 @@ export async function getInstalledPackages() {
|
|||
});
|
||||
|
||||
const pkgs = folders
|
||||
.map((p: string) => p.split('.tea/')[1])
|
||||
.filter((p: string) => !p.includes('tea.xyz'))
|
||||
.map((p: string) => p.split(".tea/")[1])
|
||||
.filter((p: string) => !p.includes("tea.xyz"))
|
||||
.map((p: string) => {
|
||||
const path = p.trim().split('/');
|
||||
const path = p.trim().split("/");
|
||||
const version = path.pop();
|
||||
return {
|
||||
version: semver.clean(version || ''),
|
||||
full_name: path.join('/')
|
||||
version: semver.clean(version || ""),
|
||||
full_name: path.join("/")
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -50,10 +50,10 @@ const semverTest =
|
|||
export const getPkgBottles = (packageDir: Dir): string[] => {
|
||||
const bottles: string[] = [];
|
||||
|
||||
const pkg = packageDir.path.split('.tea/')[1];
|
||||
const version = pkg.split('/v')[1];
|
||||
const pkg = packageDir.path.split(".tea/")[1];
|
||||
const version = pkg.split("/v")[1];
|
||||
|
||||
const isVersion = semverTest.test(version) || !isNaN(+version) || version === '*';
|
||||
const isVersion = semverTest.test(version) || !isNaN(+version) || version === "*";
|
||||
|
||||
if (version && isVersion) {
|
||||
bottles.push(pkg);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import axios from 'axios';
|
||||
import path from 'path';
|
||||
import axios from "axios";
|
||||
import path from "path";
|
||||
|
||||
const base = 'https://api.tea.xyz';
|
||||
const base = "https://api.tea.xyz";
|
||||
export async function get<T>(urlPath: string) {
|
||||
const url = new URL(path.join('v1', urlPath), base).toString();
|
||||
const url = new URL(path.join("v1", urlPath), base).toString();
|
||||
// TODO: add headers
|
||||
const req = await axios.request<T>({
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
url,
|
||||
headers: {}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
const { contextBridge, ipcRenderer } = require("electron");
|
||||
|
||||
contextBridge.exposeInMainWorld('electron', {
|
||||
contextBridge.exposeInMainWorld("electron", {
|
||||
send: (channel, data) => {
|
||||
ipcRenderer.send(channel, data);
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { join } from 'path';
|
||||
import { join } from "path";
|
||||
|
||||
const PACKAGE_ROOT = __dirname;
|
||||
const PROJECT_ROOT = join(PACKAGE_ROOT, '../..');
|
||||
const PROJECT_ROOT = join(PACKAGE_ROOT, "../..");
|
||||
|
||||
/**
|
||||
* @type {import('vite').UserConfig}
|
||||
|
@ -12,22 +12,22 @@ const config = {
|
|||
envDir: PROJECT_ROOT,
|
||||
resolve: {
|
||||
alias: {
|
||||
'/@/': join(PACKAGE_ROOT, 'src') + '/'
|
||||
"/@/": join(PACKAGE_ROOT, "src") + "/"
|
||||
}
|
||||
},
|
||||
build: {
|
||||
ssr: true,
|
||||
sourcemap: 'inline',
|
||||
outDir: 'dist',
|
||||
assetsDir: '.',
|
||||
minify: process.env.MODE !== 'development',
|
||||
sourcemap: "inline",
|
||||
outDir: "dist",
|
||||
assetsDir: ".",
|
||||
minify: process.env.MODE !== "development",
|
||||
lib: {
|
||||
entry: 'electron.ts',
|
||||
formats: ['cjs']
|
||||
entry: "electron.ts",
|
||||
formats: ["cjs"]
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: '[name].cjs'
|
||||
entryFileNames: "[name].cjs"
|
||||
}
|
||||
},
|
||||
emptyOutDir: true,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type { PlaywrightTestConfig } from '@playwright/test';
|
||||
import type { PlaywrightTestConfig } from "@playwright/test";
|
||||
|
||||
const config: PlaywrightTestConfig = {
|
||||
webServer: {
|
||||
command: 'npm run build && npm run preview',
|
||||
command: "npm run build && npm run preview",
|
||||
port: 4173
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const { theme, plugins } = require('@tea/ui/tailwind.config.cjs');
|
||||
const { theme, plugins } = require("@tea/ui/tailwind.config.cjs");
|
||||
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {
|
||||
content: ['./src/**/*.{html,svelte,ts,js}', '../ui/src/**/*.{html,svelte,ts,js}'],
|
||||
content: ["./src/**/*.{html,svelte,ts,js}", "../ui/src/**/*.{html,svelte,ts,js}"],
|
||||
theme,
|
||||
plugins: [...plugins]
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import matchers from '@testing-library/jest-dom/matchers';
|
||||
import { expect } from 'vitest';
|
||||
import matchers from "@testing-library/jest-dom/matchers";
|
||||
import { expect } from "vitest";
|
||||
|
||||
expect.extend(matchers);
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
@tailwind utilities;
|
||||
|
||||
@font-face {
|
||||
font-family: 'pp-neue-machina';
|
||||
src: url('/fonts/PPNeueMachina-InktrapLight.woff');
|
||||
font-family: "pp-neue-machina";
|
||||
src: url("/fonts/PPNeueMachina-InktrapLight.woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'sono';
|
||||
src: url('/fonts/Sono-Light.woff2');
|
||||
font-family: "sono";
|
||||
src: url("/fonts/Sono-Light.woff2");
|
||||
}
|
||||
|
||||
html {
|
||||
|
@ -35,9 +35,9 @@ h5,
|
|||
h6,
|
||||
button,
|
||||
.click-copy {
|
||||
font-family: 'pp-neue-machina' !important;
|
||||
font-family: "pp-neue-machina" !important;
|
||||
}
|
||||
|
||||
.pk-version {
|
||||
font-family: 'sono';
|
||||
font-family: "sono";
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
import { getPkgBottles } from '../teaDir';
|
||||
import { getPkgBottles } from "../teaDir";
|
||||
|
||||
describe('teaDir module', () => {
|
||||
it('should getPkgBottles from nested Dir object/s', () => {
|
||||
describe("teaDir module", () => {
|
||||
it("should getPkgBottles from nested Dir object/s", () => {
|
||||
const results = getPkgBottles({
|
||||
name: 'kkos',
|
||||
path: '/Users/x/.tea/github.com/kkos',
|
||||
name: "kkos",
|
||||
path: "/Users/x/.tea/github.com/kkos",
|
||||
children: [
|
||||
{ name: '.DS_Store', path: '/Users/x/.tea/github.com/kkos/.DS_Store' },
|
||||
{ name: ".DS_Store", path: "/Users/x/.tea/github.com/kkos/.DS_Store" },
|
||||
{
|
||||
name: 'oniguruma',
|
||||
path: '/Users/x/.tea/github.com/kkos/oniguruma',
|
||||
name: "oniguruma",
|
||||
path: "/Users/x/.tea/github.com/kkos/oniguruma",
|
||||
children: [
|
||||
{ name: '.DS_Store', path: '/Users/x/.tea/github.com/kkos/oniguruma/.DS_Store' },
|
||||
{ name: ".DS_Store", path: "/Users/x/.tea/github.com/kkos/oniguruma/.DS_Store" },
|
||||
{
|
||||
path: '/Users/x/.tea/github.com/kkos/oniguruma/v6',
|
||||
name: 'v6',
|
||||
path: "/Users/x/.tea/github.com/kkos/oniguruma/v6",
|
||||
name: "v6",
|
||||
children: [
|
||||
{ name: '.DS_Store', path: '/Users/x/.tea/github.com/kkos/oniguruma/v6/.DS_Store' }
|
||||
{ name: ".DS_Store", path: "/Users/x/.tea/github.com/kkos/oniguruma/v6/.DS_Store" }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'v*',
|
||||
path: '/Users/x/.tea/github.com/kkos/oniguruma/v*',
|
||||
name: "v*",
|
||||
path: "/Users/x/.tea/github.com/kkos/oniguruma/v*",
|
||||
children: []
|
||||
},
|
||||
{
|
||||
name: 'v6.9.8',
|
||||
path: '/Users/x/.tea/github.com/kkos/oniguruma/v6.9.8',
|
||||
name: "v6.9.8",
|
||||
path: "/Users/x/.tea/github.com/kkos/oniguruma/v6.9.8",
|
||||
children: []
|
||||
},
|
||||
{
|
||||
name: 'v6.9',
|
||||
path: '/Users/x/.tea/github.com/kkos/oniguruma/v6.9',
|
||||
name: "v6.9",
|
||||
path: "/Users/x/.tea/github.com/kkos/oniguruma/v6.9",
|
||||
children: []
|
||||
}
|
||||
]
|
||||
|
@ -40,10 +40,10 @@ describe('teaDir module', () => {
|
|||
});
|
||||
|
||||
expect(results).toEqual([
|
||||
'github.com/kkos/oniguruma/v*',
|
||||
'github.com/kkos/oniguruma/v6',
|
||||
'github.com/kkos/oniguruma/v6.9',
|
||||
'github.com/kkos/oniguruma/v6.9.8'
|
||||
"github.com/kkos/oniguruma/v*",
|
||||
"github.com/kkos/oniguruma/v6",
|
||||
"github.com/kkos/oniguruma/v6.9",
|
||||
"github.com/kkos/oniguruma/v6.9.8"
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,21 +10,21 @@
|
|||
* - connect to remote api(api.tea.xyz) and returns a data
|
||||
* - connect to a local platform api and returns a data
|
||||
*/
|
||||
import axios from 'axios';
|
||||
import axios from "axios";
|
||||
|
||||
import type { Package, Review, AirtablePost, Bottle } from '@tea/ui/types';
|
||||
import type { GUIPackage, Course, Category, DeviceAuth } from '../types';
|
||||
import type { Package, Review, AirtablePost, Bottle } from "@tea/ui/types";
|
||||
import type { GUIPackage, Course, Category, DeviceAuth } from "../types";
|
||||
|
||||
import * as mock from './mock';
|
||||
import { PackageStates } from '../types';
|
||||
import { getInstalledPackages } from '$libs/teaDir';
|
||||
import { installPackageCommand } from '$libs/cli';
|
||||
import * as mock from "./mock";
|
||||
import { PackageStates } from "../types";
|
||||
import { getInstalledPackages } from "$libs/teaDir";
|
||||
import { installPackageCommand } from "$libs/cli";
|
||||
|
||||
import { get as apiGet } from '$libs/v1Client';
|
||||
import { get as apiGet } from "$libs/v1Client";
|
||||
|
||||
export async function getPackages(): Promise<GUIPackage[]> {
|
||||
const [packages, installedPackages] = await Promise.all([
|
||||
apiGet<Package[]>('packages', { nocache: 'true' }),
|
||||
apiGet<Package[]>("packages", { nocache: "true" }),
|
||||
getInstalledPackages()
|
||||
]);
|
||||
|
||||
|
@ -33,7 +33,7 @@ export async function getPackages(): Promise<GUIPackage[]> {
|
|||
return {
|
||||
...pkg,
|
||||
state: found ? PackageStates.INSTALLED : PackageStates.AVAILABLE,
|
||||
installed_version: found ? found.version : ''
|
||||
installed_version: found ? found.version : ""
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ export async function getFeaturedPackages(): Promise<Package[]> {
|
|||
export async function getPackageReviews(full_name: string): Promise<Review[]> {
|
||||
console.log(`getting reviews for ${full_name}`);
|
||||
const reviews: Review[] = await apiGet<Review[]>(
|
||||
`packages/${full_name.replaceAll('/', ':')}/reviews`
|
||||
`packages/${full_name.replaceAll("/", ":")}/reviews`
|
||||
);
|
||||
|
||||
return reviews;
|
||||
|
@ -61,7 +61,7 @@ export async function installPackage(full_name: string) {
|
|||
}
|
||||
|
||||
export async function getFeaturedCourses(): Promise<Course[]> {
|
||||
const posts = await apiGet<AirtablePost[]>('posts', { tag: 'featured_course' });
|
||||
const posts = await apiGet<AirtablePost[]>("posts", { tag: "featured_course" });
|
||||
return posts.map((post) => {
|
||||
return {
|
||||
title: post.title,
|
||||
|
@ -81,14 +81,14 @@ export async function getAllPosts(tag?: string): Promise<AirtablePost[]> {
|
|||
// add filter here someday: tag = news | course
|
||||
const queryParams = {
|
||||
...(tag ? { tag } : {}),
|
||||
nocache: 'true'
|
||||
nocache: "true"
|
||||
};
|
||||
const posts = await apiGet<AirtablePost[]>('posts', queryParams);
|
||||
const posts = await apiGet<AirtablePost[]>("posts", queryParams);
|
||||
return posts;
|
||||
}
|
||||
|
||||
export async function getCategorizedPackages(): Promise<Category[]> {
|
||||
const categories = await apiGet<Category[]>('/packages/categorized');
|
||||
const categories = await apiGet<Category[]>("/packages/categorized");
|
||||
return categories;
|
||||
}
|
||||
|
||||
|
@ -98,19 +98,19 @@ export async function getDeviceAuth(deviceId: string): Promise<DeviceAuth> {
|
|||
}
|
||||
|
||||
export async function getPackageBottles(packageName: string): Promise<Bottle[]> {
|
||||
console.log('getting bottles for ', packageName);
|
||||
const pkg: Package = await apiGet<Package>(`packages/${packageName.replaceAll('/', ':')}`);
|
||||
console.log("getting bottles for ", packageName);
|
||||
const pkg: Package = await apiGet<Package>(`packages/${packageName.replaceAll("/", ":")}`);
|
||||
return pkg.bottles || [];
|
||||
}
|
||||
|
||||
export async function getPackage(packageName: string): Promise<Partial<Package>> {
|
||||
const pkg: Partial<Package> = await apiGet<Partial<Package>>(
|
||||
`packages/${packageName.replaceAll('/', ':')}`
|
||||
`packages/${packageName.replaceAll("/", ":")}`
|
||||
);
|
||||
return pkg;
|
||||
}
|
||||
|
||||
export async function registerDevice(): Promise<string> {
|
||||
const { deviceId } = await apiGet<{ deviceId: string }>('/auth/registerDevice');
|
||||
const { deviceId } = await apiGet<{ deviceId: string }>("/auth/registerDevice");
|
||||
return deviceId;
|
||||
}
|
||||
|
|
|
@ -5,154 +5,154 @@
|
|||
* TODO:
|
||||
* * make cors work with api.tea.xyz/v1
|
||||
*/
|
||||
import type { Package, Review, AirtablePost, Bottle } from '@tea/ui/types';
|
||||
import type { GUIPackage, Course, Category } from '../types';
|
||||
import { PackageStates } from '../types';
|
||||
import { loremIpsum } from 'lorem-ipsum';
|
||||
import _ from 'lodash';
|
||||
import type { Package, Review, AirtablePost, Bottle } from "@tea/ui/types";
|
||||
import type { GUIPackage, Course, Category } from "../types";
|
||||
import { PackageStates } from "../types";
|
||||
import { loremIpsum } from "lorem-ipsum";
|
||||
import _ from "lodash";
|
||||
// import { getInstalledPackages } from '$libs/teaDir';
|
||||
// import { getSession } from '$libs/stores/auth';
|
||||
import * as v1Client from '$libs/v1Client';
|
||||
import * as v1Client from "$libs/v1Client";
|
||||
|
||||
const packages: Package[] = [
|
||||
{
|
||||
slug: 'mesonbuild_com',
|
||||
homepage: 'https://mesonbuild.com',
|
||||
name: 'mesonbuild.com',
|
||||
version: '0.63.3',
|
||||
last_modified: '2022-10-06T15:45:08.000Z',
|
||||
full_name: 'mesonbuild.com',
|
||||
slug: "mesonbuild_com",
|
||||
homepage: "https://mesonbuild.com",
|
||||
name: "mesonbuild.com",
|
||||
version: "0.63.3",
|
||||
last_modified: "2022-10-06T15:45:08.000Z",
|
||||
full_name: "mesonbuild.com",
|
||||
dl_count: 270745,
|
||||
thumb_image_name: 'mesonbuild_com_option 1.jpg ',
|
||||
maintainer: '',
|
||||
desc: 'Fast and user friendly build system',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/mesonbuild_com.jpg',
|
||||
thumb_image_name: "mesonbuild_com_option 1.jpg ",
|
||||
maintainer: "",
|
||||
desc: "Fast and user friendly build system",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/mesonbuild_com.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'pixman_org',
|
||||
homepage: 'http://www.pixman.org/',
|
||||
maintainer: 'freedesktop',
|
||||
name: 'pixman.org',
|
||||
version: '0.40.0',
|
||||
last_modified: '2022-09-26T19:37:47.000Z',
|
||||
full_name: 'pixman.org',
|
||||
slug: "pixman_org",
|
||||
homepage: "http://www.pixman.org/",
|
||||
maintainer: "freedesktop",
|
||||
name: "pixman.org",
|
||||
version: "0.40.0",
|
||||
last_modified: "2022-09-26T19:37:47.000Z",
|
||||
full_name: "pixman.org",
|
||||
dl_count: 0,
|
||||
thumb_image_name: 'pixman_org_option 1.jpg ',
|
||||
desc: 'Pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/pixman_org.jpg',
|
||||
thumb_image_name: "pixman_org_option 1.jpg ",
|
||||
desc: "Pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/pixman_org.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'freedesktop_org_pkg_config',
|
||||
homepage: 'https://freedesktop.org',
|
||||
maintainer: 'freedesktop.org',
|
||||
name: 'pkg-config',
|
||||
version: '0.29.2',
|
||||
last_modified: '2022-10-20T01:32:15.000Z',
|
||||
full_name: 'freedesktop.org/pkg-config',
|
||||
slug: "freedesktop_org_pkg_config",
|
||||
homepage: "https://freedesktop.org",
|
||||
maintainer: "freedesktop.org",
|
||||
name: "pkg-config",
|
||||
version: "0.29.2",
|
||||
last_modified: "2022-10-20T01:32:15.000Z",
|
||||
full_name: "freedesktop.org/pkg-config",
|
||||
dl_count: 2661501,
|
||||
thumb_image_name: 'freedecktop_org_pkg_config option 1.jpg ',
|
||||
desc: 'Manage compile and link flags for libraries',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/freedesktop_org_pkg_config.jpg',
|
||||
thumb_image_name: "freedecktop_org_pkg_config option 1.jpg ",
|
||||
desc: "Manage compile and link flags for libraries",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/freedesktop_org_pkg_config.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'gnu_org_gettext',
|
||||
homepage: 'https://gnu.org',
|
||||
maintainer: 'gnu.org',
|
||||
name: 'gettext',
|
||||
version: '0.21.1',
|
||||
last_modified: '2022-10-20T01:23:46.000Z',
|
||||
full_name: 'gnu.org/gettext',
|
||||
slug: "gnu_org_gettext",
|
||||
homepage: "https://gnu.org",
|
||||
maintainer: "gnu.org",
|
||||
name: "gettext",
|
||||
version: "0.21.1",
|
||||
last_modified: "2022-10-20T01:23:46.000Z",
|
||||
full_name: "gnu.org/gettext",
|
||||
dl_count: 3715970,
|
||||
thumb_image_name: 'gnu_org_gettext_option 1.jpg ',
|
||||
desc: 'GNU internationalization (i18n) and localization (l10n) library',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/gnu_org_gettext.jpg',
|
||||
thumb_image_name: "gnu_org_gettext_option 1.jpg ",
|
||||
desc: "GNU internationalization (i18n) and localization (l10n) library",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/gnu_org_gettext.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'ipfs_tech',
|
||||
homepage: 'https://ipfs.tech',
|
||||
name: 'ipfs.tech',
|
||||
version: '0.16.0',
|
||||
last_modified: '2022-10-19T21:36:52.000Z',
|
||||
full_name: 'ipfs.tech',
|
||||
slug: "ipfs_tech",
|
||||
homepage: "https://ipfs.tech",
|
||||
name: "ipfs.tech",
|
||||
version: "0.16.0",
|
||||
last_modified: "2022-10-19T21:36:52.000Z",
|
||||
full_name: "ipfs.tech",
|
||||
dl_count: 14457,
|
||||
thumb_image_name: 'ipfs_tech_option 2.jpg ',
|
||||
maintainer: '',
|
||||
desc: 'Peer-to-peer hypermedia protocol',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/ipfs_tech.jpg',
|
||||
thumb_image_name: "ipfs_tech_option 2.jpg ",
|
||||
maintainer: "",
|
||||
desc: "Peer-to-peer hypermedia protocol",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/ipfs_tech.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'nixos_org_patchelf',
|
||||
homepage: 'https://nixos.org',
|
||||
maintainer: 'nixos.org',
|
||||
name: 'patchelf',
|
||||
version: '0.15.0',
|
||||
last_modified: '2022-09-27T04:50:44.000Z',
|
||||
full_name: 'nixos.org/patchelf',
|
||||
slug: "nixos_org_patchelf",
|
||||
homepage: "https://nixos.org",
|
||||
maintainer: "nixos.org",
|
||||
name: "patchelf",
|
||||
version: "0.15.0",
|
||||
last_modified: "2022-09-27T04:50:44.000Z",
|
||||
full_name: "nixos.org/patchelf",
|
||||
dl_count: 0,
|
||||
thumb_image_name: 'nixos_org_patchelf_option 1.jpg ',
|
||||
desc: 'PatchELF is a simple utility for modifying existing ELF executables and libraries.',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/nixos_org_patchelf.jpg',
|
||||
thumb_image_name: "nixos_org_patchelf_option 1.jpg ",
|
||||
desc: "PatchELF is a simple utility for modifying existing ELF executables and libraries.",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/nixos_org_patchelf.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'tea_xyz',
|
||||
homepage: 'https://tea.xyz',
|
||||
maintainer: 'tea.xyz',
|
||||
name: 'tea.xyz',
|
||||
version: '0.8.6',
|
||||
last_modified: '2022-10-19T19:13:51.000Z',
|
||||
full_name: 'tea.xyz',
|
||||
slug: "tea_xyz",
|
||||
homepage: "https://tea.xyz",
|
||||
maintainer: "tea.xyz",
|
||||
name: "tea.xyz",
|
||||
version: "0.8.6",
|
||||
last_modified: "2022-10-19T19:13:51.000Z",
|
||||
full_name: "tea.xyz",
|
||||
dl_count: 0,
|
||||
thumb_image_name: 'tea_xyz_option 2.jpg ',
|
||||
desc: 'Website of tea.xyz',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/tea_xyz.jpg',
|
||||
thumb_image_name: "tea_xyz_option 2.jpg ",
|
||||
desc: "Website of tea.xyz",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/tea_xyz.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'charm_sh_gum',
|
||||
homepage: 'https://charm.sh',
|
||||
maintainer: 'charm.sh',
|
||||
name: 'gum',
|
||||
version: '0.8.0',
|
||||
last_modified: '2022-10-21T02:15:16.000Z',
|
||||
full_name: 'charm.sh/gum',
|
||||
slug: "charm_sh_gum",
|
||||
homepage: "https://charm.sh",
|
||||
maintainer: "charm.sh",
|
||||
name: "gum",
|
||||
version: "0.8.0",
|
||||
last_modified: "2022-10-21T02:15:16.000Z",
|
||||
full_name: "charm.sh/gum",
|
||||
dl_count: 0,
|
||||
thumb_image_name: 'charm_sh_gum.jpg ',
|
||||
desc: '',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/charm_sh_gum.jpg',
|
||||
thumb_image_name: "charm_sh_gum.jpg ",
|
||||
desc: "",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/charm_sh_gum.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'pyyaml_org',
|
||||
homepage: 'https://pyyaml.org',
|
||||
name: 'pyyaml.org',
|
||||
version: '0.2.5',
|
||||
last_modified: '2022-10-03T15:35:14.000Z',
|
||||
full_name: 'pyyaml.org',
|
||||
slug: "pyyaml_org",
|
||||
homepage: "https://pyyaml.org",
|
||||
name: "pyyaml.org",
|
||||
version: "0.2.5",
|
||||
last_modified: "2022-10-03T15:35:14.000Z",
|
||||
full_name: "pyyaml.org",
|
||||
dl_count: 107505,
|
||||
thumb_image_name: 'pyyaml_org_option 1.jpg ',
|
||||
maintainer: '',
|
||||
desc: 'YAML framework for Python',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/pyyaml_org.jpg',
|
||||
thumb_image_name: "pyyaml_org_option 1.jpg ",
|
||||
maintainer: "",
|
||||
desc: "YAML framework for Python",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/pyyaml_org.jpg",
|
||||
installs: 0
|
||||
},
|
||||
{
|
||||
slug: 'tea_xyz_gx_cc',
|
||||
homepage: 'https://tea.xyz',
|
||||
maintainer: 'tea.xyz',
|
||||
name: 'cc',
|
||||
version: '0.1.0',
|
||||
last_modified: '2022-10-19T16:47:44.000Z',
|
||||
full_name: 'tea.xyz/gx/cc',
|
||||
slug: "tea_xyz_gx_cc",
|
||||
homepage: "https://tea.xyz",
|
||||
maintainer: "tea.xyz",
|
||||
name: "cc",
|
||||
version: "0.1.0",
|
||||
last_modified: "2022-10-19T16:47:44.000Z",
|
||||
full_name: "tea.xyz/gx/cc",
|
||||
dl_count: 0,
|
||||
thumb_image_name: 'tea_xyz_gx.jpg ',
|
||||
desc: '',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/tea_xyz_gx_cc.jpg',
|
||||
thumb_image_name: "tea_xyz_gx.jpg ",
|
||||
desc: "",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/tea_xyz_gx_cc.jpg",
|
||||
installs: 0
|
||||
}
|
||||
];
|
||||
|
@ -180,23 +180,23 @@ export async function getPackageReviews(full_name: string): Promise<Review[]> {
|
|||
for (let i = 0; i < reviewCount; i++) {
|
||||
const title = loremIpsum({
|
||||
count: _.random(2, 5),
|
||||
format: 'plain',
|
||||
format: "plain",
|
||||
paragraphLowerBound: 3,
|
||||
paragraphUpperBound: 7,
|
||||
random: Math.random,
|
||||
sentenceLowerBound: 5,
|
||||
sentenceUpperBound: 15,
|
||||
units: 'words'
|
||||
units: "words"
|
||||
});
|
||||
const comment = loremIpsum({
|
||||
count: 2,
|
||||
format: 'plain',
|
||||
format: "plain",
|
||||
paragraphLowerBound: 3,
|
||||
paragraphUpperBound: 7,
|
||||
random: Math.random,
|
||||
sentenceLowerBound: 5,
|
||||
sentenceUpperBound: 15,
|
||||
units: 'sentences'
|
||||
units: "sentences"
|
||||
});
|
||||
const rating = _.random(0, 5);
|
||||
reviews.push({
|
||||
|
@ -211,7 +211,7 @@ export async function getPackageReviews(full_name: string): Promise<Review[]> {
|
|||
}
|
||||
|
||||
export async function installPackage(full_name: string) {
|
||||
console.log('installing: ', full_name);
|
||||
console.log("installing: ", full_name);
|
||||
await delay(10000);
|
||||
}
|
||||
|
||||
|
@ -222,22 +222,22 @@ function delay(ms: number) {
|
|||
export async function getFeaturedCourses(): Promise<Course[]> {
|
||||
const mockCourses: Course[] = [
|
||||
{
|
||||
title: 'Developing With Tea',
|
||||
sub_title: 'by Mxcl',
|
||||
link: '#',
|
||||
banner_image_url: 'https://tea.xyz/Images/packages/mesonbuild_com.jpg'
|
||||
title: "Developing With Tea",
|
||||
sub_title: "by Mxcl",
|
||||
link: "#",
|
||||
banner_image_url: "https://tea.xyz/Images/packages/mesonbuild_com.jpg"
|
||||
},
|
||||
{
|
||||
title: 'Brewing Tea',
|
||||
sub_title: 'by Mxcl',
|
||||
link: '#',
|
||||
banner_image_url: 'https://tea.xyz/Images/packages/tea_xyz_gx_cc.jpg'
|
||||
title: "Brewing Tea",
|
||||
sub_title: "by Mxcl",
|
||||
link: "#",
|
||||
banner_image_url: "https://tea.xyz/Images/packages/tea_xyz_gx_cc.jpg"
|
||||
},
|
||||
{
|
||||
title: 'Harvesting Tea',
|
||||
sub_title: 'by Mxcl',
|
||||
link: '#',
|
||||
banner_image_url: 'https://tea.xyz/Images/packages/ipfs_tech.jpg'
|
||||
title: "Harvesting Tea",
|
||||
sub_title: "by Mxcl",
|
||||
link: "#",
|
||||
banner_image_url: "https://tea.xyz/Images/packages/ipfs_tech.jpg"
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -255,46 +255,46 @@ export async function getTopPackages(): Promise<GUIPackage[]> {
|
|||
}
|
||||
|
||||
export async function getAllPosts(type: string): Promise<AirtablePost[]> {
|
||||
console.log('filter by type:', type);
|
||||
console.log("filter by type:", type);
|
||||
const posts: AirtablePost[] = [
|
||||
{
|
||||
airtable_record_id: 'a',
|
||||
link: 'https://google.com',
|
||||
title: 'Tea Inc releases game changing api!',
|
||||
sub_title: 'lorem ipsum dolor sit amet',
|
||||
short_description: 'lorem ipsum dolor sit amet',
|
||||
thumb_image_url: '/images/bored-ape.png',
|
||||
thumb_image_name: 'borred-api.png',
|
||||
airtable_record_id: "a",
|
||||
link: "https://google.com",
|
||||
title: "Tea Inc releases game changing api!",
|
||||
sub_title: "lorem ipsum dolor sit amet",
|
||||
short_description: "lorem ipsum dolor sit amet",
|
||||
thumb_image_url: "/images/bored-ape.png",
|
||||
thumb_image_name: "borred-api.png",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
published_at: new Date(),
|
||||
tags: ['news']
|
||||
tags: ["news"]
|
||||
},
|
||||
{
|
||||
airtable_record_id: 'b',
|
||||
link: 'https://google.com',
|
||||
title: 'Bored Ape not bored anymore',
|
||||
sub_title: 'lorem ipsum dolor sit amet',
|
||||
short_description: 'lorem ipsum dolor sit amet',
|
||||
thumb_image_url: '/images/bored-ape.png',
|
||||
thumb_image_name: 'borred-api.png',
|
||||
airtable_record_id: "b",
|
||||
link: "https://google.com",
|
||||
title: "Bored Ape not bored anymore",
|
||||
sub_title: "lorem ipsum dolor sit amet",
|
||||
short_description: "lorem ipsum dolor sit amet",
|
||||
thumb_image_url: "/images/bored-ape.png",
|
||||
thumb_image_name: "borred-api.png",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
published_at: new Date(),
|
||||
tags: ['news']
|
||||
tags: ["news"]
|
||||
},
|
||||
{
|
||||
airtable_record_id: 'c',
|
||||
link: 'https://google.com',
|
||||
title: 'Markdown can be executed! hoohah!',
|
||||
sub_title: 'lorem ipsum dolor sit amet',
|
||||
short_description: 'lorem ipsum dolor sit amet',
|
||||
thumb_image_url: '/images/bored-ape.png',
|
||||
thumb_image_name: 'borred-api.png',
|
||||
airtable_record_id: "c",
|
||||
link: "https://google.com",
|
||||
title: "Markdown can be executed! hoohah!",
|
||||
sub_title: "lorem ipsum dolor sit amet",
|
||||
short_description: "lorem ipsum dolor sit amet",
|
||||
thumb_image_url: "/images/bored-ape.png",
|
||||
thumb_image_name: "borred-api.png",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
published_at: new Date(),
|
||||
tags: ['news']
|
||||
tags: ["news"]
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -308,18 +308,18 @@ export async function getCategorizedPackages(): Promise<Category[]> {
|
|||
}));
|
||||
return [
|
||||
{
|
||||
label: 'framework essentials',
|
||||
cta_label: 'View all essentials >',
|
||||
label: "framework essentials",
|
||||
cta_label: "View all essentials >",
|
||||
packages: mockPackages
|
||||
},
|
||||
{
|
||||
label: 'star-struck heavyweights',
|
||||
cta_label: 'View all star-strucks >',
|
||||
label: "star-struck heavyweights",
|
||||
cta_label: "View all star-strucks >",
|
||||
packages: mockPackages
|
||||
},
|
||||
{
|
||||
label: 'simply delightful',
|
||||
cta_label: 'View all delightful packages >',
|
||||
label: "simply delightful",
|
||||
cta_label: "View all delightful packages >",
|
||||
packages: mockPackages
|
||||
}
|
||||
];
|
||||
|
@ -332,17 +332,17 @@ export async function getDeviceAuth(deviceId: string): Promise<any> {
|
|||
|
||||
export async function getPackageBottles(name: string): Promise<Bottle[]> {
|
||||
return [
|
||||
{ name, platform: 'darwin', arch: 'aarch64', version: '3.39.4' },
|
||||
{ name, platform: 'darwin', arch: 'aarch64', version: '3.40.0' },
|
||||
{ name, platform: 'darwin', arch: 'x86-64', version: '3.39.4' },
|
||||
{ name, platform: 'darwin', arch: 'x86-64', version: '3.40.0' },
|
||||
{ name, platform: 'linux', arch: 'aarch64', version: '3.39.4' },
|
||||
{ name, platform: 'linux', arch: 'aarch64', version: '3.40.0' },
|
||||
{ name, platform: 'linux', arch: 'x86-64', version: '3.39.4' },
|
||||
{ name, platform: 'linux', arch: 'x86-64', version: '3.40.0' }
|
||||
{ name, platform: "darwin", arch: "aarch64", version: "3.39.4" },
|
||||
{ name, platform: "darwin", arch: "aarch64", version: "3.40.0" },
|
||||
{ name, platform: "darwin", arch: "x86-64", version: "3.39.4" },
|
||||
{ name, platform: "darwin", arch: "x86-64", version: "3.40.0" },
|
||||
{ name, platform: "linux", arch: "aarch64", version: "3.39.4" },
|
||||
{ name, platform: "linux", arch: "aarch64", version: "3.40.0" },
|
||||
{ name, platform: "linux", arch: "x86-64", version: "3.39.4" },
|
||||
{ name, platform: "linux", arch: "x86-64", version: "3.40.0" }
|
||||
];
|
||||
}
|
||||
|
||||
export async function registerDevice(): Promise<string> {
|
||||
return 'uuid1234';
|
||||
return "uuid1234";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { ipcRenderer } = window.require('electron');
|
||||
const { ipcRenderer } = window.require("electron");
|
||||
|
||||
export async function installPackageCommand(full_name: string) {
|
||||
const res = await ipcRenderer.invoke('install-package', { full_name });
|
||||
console.log('install:', res);
|
||||
const res = await ipcRenderer.invoke("install-package", { full_name });
|
||||
console.log("install:", res);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import axios from 'axios';
|
||||
import type { Contributor, Package } from '@tea/ui/types';
|
||||
const yaml = window.require('yaml');
|
||||
import axios from "axios";
|
||||
import type { Contributor, Package } from "@tea/ui/types";
|
||||
const yaml = window.require("yaml");
|
||||
|
||||
export async function getPackageYaml(pkgYamlUrl: string) {
|
||||
const url = pkgYamlUrl.replace('/github.com', '/raw.githubusercontent.com').replace('/blob', '');
|
||||
const url = pkgYamlUrl.replace("/github.com", "/raw.githubusercontent.com").replace("/blob", "");
|
||||
|
||||
const { data: rawYaml } = await axios.get(url);
|
||||
|
||||
|
@ -13,7 +13,7 @@ export async function getPackageYaml(pkgYamlUrl: string) {
|
|||
}
|
||||
|
||||
export async function getReadme(owner: string, repo: string): Promise<string> {
|
||||
let readme = '';
|
||||
let readme = "";
|
||||
const req = await axios.get(`https://api.github.com/repos/${owner}/${repo}/readme`);
|
||||
if (req.data?.download_url) {
|
||||
const reqDl = await axios.get(req.data.download_url);
|
||||
|
@ -30,7 +30,7 @@ export async function getContributors(owner: string, repo: string): Promise<Cont
|
|||
contributors = req.data.map((c: Contributor & { id: number }) => ({
|
||||
login: c.login,
|
||||
avatar_url: c.avatar_url,
|
||||
name: c.name || '',
|
||||
name: c.name || "",
|
||||
github_id: c.id,
|
||||
contributions: c.contributions
|
||||
}));
|
||||
|
@ -42,7 +42,7 @@ export async function getRepoAsPackage(owner: string, repo: string): Promise<Par
|
|||
const req = await axios.get(`https://api.github.com/repos/${owner}/${repo}`);
|
||||
const pkg: Partial<Package> = {};
|
||||
if (req.data) {
|
||||
pkg.license = req.data?.license?.name || '';
|
||||
pkg.license = req.data?.license?.name || "";
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import { writable } from 'svelte/store';
|
||||
import Fuse from 'fuse.js';
|
||||
import { writable } from "svelte/store";
|
||||
import Fuse from "fuse.js";
|
||||
|
||||
import type { Package, Review, AirtablePost } from '@tea/ui/types';
|
||||
import type { GUIPackage } from '$libs/types';
|
||||
import type { Package, Review, AirtablePost } from "@tea/ui/types";
|
||||
import type { GUIPackage } from "$libs/types";
|
||||
|
||||
import { getFeaturedPackages, getPackageReviews, getAllPosts } from '@api';
|
||||
import initAuthStore from './stores/auth';
|
||||
import initNavStore from './stores/nav';
|
||||
import initPackagesStore from './stores/pkgs';
|
||||
import { getFeaturedPackages, getPackageReviews, getAllPosts } from "@api";
|
||||
import initAuthStore from "./stores/auth";
|
||||
import initNavStore from "./stores/nav";
|
||||
import initPackagesStore from "./stores/pkgs";
|
||||
|
||||
export const featuredPackages = writable<Package[]>([]);
|
||||
|
||||
export const packagesStore = initPackagesStore();
|
||||
|
||||
export const initializeFeaturedPackages = async () => {
|
||||
console.log('intialize featured packages');
|
||||
console.log("intialize featured packages");
|
||||
const packages = await getFeaturedPackages();
|
||||
featuredPackages.set(packages);
|
||||
};
|
||||
|
@ -71,7 +71,7 @@ function initPosts() {
|
|||
subscribe((v) => {
|
||||
posts.push(...v);
|
||||
postsIndex = new Fuse(posts, {
|
||||
keys: ['title', 'sub_title', 'short_description', 'tags']
|
||||
keys: ["title", "sub_title", "short_description", "tags"]
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -94,7 +94,7 @@ export const postsStore = initPosts();
|
|||
|
||||
function initSearchStore() {
|
||||
const searching = writable<boolean>(false);
|
||||
const { subscribe, set } = writable<string>('');
|
||||
const { subscribe, set } = writable<string>("");
|
||||
const packagesSearch = writable<GUIPackage[]>([]);
|
||||
const postsSearch = writable<AirtablePost[]>([]);
|
||||
|
||||
|
@ -103,7 +103,7 @@ function initSearchStore() {
|
|||
|
||||
const packagesFound: GUIPackage[] = [];
|
||||
|
||||
let term = '';
|
||||
let term = "";
|
||||
|
||||
subscribe((v) => (term = v));
|
||||
packagesSearch.subscribe((v) => packagesFound.push(...v));
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { writable } from 'svelte/store';
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
import { getDeviceAuth } from '@api';
|
||||
import type { Developer } from '@tea/ui/types';
|
||||
import type { Session } from '$libs/types';
|
||||
import { getDeviceAuth } from "@api";
|
||||
import type { Developer } from "@tea/ui/types";
|
||||
import type { Session } from "$libs/types";
|
||||
|
||||
const { ipcRenderer } = window.require('electron');
|
||||
const { ipcRenderer } = window.require("electron");
|
||||
|
||||
const basePath = '.tea/tea.xyz/gui';
|
||||
const basePath = ".tea/tea.xyz/gui";
|
||||
|
||||
export let session: Session | null = null;
|
||||
export const getSession = async (): Promise<Session | null> => {
|
||||
session = await ipcRenderer.invoke('get-session');
|
||||
session = await ipcRenderer.invoke("get-session");
|
||||
return session;
|
||||
};
|
||||
|
||||
|
@ -18,8 +18,8 @@ export default function initAuthStore() {
|
|||
const sessionStore = writable<Session>({});
|
||||
let pollLoop = 0;
|
||||
|
||||
const deviceIdStore = writable<string>('');
|
||||
let deviceId = '';
|
||||
const deviceIdStore = writable<string>("");
|
||||
let deviceId = "";
|
||||
|
||||
getSession().then((sess) => {
|
||||
if (sess) {
|
||||
|
@ -38,8 +38,8 @@ export default function initAuthStore() {
|
|||
key: data.key,
|
||||
user: data.user
|
||||
};
|
||||
console.log('localSession:', localSession);
|
||||
await ipcRenderer.invoke('update-session', localSession);
|
||||
console.log("localSession:", localSession);
|
||||
await ipcRenderer.invoke("update-session", localSession);
|
||||
sessionStore.set(localSession);
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ export default function initAuthStore() {
|
|||
pollLoop++;
|
||||
try {
|
||||
const data = await getDeviceAuth(deviceId);
|
||||
console.log('dd', deviceId, data);
|
||||
if (data.status === 'SUCCESS') {
|
||||
console.log("dd", deviceId, data);
|
||||
if (data.status === "SUCCESS") {
|
||||
updateSession({
|
||||
key: data.key,
|
||||
user: data.user
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { writable } from 'svelte/store';
|
||||
import { goto } from '$app/navigation';
|
||||
import { writable } from "svelte/store";
|
||||
import { goto } from "$app/navigation";
|
||||
|
||||
export default function initNavStore() {
|
||||
const historyStore = writable<string[]>(['/']);
|
||||
let history = ['/'];
|
||||
const historyStore = writable<string[]>(["/"]);
|
||||
let history = ["/"];
|
||||
|
||||
historyStore.subscribe((v) => (history = v));
|
||||
|
||||
const prevPathStore = writable<string>('');
|
||||
const nextPathStore = writable<string>('');
|
||||
const prevPathStore = writable<string>("");
|
||||
const nextPathStore = writable<string>("");
|
||||
|
||||
let currentIndex = 0; // if non next/back click
|
||||
|
||||
|
@ -25,7 +25,7 @@ export default function initNavStore() {
|
|||
goto(history[currentIndex + 1]);
|
||||
prevPathStore.set(history[currentIndex]);
|
||||
currentIndex++;
|
||||
if (currentIndex >= history.length - 1) nextPathStore.set('');
|
||||
if (currentIndex >= history.length - 1) nextPathStore.set("");
|
||||
}
|
||||
},
|
||||
back: () => {
|
||||
|
@ -34,7 +34,7 @@ export default function initNavStore() {
|
|||
goto(history[currentIndex - 1]);
|
||||
nextPathStore.set(history[currentIndex]);
|
||||
currentIndex--;
|
||||
if (currentIndex === 0) prevPathStore.set('');
|
||||
if (currentIndex === 0) prevPathStore.set("");
|
||||
}
|
||||
},
|
||||
setNewPath: (newNextPath: string, newPrevPath: string) => {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { writable } from 'svelte/store';
|
||||
import type { GUIPackage } from '../types';
|
||||
import { getPackages } from '@api';
|
||||
import Fuse from 'fuse.js';
|
||||
import { getPackage } from '@api';
|
||||
import { writable } from "svelte/store";
|
||||
import type { GUIPackage } from "../types";
|
||||
import { getPackages } from "@api";
|
||||
import Fuse from "fuse.js";
|
||||
import { getPackage } from "@api";
|
||||
|
||||
import { getReadme, getContributors, getRepoAsPackage } from '$libs/github';
|
||||
import { getReadme, getContributors, getRepoAsPackage } from "$libs/github";
|
||||
|
||||
export default function initPackagesStore() {
|
||||
let initialized = false;
|
||||
|
@ -17,7 +17,7 @@ export default function initPackagesStore() {
|
|||
getPackages().then((pkgs) => {
|
||||
set(pkgs);
|
||||
packagesIndex = new Fuse(pkgs, {
|
||||
keys: ['name', 'full_name', 'desc', 'categories']
|
||||
keys: ["name", "full_name", "desc", "categories"]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ To read more about this package go to [${guiPkg.homepage}](${guiPkg.homepage}).
|
|||
synced: true
|
||||
};
|
||||
if (pkg.github) {
|
||||
const [owner, repo] = pkg.github.split('/');
|
||||
const [owner, repo] = pkg.github.split("/");
|
||||
const [readme, contributors, repoData] = await Promise.all([
|
||||
getReadme(owner, repo),
|
||||
getContributors(owner, repo),
|
||||
|
|
|
@ -8,9 +8,9 @@ type Dir = {
|
|||
children?: Dir[];
|
||||
};
|
||||
|
||||
const { ipcRenderer } = window.require('electron');
|
||||
const { ipcRenderer } = window.require("electron");
|
||||
export async function getInstalledPackages() {
|
||||
const pkgs = await ipcRenderer.invoke('get-installed-packages');
|
||||
const pkgs = await ipcRenderer.invoke("get-installed-packages");
|
||||
return pkgs as { version: string; full_name: string }[];
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,10 @@ const semverTest =
|
|||
export const getPkgBottles = (packageDir: Dir): string[] => {
|
||||
const bottles: string[] = [];
|
||||
|
||||
const pkg = packageDir.path.split('.tea/')[1];
|
||||
const version = pkg.split('/v')[1];
|
||||
const pkg = packageDir.path.split(".tea/")[1];
|
||||
const version = pkg.split("/v")[1];
|
||||
|
||||
const isVersion = semverTest.test(version) || !isNaN(+version) || version === '*';
|
||||
const isVersion = semverTest.test(version) || !isNaN(+version) || version === "*";
|
||||
|
||||
if (version && isVersion) {
|
||||
bottles.push(pkg);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// please use the package @tea/ui/src/types.ts
|
||||
// things that go there are shared types/shapes like ie: Package
|
||||
|
||||
import type { Package, Developer } from '@tea/ui/types';
|
||||
import type { Package, Developer } from "@tea/ui/types";
|
||||
|
||||
export enum PackageStates {
|
||||
AVAILABLE,
|
||||
|
@ -32,10 +32,10 @@ export type Category = {
|
|||
};
|
||||
|
||||
export enum AuthStatus {
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
PENDING = 'PENDING',
|
||||
SUCCESS = 'SUCCESS',
|
||||
FAILED = 'FAILED'
|
||||
UNKNOWN = "UNKNOWN",
|
||||
PENDING = "PENDING",
|
||||
SUCCESS = "SUCCESS",
|
||||
FAILED = "FAILED"
|
||||
}
|
||||
|
||||
export type DeviceAuth = {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import axios from 'axios';
|
||||
import type { Session } from '$libs/types';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { getSession } from '$libs/stores/auth';
|
||||
import axios from "axios";
|
||||
import type { Session } from "$libs/types";
|
||||
import bcrypt from "bcryptjs";
|
||||
import { getSession } from "$libs/stores/auth";
|
||||
|
||||
export const baseUrl = 'https://api.tea.xyz/v1';
|
||||
export const baseUrl = "https://api.tea.xyz/v1";
|
||||
|
||||
export async function get<T>(urlPath: string, params?: { [key: string]: string }) {
|
||||
console.log(`GET /v1/${urlPath}`);
|
||||
|
@ -13,12 +13,12 @@ export async function get<T>(urlPath: string, params?: { [key: string]: string }
|
|||
const headers =
|
||||
session?.device_id && session?.user
|
||||
? await getHeaders(`GET/${urlPath}`, session)
|
||||
: { Authorization: 'public ' };
|
||||
: { Authorization: "public " };
|
||||
|
||||
const req = await axios.request({
|
||||
method: 'GET',
|
||||
baseURL: 'https://api.tea.xyz',
|
||||
url: ['v1', ...urlPath.split('/')].filter((p) => p).join('/'),
|
||||
method: "GET",
|
||||
baseURL: "https://api.tea.xyz",
|
||||
url: ["v1", ...urlPath.split("/")].filter((p) => p).join("/"),
|
||||
headers,
|
||||
params
|
||||
});
|
||||
|
@ -29,15 +29,15 @@ export async function get<T>(urlPath: string, params?: { [key: string]: string }
|
|||
async function getHeaders(path: string, session: Session) {
|
||||
const unixMs = new Date().getTime();
|
||||
const unixHexSecs = Math.round(unixMs / 1000).toString(16); // hex
|
||||
const deviceId = session.device_id?.split('-')[0];
|
||||
const preHash = [unixHexSecs, session.key, deviceId, path].join('');
|
||||
const deviceId = session.device_id?.split("-")[0];
|
||||
const preHash = [unixHexSecs, session.key, deviceId, path].join("");
|
||||
|
||||
const Authorization = bcrypt.hashSync(preHash, 10);
|
||||
|
||||
return {
|
||||
Authorization,
|
||||
['tea-ts']: unixMs.toString(),
|
||||
['tea-uid']: session.user?.developer_id,
|
||||
['tea-gui_id']: session.device_id
|
||||
["tea-ts"]: unixMs.toString(),
|
||||
["tea-uid"]: session.user?.developer_id,
|
||||
["tea-gui_id"]: session.device_id
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { LoadEvent } from '@sveltejs/kit';
|
||||
import type { LoadEvent } from "@sveltejs/kit";
|
||||
|
||||
/** @type {import('./$types').PageLoad} */
|
||||
export function load({ params }: LoadEvent) {
|
||||
// TODO: search package details here
|
||||
return {
|
||||
title: `${params.slug}`,
|
||||
content: '',
|
||||
content: "",
|
||||
slug: params.slug
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import adapter from '@sveltejs/adapter-static';
|
||||
import preprocess from 'svelte-preprocess';
|
||||
import adapter from "@sveltejs/adapter-static";
|
||||
import preprocess from "svelte-preprocess";
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
|
@ -12,12 +12,12 @@ const config = {
|
|||
],
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
pages: 'build',
|
||||
assets: 'build',
|
||||
fallback: 'app.html'
|
||||
pages: "build",
|
||||
assets: "build",
|
||||
fallback: "app.html"
|
||||
}),
|
||||
alias: {
|
||||
'@tea/ui/*': '../ui/src/*'
|
||||
"@tea/ui/*": "../ui/src/*"
|
||||
}
|
||||
// ssr: false,
|
||||
// hydrate the <div id="svelte"> element in src/app.html
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { theme, plugins } from '@tea/ui/tailwind.config.cjs';
|
||||
import { theme, plugins } from "@tea/ui/tailwind.config.cjs";
|
||||
module.exports = {
|
||||
content: ['./src/**/*.{html,svelte,ts,js}', '../ui/src/**/*.{html,svelte,ts,js}'],
|
||||
content: ["./src/**/*.{html,svelte,ts,js}", "../ui/src/**/*.{html,svelte,ts,js}"],
|
||||
theme,
|
||||
plugins: [...plugins]
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import type { UserConfig } from 'vite';
|
||||
import path from 'path';
|
||||
import { sveltekit } from "@sveltejs/kit/vite";
|
||||
import type { UserConfig } from "vite";
|
||||
import path from "path";
|
||||
|
||||
// const isMock = process.env.BUILD_FOR === 'preview';
|
||||
|
||||
|
@ -8,31 +8,31 @@ const config: UserConfig = {
|
|||
plugins: [sveltekit()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@tea/ui/*': path.resolve('../ui/src/*'),
|
||||
"@tea/ui/*": path.resolve("../ui/src/*"),
|
||||
// this dynamic-ish static importing is followed by the svelte build
|
||||
// but for vscode editing intellisense tsconfig.json is being used
|
||||
// TODO: replace it with correct api
|
||||
'@api': path.resolve('src/libs/api/electron.ts'),
|
||||
$components: path.resolve('./src/components'),
|
||||
$libs: path.resolve('./src/libs'),
|
||||
$appcss: path.resolve('./src/app.css')
|
||||
"@api": path.resolve("src/libs/api/electron.ts"),
|
||||
$components: path.resolve("./src/components"),
|
||||
$libs: path.resolve("./src/libs"),
|
||||
$appcss: path.resolve("./src/app.css")
|
||||
}
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
fs: {
|
||||
allow: ['..']
|
||||
allow: [".."]
|
||||
}
|
||||
},
|
||||
test: {
|
||||
// Jest like globals
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
include: ['src/**/*.{test,spec}.ts'],
|
||||
environment: "jsdom",
|
||||
include: ["src/**/*.{test,spec}.ts"],
|
||||
// Extend jest-dom matchers
|
||||
setupFiles: ['./setupTest.js'],
|
||||
setupFiles: ["./setupTest.js"],
|
||||
coverage: {
|
||||
provider: 'c8'
|
||||
provider: "c8"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,26 +3,26 @@ module.exports = {
|
|||
globals: {
|
||||
NodeJS: true
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
parser: "@typescript-eslint/parser",
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
'plugin:storybook/recommended'
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier",
|
||||
"plugin:storybook/recommended"
|
||||
],
|
||||
plugins: ['svelte3', '@typescript-eslint'],
|
||||
ignorePatterns: ['*.cjs'],
|
||||
plugins: ["svelte3", "@typescript-eslint"],
|
||||
ignorePatterns: ["*.cjs"],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.svelte'],
|
||||
processor: 'svelte3/svelte3'
|
||||
files: ["*.svelte"],
|
||||
processor: "svelte3/svelte3"
|
||||
}
|
||||
],
|
||||
settings: {
|
||||
'svelte3/typescript': () => require('typescript')
|
||||
"svelte3/typescript": () => require("typescript")
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
sourceType: "module",
|
||||
ecmaVersion: 2020
|
||||
},
|
||||
env: {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"tabWidth": 2,
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
const path = require('path');
|
||||
const path = require("path");
|
||||
module.exports = {
|
||||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx|svelte)'],
|
||||
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx|svelte)"],
|
||||
addons: [
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-essentials',
|
||||
'@storybook/addon-interactions'
|
||||
"@storybook/addon-links",
|
||||
"@storybook/addon-essentials",
|
||||
"@storybook/addon-interactions"
|
||||
],
|
||||
framework: {
|
||||
name: '@storybook/svelte-vite',
|
||||
name: "@storybook/svelte-vite",
|
||||
options: {}
|
||||
},
|
||||
docs: {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export const parameters = {
|
||||
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type { PlaywrightTestConfig } from '@playwright/test';
|
||||
import type { PlaywrightTestConfig } from "@playwright/test";
|
||||
|
||||
const config: PlaywrightTestConfig = {
|
||||
webServer: {
|
||||
command: 'npm run build && npm run preview',
|
||||
command: "npm run build && npm run preview",
|
||||
port: 4173
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import https from 'https';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import https from "https";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const fontasticDownloadURI = 'https://file.myfontastic.com/Fd33ifaooDVpESwnDXETgR/icons.css';
|
||||
const fontasticDownloadURI = "https://file.myfontastic.com/Fd33ifaooDVpESwnDXETgR/icons.css";
|
||||
// i tried the zip dl unfortunately its auth protected so have to hack our way into the resources
|
||||
|
||||
const downloadFileTo = async (uri, path) => {
|
||||
|
@ -10,7 +10,7 @@ const downloadFileTo = async (uri, path) => {
|
|||
const file = fs.createWriteStream(path);
|
||||
https.get(uri, (res) => {
|
||||
res.pipe(file);
|
||||
file.on('finish', () => {
|
||||
file.on("finish", () => {
|
||||
file.close();
|
||||
console.log(`downloaded: ${uri}`);
|
||||
resolve();
|
||||
|
@ -20,17 +20,17 @@ const downloadFileTo = async (uri, path) => {
|
|||
};
|
||||
|
||||
async function main() {
|
||||
const tmpIconsCss = './scripts/icons.css';
|
||||
const iconsFolder = './src/icons/';
|
||||
const tmpIconsCss = "./scripts/icons.css";
|
||||
const iconsFolder = "./src/icons/";
|
||||
await downloadFileTo(fontasticDownloadURI, tmpIconsCss); // works
|
||||
|
||||
const cssFile = fs.readFileSync(tmpIconsCss, 'utf-8');
|
||||
const cssFile = fs.readFileSync(tmpIconsCss, "utf-8");
|
||||
|
||||
const matches = cssFile.matchAll(/url\(.*?\)/gi);
|
||||
const [url] = matches.next().value;
|
||||
const fileVersion = url.split('/').pop().split('.')[0];
|
||||
const fileVersion = url.split("/").pop().split(".")[0];
|
||||
|
||||
const exts = ['eot', 'woff', 'ttf', 'svg'];
|
||||
const exts = ["eot", "woff", "ttf", "svg"];
|
||||
|
||||
for (const ext of exts) {
|
||||
const uri = `https://file.myfontastic.com/Fd33ifaooDVpESwnDXETgR/fonts/${fileVersion}.${ext}`;
|
||||
|
@ -38,9 +38,9 @@ async function main() {
|
|||
}
|
||||
|
||||
const newCssFile = cssFile
|
||||
.replaceAll('https://file.myfontastic.com/Fd33ifaooDVpESwnDXETgR/', '')
|
||||
.replaceAll(fileVersion, 'tea-icons');
|
||||
await fs.writeFileSync(path.join(iconsFolder, 'icons.css'), newCssFile, { encoding: 'utf-8' });
|
||||
.replaceAll("https://file.myfontastic.com/Fd33ifaooDVpESwnDXETgR/", "")
|
||||
.replaceAll(fileVersion, "tea-icons");
|
||||
await fs.writeFileSync(path.join(iconsFolder, "icons.css"), newCssFile, { encoding: "utf-8" });
|
||||
}
|
||||
|
||||
main();
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import ArticleCard from './ArticleCard.svelte';
|
||||
import ArticleCard from "./ArticleCard.svelte";
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
export default {
|
||||
title: 'Example/ArticleCard',
|
||||
title: "Example/ArticleCard",
|
||||
component: ArticleCard,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: ({ content }) => ({
|
||||
Component: ArticleCard,
|
||||
props: { content }
|
||||
}),
|
||||
argTypes: {
|
||||
content: {
|
||||
name: 'content',
|
||||
description: 'this is type Article'
|
||||
name: "content",
|
||||
description: "this is type Article"
|
||||
},
|
||||
onClick: {
|
||||
name: 'onClick',
|
||||
description: 'this is optional function'
|
||||
name: "onClick",
|
||||
description: "this is optional function"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -25,11 +25,11 @@ export default {
|
|||
export const Example = {
|
||||
args: {
|
||||
content: {
|
||||
title: 'installing tea',
|
||||
copy: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptas, voluptatum molestiae esse quisquam earum debitis.',
|
||||
img_url: 'https://tea.xyz/Images/packages/unicode_org.jpg',
|
||||
cta_label: 'Get Started',
|
||||
link: '/cli'
|
||||
title: "installing tea",
|
||||
copy: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptas, voluptatum molestiae esse quisquam earum debitis.",
|
||||
img_url: "https://tea.xyz/Images/packages/unicode_org.jpg",
|
||||
cta_label: "Get Started",
|
||||
link: "/cli"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import "../app.css";
|
||||
|
||||
type Article = {
|
||||
title: string;
|
||||
|
@ -21,7 +21,7 @@
|
|||
<article class="p-4">
|
||||
<p class="font-sono text-xs line-clamp-3">{content.copy}</p>
|
||||
{#if content.link}
|
||||
<a href={content.link || '#'}>
|
||||
<a href={content.link || "#"}>
|
||||
<button class="mt-2 text-primary">{content.cta_label}</button>
|
||||
</a>
|
||||
{:else if onClick}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import type { Bottle } from '../types';
|
||||
import type { Bottle } from "../types";
|
||||
export let bottles: Bottle[];
|
||||
|
||||
let versions: string[] = [];
|
||||
|
@ -12,7 +12,7 @@
|
|||
<div class="my-4 w-full p-2">
|
||||
<div>
|
||||
<h4 class="mb-4 text-lg text-primary">
|
||||
{versions.length} version{versions.length === 1 ? '' : 's'} bottled
|
||||
{versions.length} version{versions.length === 1 ? "" : "s"} bottled
|
||||
</h4>
|
||||
</div>
|
||||
<table class="w-full table-auto border border-gray font-sono">
|
||||
|
@ -30,15 +30,15 @@
|
|||
<tr>
|
||||
<th class="border border-gray px-2 py-4 text-left">{version}</th>
|
||||
<td class="border border-gray px-2 py-4"
|
||||
>{available.has('darwin-aarch64') ? '✅' : '❌'}</td
|
||||
>{available.has("darwin-aarch64") ? "✅" : "❌"}</td
|
||||
>
|
||||
<td class="border border-gray px-2 py-4"
|
||||
>{available.has('darwin-x86-64') ? '✅' : '❌'}</td
|
||||
>{available.has("darwin-x86-64") ? "✅" : "❌"}</td
|
||||
>
|
||||
<td class="border border-gray px-2 py-4"
|
||||
>{available.has('linux-aarch64') ? '✅' : '❌'}</td
|
||||
>{available.has("linux-aarch64") ? "✅" : "❌"}</td
|
||||
>
|
||||
<td class="border border-gray px-2 py-4">{available.has('linux-x86-64') ? '✅' : '❌'}</td
|
||||
<td class="border border-gray px-2 py-4">{available.has("linux-x86-64") ? "✅" : "❌"}</td
|
||||
>
|
||||
</tr>
|
||||
{/each}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import Button from './ButtonView.svelte';
|
||||
import Button from "./ButtonView.svelte";
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
export default {
|
||||
title: 'Example/Button',
|
||||
title: "Example/Button",
|
||||
component: Button,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: (args) => ({
|
||||
Component: Button,
|
||||
props: args
|
||||
}),
|
||||
argTypes: {
|
||||
onClick: () => console.log('does nothing')
|
||||
onClick: () => console.log("does nothing")
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
let clazz = '';
|
||||
let clazz = "";
|
||||
export { clazz as class };
|
||||
|
||||
// export let size: 'large' | 'medium' | 'small' = 'medium';
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
<button
|
||||
type="button"
|
||||
class={`w-full p-2 font-machina text-gray ${clazz} ${active ? 'active' : ''}`}
|
||||
class={`w-full p-2 font-machina text-gray ${clazz} ${active ? "active" : ""}`}
|
||||
on:click={() => onClick && onClick()}
|
||||
>
|
||||
<slot />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import Button from './Button.svelte';
|
||||
import Button from "./Button.svelte";
|
||||
</script>
|
||||
|
||||
<Button>Click Me</Button>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import Gallery from './Gallery.svelte';
|
||||
import Gallery from "./Gallery.svelte";
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
export default {
|
||||
title: 'Example/Gallery',
|
||||
title: "Example/Gallery",
|
||||
component: Gallery,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: (args) => ({
|
||||
Component: Gallery,
|
||||
props: args
|
||||
}),
|
||||
argTypes: {
|
||||
onClick: () => console.log('does nothing')
|
||||
onClick: () => console.log("does nothing")
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -20,22 +20,22 @@ export const Example = {
|
|||
items: [
|
||||
{
|
||||
imageUrl:
|
||||
'https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg/2732px-%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg',
|
||||
title: 'Item 1',
|
||||
subTitle: 'sub-title',
|
||||
link: '#'
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg/2732px-%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg",
|
||||
title: "Item 1",
|
||||
subTitle: "sub-title",
|
||||
link: "#"
|
||||
},
|
||||
{
|
||||
imageUrl: 'https://tea.xyz/Images/packages/sqlite_org.jpg',
|
||||
title: 'Item 2',
|
||||
subTitle: 'sub-title 2',
|
||||
link: '#'
|
||||
imageUrl: "https://tea.xyz/Images/packages/sqlite_org.jpg",
|
||||
title: "Item 2",
|
||||
subTitle: "sub-title 2",
|
||||
link: "#"
|
||||
},
|
||||
{
|
||||
imageUrl: 'https://tea.xyz/Images/packages/gnu_org_libtool.jpg',
|
||||
title: 'Item 3',
|
||||
subTitle: 'sub-title 3',
|
||||
link: '#'
|
||||
imageUrl: "https://tea.xyz/Images/packages/gnu_org_libtool.jpg",
|
||||
title: "Item 3",
|
||||
subTitle: "sub-title 3",
|
||||
link: "#"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { watchResize } from 'svelte-watch-resize';
|
||||
import Preloader from '../Preloader/Preloader.svelte';
|
||||
import GalleryItem from './GalleryItem.svelte';
|
||||
import "../app.css";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { watchResize } from "svelte-watch-resize";
|
||||
import Preloader from "../Preloader/Preloader.svelte";
|
||||
import GalleryItem from "./GalleryItem.svelte";
|
||||
|
||||
export let title = '';
|
||||
export let linkTarget = '';
|
||||
export let title = "";
|
||||
export let linkTarget = "";
|
||||
|
||||
interface GalleryItemShape {
|
||||
imageUrl: string;
|
||||
|
@ -67,7 +67,7 @@
|
|||
resetLoop();
|
||||
}}
|
||||
class={`bg-purple h-3 w-3 rounded-lg border border-white transition-colors ${
|
||||
i === focus ? 'bg-purple-900' : ''
|
||||
i === focus ? "bg-purple-900" : ""
|
||||
}`}
|
||||
/>
|
||||
{/each}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import ImgLoader from '../ImgLoader/ImgLoader.svelte';
|
||||
import "../app.css";
|
||||
import ImgLoader from "../ImgLoader/ImgLoader.svelte";
|
||||
|
||||
export let width = 0;
|
||||
export let imageUrl = '';
|
||||
export let title = '';
|
||||
export let subTitle = '';
|
||||
export let imageUrl = "";
|
||||
export let title = "";
|
||||
export let subTitle = "";
|
||||
</script>
|
||||
|
||||
<figure class="gallery-item relative h-full w-full" style={`width:${width}px`}>
|
||||
<ImgLoader
|
||||
class="featured-img"
|
||||
src={!imageUrl.includes('https://tea.xyz')
|
||||
? 'https://tea.xyz/Images/package-thumb-nolabel4.jpg'
|
||||
src={!imageUrl.includes("https://tea.xyz")
|
||||
? "https://tea.xyz/Images/package-thumb-nolabel4.jpg"
|
||||
: imageUrl}
|
||||
alt={title}
|
||||
/>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import Header from './Header.svelte';
|
||||
import Header from "./Header.svelte";
|
||||
|
||||
export default {
|
||||
title: 'Example/Header',
|
||||
title: "Example/Header",
|
||||
component: Header,
|
||||
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/svelte/writing-docs/docs-page
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: (args) => ({
|
||||
Component: Header,
|
||||
props: args,
|
||||
|
@ -16,19 +16,19 @@ export default {
|
|||
}),
|
||||
parameters: {
|
||||
// More on how to position stories at: https://storybook.js.org/docs/7.0/svelte/configure/story-layout
|
||||
layout: 'fullscreen'
|
||||
layout: "fullscreen"
|
||||
},
|
||||
argTypes: {
|
||||
onLogin: { action: 'onLogin' },
|
||||
onLogout: { action: 'onLogout' },
|
||||
onCreateAccount: { action: 'onCreateAccount' }
|
||||
onLogin: { action: "onLogin" },
|
||||
onLogout: { action: "onLogout" },
|
||||
onCreateAccount: { action: "onCreateAccount" }
|
||||
}
|
||||
};
|
||||
|
||||
export const LoggedIn = {
|
||||
args: {
|
||||
user: {
|
||||
name: 'Jane Doe'
|
||||
name: "Jane Doe"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<script lang="ts">
|
||||
import './header.css';
|
||||
import Button from '../Button/Button.svelte';
|
||||
import "./header.css";
|
||||
import Button from "../Button/Button.svelte";
|
||||
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
export let user = null;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
function onLogin(event) {
|
||||
dispatch('login', event);
|
||||
dispatch("login", event);
|
||||
}
|
||||
function onLogout(event) {
|
||||
dispatch('logout', event);
|
||||
dispatch("logout", event);
|
||||
}
|
||||
function onCreateAccount(event) {
|
||||
dispatch('createAccount', event);
|
||||
dispatch("createAccount", event);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@import '../app.css';
|
||||
@import "../app.css";
|
||||
|
||||
.wrapper {
|
||||
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
padding: 15px 20px;
|
||||
display: flex;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import "../app.css";
|
||||
|
||||
export let title: string;
|
||||
export let imgUrl: string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import ImgLoader from './ImgLoader.svelte';
|
||||
import ImgLoader from "./ImgLoader.svelte";
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
|
||||
|
@ -8,9 +8,9 @@ interface Props {
|
|||
class: string;
|
||||
}
|
||||
export default {
|
||||
title: 'Example/ImgLoader',
|
||||
title: "Example/ImgLoader",
|
||||
component: ImgLoader,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: (props: Props) => ({
|
||||
Component: ImgLoader,
|
||||
props
|
||||
|
@ -21,8 +21,8 @@ export default {
|
|||
// More on writing stories with args: https://storybook.js.org/docs/7.0/svelte/writing-stories/args
|
||||
export const Example = {
|
||||
args: {
|
||||
class: 'w-1/2',
|
||||
alt: 'sample',
|
||||
src: 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg/2732px-%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg'
|
||||
class: "w-1/2",
|
||||
alt: "sample",
|
||||
src: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg/2732px-%22_Shot_From_The_Sky%22_Army_Show_1945_Oak_Ridge_%2824971013612%29.jpg"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import Preloader from '../Preloader/Preloader.svelte';
|
||||
import "../app.css";
|
||||
import Preloader from "../Preloader/Preloader.svelte";
|
||||
export let src: string;
|
||||
export let alt = 'loading';
|
||||
export let style = '';
|
||||
export let alt = "loading";
|
||||
export let style = "";
|
||||
|
||||
let clazz = '';
|
||||
let clazz = "";
|
||||
export { clazz as class };
|
||||
|
||||
function preloadImage() {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<script lang="ts">
|
||||
import Button from '../Button/Button.svelte';
|
||||
import ImgLoader from '../ImgLoader/ImgLoader.svelte';
|
||||
import type { ListActionItem } from '../types';
|
||||
import Button from "../Button/Button.svelte";
|
||||
import ImgLoader from "../ImgLoader/ImgLoader.svelte";
|
||||
import type { ListActionItem } from "../types";
|
||||
|
||||
export let title: string;
|
||||
export let mainCtaTitle: string;
|
||||
export let mainCtaLink = '/';
|
||||
export let mainCtaLink = "/";
|
||||
|
||||
export let items: ListActionItem[];
|
||||
export let onSelectItem = (item: ListActionItem) => console.log(item);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script>
|
||||
export let href = '';
|
||||
export let title = '';
|
||||
export let href = "";
|
||||
export let title = "";
|
||||
|
||||
let isBlank = href.includes('http') || href.includes('https');
|
||||
let isBlank = href.includes("http") || href.includes("https");
|
||||
</script>
|
||||
|
||||
<a {href} {title} target={isBlank ? '_blank' : ''} rel=""><slot /></a>
|
||||
<a {href} {title} target={isBlank ? "_blank" : ""} rel=""><slot /></a>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script lang="ts">
|
||||
import SvelteMarkdown from 'svelte-markdown';
|
||||
import Link from './Link.svelte';
|
||||
import SvelteMarkdown from "svelte-markdown";
|
||||
import Link from "./Link.svelte";
|
||||
|
||||
import './styles.css';
|
||||
import "./styles.css";
|
||||
|
||||
export let source: string;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
margin: 0;
|
||||
color: #c9d1d9;
|
||||
background-color: #0d1117;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
|
||||
'Apple Color Emoji', 'Segoe UI Emoji';
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif,
|
||||
"Apple Color Emoji", "Segoe UI Emoji";
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
|
@ -26,7 +26,7 @@
|
|||
.markdown-body h6:hover .anchor .octicon-link:before {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
content: ' ';
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
background-color: currentColor;
|
||||
-webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
|
||||
|
@ -145,43 +145,43 @@
|
|||
line-height: inherit;
|
||||
}
|
||||
|
||||
.markdown-body [type='button'],
|
||||
.markdown-body [type='reset'],
|
||||
.markdown-body [type='submit'] {
|
||||
.markdown-body [type="button"],
|
||||
.markdown-body [type="reset"],
|
||||
.markdown-body [type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
.markdown-body [type='button']::-moz-focus-inner,
|
||||
.markdown-body [type='reset']::-moz-focus-inner,
|
||||
.markdown-body [type='submit']::-moz-focus-inner {
|
||||
.markdown-body [type="button"]::-moz-focus-inner,
|
||||
.markdown-body [type="reset"]::-moz-focus-inner,
|
||||
.markdown-body [type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.markdown-body [type='button']:-moz-focusring,
|
||||
.markdown-body [type='reset']:-moz-focusring,
|
||||
.markdown-body [type='submit']:-moz-focusring {
|
||||
.markdown-body [type="button"]:-moz-focusring,
|
||||
.markdown-body [type="reset"]:-moz-focusring,
|
||||
.markdown-body [type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
.markdown-body [type='checkbox'],
|
||||
.markdown-body [type='radio'] {
|
||||
.markdown-body [type="checkbox"],
|
||||
.markdown-body [type="radio"] {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.markdown-body [type='number']::-webkit-inner-spin-button,
|
||||
.markdown-body [type='number']::-webkit-outer-spin-button {
|
||||
.markdown-body [type="number"]::-webkit-inner-spin-button,
|
||||
.markdown-body [type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.markdown-body [type='search'] {
|
||||
.markdown-body [type="search"] {
|
||||
-webkit-appearance: textfield;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.markdown-body [type='search']::-webkit-search-cancel-button,
|
||||
.markdown-body [type='search']::-webkit-search-decoration {
|
||||
.markdown-body [type="search"]::-webkit-search-cancel-button,
|
||||
.markdown-body [type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
|
@ -201,13 +201,13 @@
|
|||
|
||||
.markdown-body hr::before {
|
||||
display: table;
|
||||
content: '';
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body hr::after {
|
||||
display: table;
|
||||
clear: both;
|
||||
content: '';
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body table {
|
||||
|
@ -480,7 +480,7 @@
|
|||
}
|
||||
|
||||
.markdown-body g-emoji {
|
||||
font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-size: 1em;
|
||||
font-style: normal !important;
|
||||
font-weight: 400;
|
||||
|
@ -495,13 +495,13 @@
|
|||
|
||||
.markdown-body::before {
|
||||
display: table;
|
||||
content: '';
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body::after {
|
||||
display: table;
|
||||
clear: both;
|
||||
content: '';
|
||||
content: "";
|
||||
}
|
||||
|
||||
.markdown-body > *:first-child {
|
||||
|
@ -553,11 +553,11 @@
|
|||
}
|
||||
|
||||
.markdown-body sup > a::before {
|
||||
content: '[';
|
||||
content: "[";
|
||||
}
|
||||
|
||||
.markdown-body sup > a::after {
|
||||
content: ']';
|
||||
content: "]";
|
||||
}
|
||||
|
||||
.markdown-body h1 .octicon-link,
|
||||
|
@ -611,15 +611,15 @@
|
|||
list-style-type: none;
|
||||
}
|
||||
|
||||
.markdown-body ol[type='1'] {
|
||||
.markdown-body ol[type="1"] {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
.markdown-body ol[type='a'] {
|
||||
.markdown-body ol[type="a"] {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
|
||||
.markdown-body ol[type='i'] {
|
||||
.markdown-body ol[type="i"] {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
|
||||
|
@ -683,11 +683,11 @@
|
|||
background-color: transparent;
|
||||
}
|
||||
|
||||
.markdown-body img[align='right'] {
|
||||
.markdown-body img[align="right"] {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.markdown-body img[align='left'] {
|
||||
.markdown-body img[align="left"] {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
|
@ -896,7 +896,7 @@
|
|||
bottom: -8px;
|
||||
left: -24px;
|
||||
pointer-events: none;
|
||||
content: '';
|
||||
content: "";
|
||||
border: 2px solid #1f6feb;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
import MiniPackageCard from './MiniPackageCard.svelte';
|
||||
import type { Package } from '../types';
|
||||
import MiniPackageCard from "./MiniPackageCard.svelte";
|
||||
import type { Package } from "../types";
|
||||
|
||||
const SamplePkg: Package = {
|
||||
slug: 'mesonbuild_com',
|
||||
homepage: 'https://mesonbuild.com',
|
||||
name: 'mesonbuild.com',
|
||||
version: '0.63.3',
|
||||
last_modified: '2022-10-06T15:45:08.000Z',
|
||||
full_name: 'mesonbuild.com',
|
||||
slug: "mesonbuild_com",
|
||||
homepage: "https://mesonbuild.com",
|
||||
name: "mesonbuild.com",
|
||||
version: "0.63.3",
|
||||
last_modified: "2022-10-06T15:45:08.000Z",
|
||||
full_name: "mesonbuild.com",
|
||||
dl_count: 270745,
|
||||
thumb_image_name: 'mesonbuild_com_option 1.jpg ',
|
||||
maintainer: 'neilm',
|
||||
desc: 'Fast and user friendly build system',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/mesonbuild_com.jpg',
|
||||
thumb_image_name: "mesonbuild_com_option 1.jpg ",
|
||||
maintainer: "neilm",
|
||||
desc: "Fast and user friendly build system",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/mesonbuild_com.jpg",
|
||||
installs: 0,
|
||||
bottles: 23
|
||||
};
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
export default {
|
||||
title: 'Example/MiniPackageCard',
|
||||
title: "Example/MiniPackageCard",
|
||||
component: MiniPackageCard,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: ({ pkg, link }: { pkg: Package; link: string }) => ({
|
||||
Component: MiniPackageCard,
|
||||
props: { pkg, link }
|
||||
}),
|
||||
argTypes: {
|
||||
pkg: {
|
||||
name: 'pkg',
|
||||
description: 'type Package'
|
||||
name: "pkg",
|
||||
description: "type Package"
|
||||
},
|
||||
link: {
|
||||
name: 'link'
|
||||
name: "link"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -41,6 +41,6 @@ export default {
|
|||
export const Example = {
|
||||
args: {
|
||||
pkg: SamplePkg,
|
||||
link: '#'
|
||||
link: "#"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import type { Package } from '../types';
|
||||
import "../app.css";
|
||||
import type { Package } from "../types";
|
||||
|
||||
import ImgLoader from '../ImgLoader/ImgLoader.svelte';
|
||||
import ImgLoader from "../ImgLoader/ImgLoader.svelte";
|
||||
|
||||
export let pkg: Package;
|
||||
export let ctaLabel: string;
|
||||
export let link = '';
|
||||
export let link = "";
|
||||
|
||||
export let onClickCTA = () => {
|
||||
console.log('do nothing');
|
||||
console.log("do nothing");
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
|||
<figure class="relative w-24">
|
||||
<ImgLoader
|
||||
class="pkg-image object-contain"
|
||||
src={!pkg.thumb_image_url.includes('https://tea.xyz')
|
||||
? 'https://tea.xyz/Images/package-thumb-nolabel4.jpg'
|
||||
src={!pkg.thumb_image_url.includes("https://tea.xyz")
|
||||
? "https://tea.xyz/Images/package-thumb-nolabel4.jpg"
|
||||
: pkg.thumb_image_url}
|
||||
alt={pkg.name}
|
||||
/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<p>
|
||||
<span class="text-xs text-gray"
|
||||
>V {pkg.version}
|
||||
{pkg?.bottles?.length ? `| ${pkg.bottles.length} bottles` : ''}</span
|
||||
{pkg?.bottles?.length ? `| ${pkg.bottles.length} bottles` : ""}</span
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
import PackageCard from './PackageCard.svelte';
|
||||
import type { Package } from '../types';
|
||||
import PackageCard from "./PackageCard.svelte";
|
||||
import type { Package } from "../types";
|
||||
|
||||
const SamplePkg: Package = {
|
||||
slug: 'mesonbuild_com',
|
||||
homepage: 'https://mesonbuild.com',
|
||||
name: 'mesonbuild.com',
|
||||
version: '0.63.3',
|
||||
last_modified: '2022-10-06T15:45:08.000Z',
|
||||
full_name: 'mesonbuild.com',
|
||||
slug: "mesonbuild_com",
|
||||
homepage: "https://mesonbuild.com",
|
||||
name: "mesonbuild.com",
|
||||
version: "0.63.3",
|
||||
last_modified: "2022-10-06T15:45:08.000Z",
|
||||
full_name: "mesonbuild.com",
|
||||
dl_count: 270745,
|
||||
thumb_image_name: 'mesonbuild_com_option 1.jpg ',
|
||||
maintainer: '',
|
||||
desc: 'Fast and user friendly build system',
|
||||
thumb_image_url: 'https://tea.xyz/Images/packages/mesonbuild_com.jpg',
|
||||
thumb_image_name: "mesonbuild_com_option 1.jpg ",
|
||||
maintainer: "",
|
||||
desc: "Fast and user friendly build system",
|
||||
thumb_image_url: "https://tea.xyz/Images/packages/mesonbuild_com.jpg",
|
||||
installs: 0
|
||||
};
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
export default {
|
||||
title: 'Example/PackageCard',
|
||||
title: "Example/PackageCard",
|
||||
component: PackageCard,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: ({ pkg, link }: { pkg: Package; link: string }) => ({
|
||||
Component: PackageCard,
|
||||
props: { pkg, link }
|
||||
}),
|
||||
argTypes: {
|
||||
pkg: {
|
||||
name: 'pkg',
|
||||
description: 'type Package'
|
||||
name: "pkg",
|
||||
description: "type Package"
|
||||
},
|
||||
link: {
|
||||
name: 'link'
|
||||
name: "link"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -40,6 +40,6 @@ export default {
|
|||
export const Example = {
|
||||
args: {
|
||||
pkg: SamplePkg,
|
||||
link: '#'
|
||||
link: "#"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import type { Package } from '../types';
|
||||
import ImgLoader from '../ImgLoader/ImgLoader.svelte';
|
||||
import "../app.css";
|
||||
import type { Package } from "../types";
|
||||
import ImgLoader from "../ImgLoader/ImgLoader.svelte";
|
||||
|
||||
export let pkg: Package;
|
||||
export let link: string;
|
||||
export let ctaLabel: string;
|
||||
|
||||
export let onClickCTA = () => {
|
||||
console.log('do nothing');
|
||||
console.log("do nothing");
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
|||
<figure>
|
||||
<ImgLoader
|
||||
class="pkg-image"
|
||||
src={!pkg.thumb_image_url.includes('https://tea.xyz')
|
||||
? 'https://tea.xyz/Images/package-thumb-nolabel4.jpg'
|
||||
src={!pkg.thumb_image_url.includes("https://tea.xyz")
|
||||
? "https://tea.xyz/Images/package-thumb-nolabel4.jpg"
|
||||
: pkg.thumb_image_url}
|
||||
alt={pkg.name}
|
||||
/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import type { Package } from '../types';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import type { Package } from "../types";
|
||||
import dayjs from "dayjs";
|
||||
import relativeTime from "dayjs/plugin/relativeTime";
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
|
@ -9,17 +9,17 @@
|
|||
|
||||
const computeFileSize = (bytes: number): string => {
|
||||
let n: number = bytes;
|
||||
let unit = 'bytes';
|
||||
let unit = "bytes";
|
||||
let divisor = 1;
|
||||
|
||||
if (n > 1024 ** 3) {
|
||||
unit = 'GB';
|
||||
unit = "GB";
|
||||
divisor = 1024 ** 3;
|
||||
} else if (n > 1024 ** 2) {
|
||||
unit = 'MB';
|
||||
unit = "MB";
|
||||
divisor = 1024 ** 2;
|
||||
} else if (n > 1024) {
|
||||
unit = 'KB';
|
||||
unit = "KB";
|
||||
divisor = 1024;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import Prism from '@magidoc/plugin-svelte-prismjs';
|
||||
import Prism from "@magidoc/plugin-svelte-prismjs";
|
||||
export let text: string;
|
||||
export let language = 'shell';
|
||||
export let language = "shell";
|
||||
</script>
|
||||
|
||||
<article class="py-1 text-sm font-thin">
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import { onMount } from 'svelte';
|
||||
import type { Snippet, Tab } from '../types';
|
||||
import Tabs from '../Tabs/Tabs.svelte';
|
||||
import Code from './Code.svelte';
|
||||
import "../app.css";
|
||||
import { onMount } from "svelte";
|
||||
import type { Snippet, Tab } from "../types";
|
||||
import Tabs from "../Tabs/Tabs.svelte";
|
||||
import Code from "./Code.svelte";
|
||||
|
||||
export let snippet: Snippet;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
</script>
|
||||
|
||||
<header class="flex items-center gap-4 px-4">
|
||||
<button class={`${active ? 'rotate-90' : 'hover:rorate-90'}`} on:click={() => (active = !active)}>
|
||||
<button class={`${active ? "rotate-90" : "hover:rorate-90"}`} on:click={() => (active = !active)}>
|
||||
<i class="icon-enter-arrow" />
|
||||
</button>
|
||||
<figure class="h-8 w-8 overflow-clip rounded-full bg-gray">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { snippets } from './sample';
|
||||
import PackageSnippet from './PackageSnippet.svelte';
|
||||
import { snippets } from "./sample";
|
||||
import PackageSnippet from "./PackageSnippet.svelte";
|
||||
</script>
|
||||
|
||||
<ul class="bg-black">
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
import type { Snippet } from '../types';
|
||||
import type { Snippet } from "../types";
|
||||
|
||||
export const snippets: Snippet[] = [
|
||||
{
|
||||
snippet_id: 'a1',
|
||||
snippet_id: "a1",
|
||||
created_at: new Date(),
|
||||
user: 'xxxavier',
|
||||
avatar_url: '/images/bored-ape.png',
|
||||
user: "xxxavier",
|
||||
avatar_url: "/images/bored-ape.png",
|
||||
stars: 123,
|
||||
files: [
|
||||
{
|
||||
name: 'sample.js',
|
||||
language: 'javscript',
|
||||
name: "sample.js",
|
||||
language: "javscript",
|
||||
data: `import name from './name';
|
||||
console.log('hello world');`
|
||||
},
|
||||
{
|
||||
name: 'name.js',
|
||||
language: 'javscript',
|
||||
name: "name.js",
|
||||
language: "javscript",
|
||||
data: `export const name = 'onamaiwa';`
|
||||
}
|
||||
],
|
||||
forks: [],
|
||||
comments: [
|
||||
{
|
||||
user: 'denise',
|
||||
comment: 'noice!'
|
||||
user: "denise",
|
||||
comment: "noice!"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
snippet_id: 'a2',
|
||||
snippet_id: "a2",
|
||||
created_at: new Date(),
|
||||
user: 'aaaron',
|
||||
avatar_url: '/images/bored-ape.png',
|
||||
user: "aaaron",
|
||||
avatar_url: "/images/bored-ape.png",
|
||||
stars: 3,
|
||||
files: [
|
||||
{
|
||||
name: 'example.py',
|
||||
language: 'python',
|
||||
name: "example.py",
|
||||
language: "python",
|
||||
data: `import name from './name';
|
||||
console.log('hello world');`
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ console.log('hello world');`
|
|||
forks: [],
|
||||
comments: [
|
||||
{
|
||||
user: 'denise',
|
||||
comment: 'noice!'
|
||||
user: "denise",
|
||||
comment: "noice!"
|
||||
},
|
||||
{
|
||||
user: 'denice',
|
||||
comment: 'doesnt work!'
|
||||
user: "denice",
|
||||
comment: "doesnt work!"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import PanelHeader from './PanelHeader.svelte';
|
||||
import PanelHeader from "./PanelHeader.svelte";
|
||||
|
||||
export default {
|
||||
title: 'Example/PanelHeader',
|
||||
title: "Example/PanelHeader",
|
||||
component: PanelHeader,
|
||||
render: (props) => ({
|
||||
Component: PanelHeader,
|
||||
|
@ -12,8 +12,8 @@ export default {
|
|||
// More on interaction testing: https://storybook.js.org/docs/7.0/svelte/writing-tests/interaction-testing
|
||||
export const Example = {
|
||||
args: {
|
||||
title: 'Open-Source News',
|
||||
ctaLabel: 'Read More News >',
|
||||
ctaLink: '/'
|
||||
title: "Open-Source News",
|
||||
ctaLabel: "Read More News >",
|
||||
ctaLink: "/"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Posts from './Posts.svelte';
|
||||
import Posts from "./Posts.svelte";
|
||||
|
||||
export default {
|
||||
title: 'Example/Posts',
|
||||
title: "Example/Posts",
|
||||
component: Posts,
|
||||
render: ({ posts }) => ({
|
||||
Component: Posts,
|
||||
|
@ -16,17 +16,17 @@ export const Example = {
|
|||
args: {
|
||||
posts: [
|
||||
{
|
||||
airtable_record_id: 'a',
|
||||
link: 'https://google.com',
|
||||
title: 'Tea Inc releases game changing api!',
|
||||
sub_title: 'lorem ipsum dolor sit amet',
|
||||
short_description: 'lorem ipsum dolor sit amet',
|
||||
thumb_image_url: '/images/bored-ape.png',
|
||||
thumb_image_name: 'borred-api.png',
|
||||
airtable_record_id: "a",
|
||||
link: "https://google.com",
|
||||
title: "Tea Inc releases game changing api!",
|
||||
sub_title: "lorem ipsum dolor sit amet",
|
||||
short_description: "lorem ipsum dolor sit amet",
|
||||
thumb_image_url: "/images/bored-ape.png",
|
||||
thumb_image_name: "borred-api.png",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
published_at: new Date(),
|
||||
tags: ['news']
|
||||
tags: ["news"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import type { AirtablePost } from '../types';
|
||||
import "../app.css";
|
||||
import type { AirtablePost } from "../types";
|
||||
|
||||
export let linkTarget = '';
|
||||
export let linkTarget = "";
|
||||
export let posts: AirtablePost[] = [];
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import Preloader from './Preloader.svelte';
|
||||
import Preloader from "./Preloader.svelte";
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
export default {
|
||||
title: 'Example/Preloader',
|
||||
title: "Example/Preloader",
|
||||
component: Preloader,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: () => ({
|
||||
Component: Preloader
|
||||
})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import "../app.css";
|
||||
// TODO: add types of preloader here
|
||||
// export let type: EnumPreload = 'logo-pulse';
|
||||
</script>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import ReviewCard from './ReviewCard.svelte';
|
||||
import ReviewCard from "./ReviewCard.svelte";
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
|
||||
export default {
|
||||
title: 'Example/ReviewCard',
|
||||
title: "Example/ReviewCard",
|
||||
component: ReviewCard,
|
||||
tags: ['docsPage'],
|
||||
tags: ["docsPage"],
|
||||
render: ({ review }) => ({
|
||||
Component: ReviewCard,
|
||||
props: { review }
|
||||
}),
|
||||
argTypes: {
|
||||
review: {
|
||||
name: 'review',
|
||||
description: 'this is type Review'
|
||||
name: "review",
|
||||
description: "this is type Review"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -21,9 +21,9 @@ export default {
|
|||
export const Example = {
|
||||
args: {
|
||||
review: {
|
||||
title: 'installing tea',
|
||||
title: "installing tea",
|
||||
comment:
|
||||
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptas, voluptatum molestiae esse quisquam earum debitis.',
|
||||
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptas, voluptatum molestiae esse quisquam earum debitis.",
|
||||
rating: 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import type { Review } from '../types';
|
||||
import "../app.css";
|
||||
import type { Review } from "../types";
|
||||
|
||||
export let review: Review;
|
||||
|
||||
const getStarType = () => {
|
||||
let star = 'full';
|
||||
let star = "full";
|
||||
if (review.rating < 3) {
|
||||
star = 'empty';
|
||||
star = "empty";
|
||||
} else if (review.rating < 4) {
|
||||
star = 'half';
|
||||
star = "half";
|
||||
}
|
||||
return `icon-star-${star}`;
|
||||
};
|
||||
|
||||
const getStarLabel = () => {
|
||||
let label = 'DELIGHTFUL';
|
||||
let label = "DELIGHTFUL";
|
||||
if (review.rating < 3) {
|
||||
label = 'NOT DELIGHTFUL';
|
||||
label = "NOT DELIGHTFUL";
|
||||
} else if (review.rating < 4) {
|
||||
label = 'DELIGHTFUL WITH NOTES';
|
||||
label = "DELIGHTFUL WITH NOTES";
|
||||
}
|
||||
return label;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import SearchInput from './SearchInput.svelte';
|
||||
import SearchInput from "./SearchInput.svelte";
|
||||
|
||||
export default {
|
||||
title: 'Example/SearchInput',
|
||||
title: "Example/SearchInput",
|
||||
component: SearchInput,
|
||||
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/svelte/writing-docs/docs-page
|
||||
tags: [],
|
||||
|
@ -23,7 +23,7 @@ export default {
|
|||
export const Small = {
|
||||
args: {
|
||||
user: {
|
||||
name: 'Jane Doe'
|
||||
name: "Jane Doe"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import "../app.css";
|
||||
|
||||
let clazz = '';
|
||||
let clazz = "";
|
||||
export { clazz as class };
|
||||
export let size: 'small' | 'medium' | 'large' = 'small';
|
||||
export let size: "small" | "medium" | "large" = "small";
|
||||
export let onSearch: (text: string) => void;
|
||||
export let placeholder = 'search_';
|
||||
export let placeholder = "search_";
|
||||
|
||||
let timer: NodeJS.Timeout;
|
||||
const onChange = (e: KeyboardEvent) => {
|
||||
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
|
||||
section input {
|
||||
font-family: 'pp-neue-machina', sans-serif;
|
||||
font-family: "pp-neue-machina", sans-serif;
|
||||
color: #00ffd0;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: -5px;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import "../app.css";
|
||||
|
||||
export let rating = 0;
|
||||
export let maxRating = 5;
|
||||
|
@ -9,11 +9,11 @@
|
|||
const mod1 = rating % 1;
|
||||
|
||||
if (i < rating) {
|
||||
stars.push('icon-star-full');
|
||||
stars.push("icon-star-full");
|
||||
} else if (mod1 >= 0.5) {
|
||||
stars.push('icon-star-half');
|
||||
stars.push("icon-star-half");
|
||||
} else {
|
||||
stars.push('icon-star-empty');
|
||||
stars.push("icon-star-empty");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import StarRating from './StarRating.svelte';
|
||||
import StarRating from "./StarRating.svelte";
|
||||
|
||||
export default {
|
||||
title: 'Example/StarRating',
|
||||
title: "Example/StarRating",
|
||||
component: StarRating,
|
||||
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/svelte/writing-docs/docs-page
|
||||
tags: [],
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<script lang="ts">
|
||||
import type { Tab } from '../types';
|
||||
import { afterUpdate } from 'svelte';
|
||||
import type { Tab } from "../types";
|
||||
import { afterUpdate } from "svelte";
|
||||
|
||||
let clazz = '';
|
||||
let clazz = "";
|
||||
|
||||
export { clazz as class };
|
||||
|
||||
import Button from '../Button/Button.svelte';
|
||||
import Button from "../Button/Button.svelte";
|
||||
|
||||
export let tabs: Tab[] = [];
|
||||
|
||||
|
@ -19,12 +19,12 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<section class={`relative h-auto border border-gray ${clazz || ''}`}>
|
||||
<section class={`relative h-auto border border-gray ${clazz || ""}`}>
|
||||
<menu class="flex border border-gray">
|
||||
{#each tabs as tab}
|
||||
<div class="border border-y-0 border-l-0 border-gray text-white">
|
||||
<Button onClick={() => (active = tab.label)}>
|
||||
<span class={tab.label === active ? 'text-white' : ''}>{tab.label}</span>
|
||||
<span class={tab.label === active ? "text-white" : ""}>{tab.label}</span>
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
@tailwind utilities;
|
||||
|
||||
@font-face {
|
||||
font-family: 'pp-neue-machina';
|
||||
src: url('../static/fonts/PPNeueMachina-InktrapLight.woff');
|
||||
font-family: "pp-neue-machina";
|
||||
src: url("../static/fonts/PPNeueMachina-InktrapLight.woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'sono';
|
||||
src: url('../static/fonts/Sono-Light.woff2');
|
||||
font-family: "sono";
|
||||
src: url("../static/fonts/Sono-Light.woff2");
|
||||
}
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/* tea-icons */
|
||||
@font-face {
|
||||
font-family: 'tea-icons';
|
||||
src: url('fonts/tea-icons.eot');
|
||||
src: url('fonts/tea-icons.eot?#iefix') format('embedded-opentype'),
|
||||
url('fonts/tea-icons.woff') format('woff'), url('fonts/tea-icons.ttf') format('truetype'),
|
||||
url('fonts/tea-icons.svg#tea-icons') format('svg');
|
||||
font-family: "tea-icons";
|
||||
src: url("fonts/tea-icons.eot");
|
||||
src: url("fonts/tea-icons.eot?#iefix") format("embedded-opentype"),
|
||||
url("fonts/tea-icons.woff") format("woff"), url("fonts/tea-icons.ttf") format("truetype"),
|
||||
url("fonts/tea-icons.svg#tea-icons") format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
[data-icon]:before {
|
||||
font-family: 'tea-icons' !important;
|
||||
font-family: "tea-icons" !important;
|
||||
content: attr(data-icon);
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
|
@ -24,9 +24,9 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
[class^='icon-']:before,
|
||||
[class*=' icon-']:before {
|
||||
font-family: 'tea-icons' !important;
|
||||
[class^="icon-"]:before,
|
||||
[class*=" icon-"]:before {
|
||||
font-family: "tea-icons" !important;
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
font-variant: normal !important;
|
||||
|
@ -38,77 +38,77 @@
|
|||
}
|
||||
|
||||
.icon-discord:before {
|
||||
content: '\61';
|
||||
content: "\61";
|
||||
}
|
||||
.icon-download-arrow:before {
|
||||
content: '\62';
|
||||
content: "\62";
|
||||
}
|
||||
.icon-enter-arrow:before {
|
||||
content: '\63';
|
||||
content: "\63";
|
||||
}
|
||||
.icon-github:before {
|
||||
content: '\64';
|
||||
content: "\64";
|
||||
}
|
||||
.icon-instagram:before {
|
||||
content: '\65';
|
||||
content: "\65";
|
||||
}
|
||||
.icon-reddit:before {
|
||||
content: '\66';
|
||||
content: "\66";
|
||||
}
|
||||
.icon-right-arrow:before {
|
||||
content: '\67';
|
||||
content: "\67";
|
||||
}
|
||||
.icon-telegram:before {
|
||||
content: '\68';
|
||||
content: "\68";
|
||||
}
|
||||
.icon-twitter:before {
|
||||
content: '\69';
|
||||
content: "\69";
|
||||
}
|
||||
.icon-tea-circle:before {
|
||||
content: '\6b';
|
||||
content: "\6b";
|
||||
}
|
||||
.icon-clipboard:before {
|
||||
content: '\6c';
|
||||
content: "\6c";
|
||||
}
|
||||
.icon-tea-checkmark:before {
|
||||
content: '\6d';
|
||||
content: "\6d";
|
||||
}
|
||||
.icon-pattern-random-21:before {
|
||||
content: '\6e';
|
||||
content: "\6e";
|
||||
}
|
||||
.icon-pattern-random-15:before {
|
||||
content: '\6f';
|
||||
content: "\6f";
|
||||
}
|
||||
.icon-pattern-random-19:before {
|
||||
content: '\70';
|
||||
content: "\70";
|
||||
}
|
||||
.icon-click-copy-icon:before {
|
||||
content: '\71';
|
||||
content: "\71";
|
||||
}
|
||||
.icon-star-full:before {
|
||||
content: '\73';
|
||||
content: "\73";
|
||||
}
|
||||
.icon-star-half:before {
|
||||
content: '\74';
|
||||
content: "\74";
|
||||
}
|
||||
.icon-star-empty:before {
|
||||
content: '\75';
|
||||
content: "\75";
|
||||
}
|
||||
.icon-tea-logo-iconasset-1:before {
|
||||
content: '\6a';
|
||||
content: "\6a";
|
||||
}
|
||||
.icon-search-icon:before {
|
||||
content: '\72';
|
||||
content: "\72";
|
||||
}
|
||||
.icon-filter:before {
|
||||
content: '\76';
|
||||
content: "\76";
|
||||
}
|
||||
.icon-upload:before {
|
||||
content: '\77';
|
||||
content: "\77";
|
||||
}
|
||||
.icon-share:before {
|
||||
content: '\78';
|
||||
content: "\78";
|
||||
}
|
||||
.icon-calendar:before {
|
||||
content: '\79';
|
||||
content: "\79";
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { ComponentType } from 'svelte';
|
||||
import type { ComponentType } from "svelte";
|
||||
export interface Review {
|
||||
title: string;
|
||||
comment: string;
|
||||
|
@ -99,7 +99,7 @@ export type Snippet = {
|
|||
}[];
|
||||
};
|
||||
|
||||
export type Contributor = Pick<Developer, 'avatar_url' | 'login' | 'name'> & {
|
||||
export type Contributor = Pick<Developer, "avatar_url" | "login" | "name"> & {
|
||||
github_id: number;
|
||||
developer_id?: string;
|
||||
contributions: number;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import adapter from '@sveltejs/adapter-auto';
|
||||
import preprocess from 'svelte-preprocess';
|
||||
import adapter from "@sveltejs/adapter-auto";
|
||||
import preprocess from "svelte-preprocess";
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/** @type {import('tailwindcss').Config} */
|
||||
const green = '#00ffd0';
|
||||
const black = '#1a1a1a';
|
||||
const white = '#fff';
|
||||
const gray = '#949494';
|
||||
const purple = '#8000FF';
|
||||
const green = "#00ffd0";
|
||||
const black = "#1a1a1a";
|
||||
const white = "#fff";
|
||||
const gray = "#949494";
|
||||
const purple = "#8000FF";
|
||||
|
||||
module.exports = {
|
||||
content: ['./src/**/*.{html,js,svelte,ts}'],
|
||||
content: ["./src/**/*.{html,js,svelte,ts}"],
|
||||
theme: {
|
||||
colors: {
|
||||
primary: green,
|
||||
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
green,
|
||||
purple: {
|
||||
700: purple,
|
||||
900: '#B076EC'
|
||||
900: "#B076EC"
|
||||
},
|
||||
black,
|
||||
white,
|
||||
|
@ -22,20 +22,20 @@ module.exports = {
|
|||
},
|
||||
extend: {
|
||||
fontFamily: {
|
||||
sono: ['sono', 'sans-serif'],
|
||||
machina: ['pp-neue-machina', 'sans-serif']
|
||||
sono: ["sono", "sans-serif"],
|
||||
machina: ["pp-neue-machina", "sans-serif"]
|
||||
},
|
||||
typography: {
|
||||
excerpt: {
|
||||
css: {
|
||||
p: {
|
||||
fontFamily: 'font-machina',
|
||||
fontSize: 'font-2xl'
|
||||
fontFamily: "font-machina",
|
||||
fontSize: "font-2xl"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: [require('@tailwindcss/line-clamp')]
|
||||
plugins: [require("@tailwindcss/line-clamp")]
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import type { UserConfig } from 'vite';
|
||||
import { sveltekit } from "@sveltejs/kit/vite";
|
||||
import type { UserConfig } from "vite";
|
||||
|
||||
const config: UserConfig = {
|
||||
plugins: [sveltekit()]
|
||||
|
|
Loading…
Reference in a new issue