This file contains 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 function useI18n(translations) { | |
// return (key, ...args) => { | |
// const value = key.trim().split('.').reduce((obj, k) => obj?.[k], translations) ?? key | |
// return typeof value === 'function' ? value(...args) : value | |
// } | |
// } | |
export function useI18n(t){return(n,...e)=>{const r=n.trim().split('.').reduce(((t,n)=>t?.[n]),t)??n;return'function'==typeof r?r(...e):r}} | |
export const t = (x, y) => useRoute().meta.t(x, y) |
This file contains 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 DOMPurify from 'dompurify' | |
export default defineNuxtPlugin(async (nuxtApp) => { | |
let JSDOM | |
if (import.meta.server) { | |
const { JSDOM: dom } = await import('jsdom') | |
JSDOM = dom | |
} | |
nuxtApp.vueApp.directive('sanitize', { |
This file contains 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
{ | |
"type": "module", | |
"scripts": { | |
"dev": "wrangler dev --port 3000 worker.mjs", | |
"deploy": "wrangler deploy" | |
}, | |
"devDependencies": { | |
"pdfmake": "^0.3.0-beta.8", | |
"wrangler": "^3.63.1" | |
} |
This file contains 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 { createRouter, createWebHistory } from 'vue-router' | |
const routes = [] | |
const router = createRouter({ | |
history: createWebHistory(), | |
routes | |
}) | |
let dbPromise |
This file contains 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 default { | |
install: (app, options) => { | |
let observer | |
const obj = { | |
created(el, binding) { | |
if (options?.observe) { | |
el.setAttribute('elementtiming', binding.arg) | |
observer = new PerformanceObserver(list => { | |
for (const entry of list.getEntries()) { | |
const { identifier, loadTime } = entry |
This file contains 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
{ | |
"scripts": { | |
"test": "vitest" | |
}, | |
"devDependencies": { | |
"vitest": "^0.24.3" | |
} | |
} |
This file contains 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
function createApi(baseUrl, defaults = {}) { | |
const callable = () => {} | |
callable.url = baseUrl | |
return new Proxy(callable, { | |
get({ url }, key) { | |
const method = key.toUpperCase() | |
if (['GET', 'POST', 'PUT', 'DELETE', 'PATCH'].includes(method)) { | |
return (data, overrides = {}) => { | |
const payload = { method, ...defaults, ...overrides } | |
switch (method) { |
This file contains 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 { createApp } from './dist/app.mjs' | |
import { pipeToWebWritable } from 'vue/server-renderer' | |
const prepend = String.raw`<!doctype html> | |
<html lang="en"> | |
<title>Title</title> | |
<div id="app">` | |
const append = String.raw`</div> | |
<script type="importmap"> |
This file contains 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 path from 'node:path' | |
import { loadEnv } from 'vite' | |
export default ({ mode }) => { | |
return { | |
env: Object.assign(process.env, loadEnv(mode, process.cwd())) | |
} | |
} |
This file contains 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 { createServer } from 'node:http' | |
import { createHmac } from 'node:crypto' | |
import { Printer, InMemory, Drawer, Style, Align, Model } from 'escpos-buffer' | |
const { | |
PORT = 3000, | |
HOST = 0, | |
GITHUB_WEBHOOK_SECRET, | |
PRINTER_MODEL = 'TM-T20', | |
PRINTER_COLUMNS = 56 |
NewerOlder