This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { replaceState } from '$app/navigation'; | |
import { page } from '$app/state'; | |
import { tick } from 'svelte'; | |
export function box<T>(getter: () => T, setter?: (value: T) => void) { | |
let derived_val = $derived(getter()); | |
$effect(() => { | |
setter?.($state.snapshot(derived_val) as T); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class EventEmitter { | |
#events: Map<string, Set<Function>> = new Map(); | |
on(event: string, callback: Function): void { | |
let callbacks = this.#events.get(event); | |
if (!callbacks) { | |
callbacks = new Set(); | |
this.#events.set(event, callbacks); | |
} | |
callbacks.add(callback); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { parse, type Literal } from 'acorn'; | |
import { type Node } from 'estree-walker'; | |
import { walk } from 'zimmerframe'; | |
const ast = parse(output, { | |
ecmaVersion: 2022, | |
sourceType: 'module', | |
sourceFile: full_path, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"3.0.0": "784.72kb", | |
"3.0.0-alpha1": "763.83kb", | |
"3.0.0-alpha10": "789.48kb", | |
"3.0.0-alpha11": "789.48kb", | |
"3.0.0-alpha12": "789.48kb", | |
"3.0.0-alpha13": "788.25kb", | |
"3.0.0-alpha14": "787.04kb", | |
"3.0.0-alpha15": "787.04kb", | |
"3.0.0-alpha16": "787.03kb", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ledger { | |
users = new Set<string>(); // Holds unique users | |
balances: Record<string, number> = {}; // Balance of each user | |
transactions: Record<`${string}:${string}`, number> = {}; // person1:person2 -> amount | |
simplified = false; | |
#results: Record< | |
'simplified' | 'non_simplified', | |
{ | |
payer_user_id: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FormError } from '$lib/errors.js'; | |
import { db } from '$lib/server/db.js'; | |
import { GROUP_QUERY } from '$lib/server/queries/group.query.js'; | |
import { | |
expenses_table, | |
group_members_table, | |
ledger_table, | |
users_table, | |
} from '$lib/server/schema.js'; | |
import { listify_names, sum_arr } from '$lib/utils.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ts-check | |
import { dataToEsm } from '@rollup/pluginutils'; | |
import fs from 'fs'; | |
import lightningcss from 'lightningcss'; | |
import { resolve } from 'path'; | |
/** @type {() => import('rollup').Plugin} */ | |
export const processCSS = () => { | |
/** @type {Map<string, import('lightningcss').TransformResult>} */ | |
const idMap = new Map(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var __create = Object.create; | |
var __defProp = Object.defineProperty; | |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | |
var __getOwnPropNames = Object.getOwnPropertyNames; | |
var __getProtoOf = Object.getPrototypeOf; | |
var __hasOwnProp = Object.prototype.hasOwnProperty; | |
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | |
var __commonJS = (cb, mod) => function __require() { | |
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { createIntervalStore } from './interval.store.ts' | |
// Create interval of 6 seconds | |
const interval = createIntervalStore(6000); | |
$: $interval, doSomething(); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useAtom } from 'jotai'; | |
import { useEffect, useLayoutEffect } from 'preact/hooks'; | |
import { themeAtom } from '__/stores/theme.store'; | |
type Theme = 'light' | 'dark'; | |
// This is needed here | |
let isFirstUpdate = true; | |
const localValue = localStorage.getItem<Theme>('theme:type'); |
NewerOlder