From e3b2edd214e6821fdddedb8026a6c1c625edf042 Mon Sep 17 00:00:00 2001 From: Nulo Date: Tue, 29 Aug 2023 11:05:34 -0300 Subject: [PATCH] format --- package.json | 3 ++- prettier.config.cjs | 2 +- src/app.css | 17 ++++++++++++++++- src/editor/editor.css | 1 - src/editor/keymap.ts | 4 ++-- src/editor/ps-utils.ts | 14 +++++++------- src/editor/schema.ts | 2 +- src/editor/utils.ts | 2 +- src/lib/doc.ts | 2 +- src/lib/lastUpdated.ts | 2 +- src/lib/makeYdocStore.ts | 6 +++--- src/lib/titleStore.js | 2 +- src/lib/worldStorage.ts | 2 +- 13 files changed, 37 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 99dfef9..0ec3595 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "build": "vite build", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json", - "upload": "scp -CrP993 dist/* root@nulo.in:/var/www/beta.schreiben.nulo.ar/" + "upload": "scp -CrP993 dist/* root@nulo.in:/var/www/beta.schreiben.nulo.ar/", + "format": "prettier --write src/" }, "devDependencies": { "@poppanator/sveltekit-svg": "^2.1.2", diff --git a/prettier.config.cjs b/prettier.config.cjs index 1928939..fec4bd1 100644 --- a/prettier.config.cjs +++ b/prettier.config.cjs @@ -1,3 +1,3 @@ module.exports = { - plugins: ["prettier-plugin-tailwindcss", "prettier-plugin-svelte"], + plugins: ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], }; diff --git a/src/app.css b/src/app.css index ef14c83..fdf8bdc 100644 --- a/src/app.css +++ b/src/app.css @@ -3,7 +3,22 @@ @tailwind utilities; :root { - font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + font-family: + Inter, + ui-sans-serif, + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + "Helvetica Neue", + Arial, + "Noto Sans", + sans-serif, + "Apple Color Emoji", + "Segoe UI Emoji", + "Segoe UI Symbol", + "Noto Color Emoji"; font-weight: 400; font-synthesis: none; diff --git a/src/editor/editor.css b/src/editor/editor.css index df7e794..f5178fa 100644 --- a/src/editor/editor.css +++ b/src/editor/editor.css @@ -55,4 +55,3 @@ content: "Descripción: "; color: #666; } - diff --git a/src/editor/keymap.ts b/src/editor/keymap.ts index d55e9f6..0e139ce 100644 --- a/src/editor/keymap.ts +++ b/src/editor/keymap.ts @@ -26,7 +26,7 @@ import { schema } from "./schema"; const backspace = chainCommands( deleteSelection, joinBackward, - selectNodeBackward + selectNodeBackward, ); const del = chainCommands(deleteSelection, joinForward, selectNodeForward); @@ -37,7 +37,7 @@ const pcBaseKeymap = { liftEmptyBlock, // XXX: hack splitListItem(schema.nodes.list_item as any), - splitBlock + splitBlock, ), "Mod-Enter": chainCommands(exitCode, splitBlock), Backspace: backspace, diff --git a/src/editor/ps-utils.ts b/src/editor/ps-utils.ts index 7ef25f7..6583a1a 100644 --- a/src/editor/ps-utils.ts +++ b/src/editor/ps-utils.ts @@ -11,14 +11,14 @@ import type { EditorView } from "prosemirror-view"; export type Command = ( state: EditorState, - dispatch?: EditorView["dispatch"] + dispatch?: EditorView["dispatch"], ) => boolean; // A lot of this is from https://github.com/ueberdosis/tiptap/blob/main/packages/tiptap-commands export function getMarkRange( $pos: ResolvedPos | null = null, - type: MarkType | null = null + type: MarkType | null = null, ) { if (!$pos || !type) { return false; @@ -122,14 +122,14 @@ export function toggleNode( attrs: any, /// es el tipo que se setea si ya es el type querido; probablemente querés /// que sea el type de párrafo - alternateType: NodeType + alternateType: NodeType, ): Command { return chainCommands(setBlockType(type, attrs), setBlockType(alternateType)); } export function commandListener( view: EditorView, - command: Command + command: Command, ): (event: Event) => void { return (event) => { event.preventDefault(); @@ -139,7 +139,7 @@ export function commandListener( export default function findParentNodeClosestToPos( $pos: ResolvedPos, - predicate: (node: ProsemirrorNode) => boolean + predicate: (node: ProsemirrorNode) => boolean, ) { for (let i = $pos.depth; i > 0; i -= 1) { const node = $pos.node(i); @@ -158,7 +158,7 @@ export default function findParentNodeClosestToPos( export function nodeIsActiveFn( type: NodeType, attrs?: any, - checkParents: boolean = false + checkParents: boolean = false, ): (state: EditorState) => boolean { return (state) => { let { $from, to } = state.selection; @@ -196,7 +196,7 @@ export interface MarkMatch { export function getFirstMarkInSelection( state: EditorState, - type: MarkType + type: MarkType, ): MarkMatch | null { const { to, from } = state.selection; diff --git a/src/editor/schema.ts b/src/editor/schema.ts index 003b91a..9568d1f 100644 --- a/src/editor/schema.ts +++ b/src/editor/schema.ts @@ -315,7 +315,7 @@ export const schema = new Schema({ if ( href && /[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test( - href + href, ) ) { return { diff --git a/src/editor/utils.ts b/src/editor/utils.ts index 8669c9e..b3fffc1 100644 --- a/src/editor/utils.ts +++ b/src/editor/utils.ts @@ -9,7 +9,7 @@ interface Props { export function h( tagName: string, props: Props, - children: (Node | string | undefined)[] + children: (Node | string | undefined)[], ): HTMLElement { const el = document.createElement(tagName); if (props.class) { diff --git a/src/lib/doc.ts b/src/lib/doc.ts index f39c6c2..07bea28 100644 --- a/src/lib/doc.ts +++ b/src/lib/doc.ts @@ -25,7 +25,7 @@ export function generateNewWorld(): WorldIdentifier { let worldYCache: { [key: string]: WorldY } = {}; const credsReq = fetch( - "https://nulo.metered.live/api/v1/turn/credentials?apiKey=205de2914a8564e2efa19a7d7f299a95e574" + "https://nulo.metered.live/api/v1/turn/credentials?apiKey=205de2914a8564e2efa19a7d7f299a95e574", ).then((res) => res.json()); export function getWorldY(world: WorldIdentifier): WorldY { diff --git a/src/lib/lastUpdated.ts b/src/lib/lastUpdated.ts index 45f0307..5ac9d8c 100644 --- a/src/lib/lastUpdated.ts +++ b/src/lib/lastUpdated.ts @@ -24,6 +24,6 @@ export function lastUpdated(ydoc: Doc) { } return map; }, - () => observers.forEach(({ y, observer }) => y.unobserveDeep(observer)) + () => observers.forEach(({ y, observer }) => y.unobserveDeep(observer)), )(ydoc); } diff --git a/src/lib/makeYdocStore.ts b/src/lib/makeYdocStore.ts index 7d527f2..ee886cc 100644 --- a/src/lib/makeYdocStore.ts +++ b/src/lib/makeYdocStore.ts @@ -6,9 +6,9 @@ export function makeYdocStore( update: Uint8Array | null, origin: any, ydoc: Doc, - tr: Transaction | null + tr: Transaction | null, ) => T, - unhandler?: () => void + unhandler?: () => void, ) { return (ydoc: Doc): Readable => { // thanks https://github.com/relm-us/svelt-yjs/blob/main/src/types/array.ts @@ -18,7 +18,7 @@ export function makeYdocStore( update: Uint8Array | null, origin: any, ydoc: Doc, - tr: Transaction | null + tr: Transaction | null, ) { run(handler(update, origin, ydoc, tr)); } diff --git a/src/lib/titleStore.js b/src/lib/titleStore.js index 012c180..6a5832d 100644 --- a/src/lib/titleStore.js +++ b/src/lib/titleStore.js @@ -27,6 +27,6 @@ export function titleStore(ydoc, id) { return title; }, - () => observer && y?.unobserveDeep(observer) + () => observer && y?.unobserveDeep(observer), )(ydoc); } diff --git a/src/lib/worldStorage.ts b/src/lib/worldStorage.ts index c4662df..e6c52b7 100644 --- a/src/lib/worldStorage.ts +++ b/src/lib/worldStorage.ts @@ -14,7 +14,7 @@ export function loadWorlds(): Promise { } export async function writeWorlds( - callback: (worlds: WorldIdentifier[]) => WorldIdentifier[] + callback: (worlds: WorldIdentifier[]) => WorldIdentifier[], ): Promise { const oldWorlds = await loadWorlds(); const newWorlds = callback(oldWorlds);