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 { SupabaseClient } from "@supabase/supabase-js"; | |
import { GenericSchema } from "@supabase/supabase-js/dist/module/lib/types"; | |
import { supabase } from "/~/data/supabase"; | |
import { defineStore } from "pinia"; | |
export function defineSupaStore<Database, SchemaName extends string & keyof Database, Schema extends GenericSchema, TableName extends string & keyof Schema['Tables']>(supabase: SupabaseClient<Database, SchemaName, Schema>, tableName: TableName) { | |
const table = () => supabase.from(tableName); | |
type Row = Schema['Tables'][TableName]['Row']; | |
type Insert = Schema['Tables'][TableName]['Insert']; |
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
<!-- PARENT --> | |
<script> | |
const editInvoiceModal = Vue.component({ | |
template: () => vue.h('div', { props: }, [{ | |
vue.h('div', { title: '' }, [ | |
]) | |
}]) | |
}); |
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 { defineStore } from 'pinia'; | |
import get from 'deep-access'; | |
import { isDevelopment } from '../media/detect'; | |
export type PluralizeFn = (parts: string[], n: number) => string; | |
export const useI18n = () => { | |
const store = useI18nStore(); | |
const t = (key, params?: Record<string, any>, n?: number) => store.t(key, params, n); | |
const setLocale = (locale: string, { data, pluralizeFn }: { data: Record<string, any>, pluralizeFn?: PluralizeFn }) => { |
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 lang="ts"> | |
import { defineComponent, computed, ref } from '@vue/composition-api'; | |
import Intersect from 'vue-intersect'; | |
import { oneOf } from '~/utils/props'; | |
import { | |
responsifyImageSource, | |
responsifyImageSourceSet, | |
ImageSizeOption, | |
ImageParam, | |
} from '~/utils/img'; |
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 lang="ts"> | |
import { useIntersectionObserver } from "@vueuse/core"; | |
import { ref, nextTick } from "vue"; | |
function onIdle(cb = () => {}) { | |
if ("requestIdleCallback" in window) { | |
window.requestIdleCallback(cb); | |
} else { | |
setTimeout(() => { | |
nextTick(cb); |
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 lang="ts"> | |
import { useIntersectionObserver } from '@vueuse/core'; | |
function onIdle(cb = () => {}) { | |
if ('requestIdleCallback' in window) { | |
window.requestIdleCallback(cb); | |
} else { | |
setTimeout(() => { | |
nextTick(cb); | |
}, 300); |
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 lang="ts"> | |
import { useIntersectionObserver } from '@vueuse/core' | |
export default { | |
setup() { | |
const shouldRender = ref(false); | |
const targetEl = ref(); | |
const { stop } = useIntersectionObserver( | |
targetEl, |
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 lang="ts"> | |
import { nextTick } from 'vue'; | |
export default { | |
setup() { | |
const shouldRender = ref(false); | |
nextTick(() => { | |
shouldRender.value = true; | |
}); | |
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> | |
function searchSpecies(term, options) { | |
return ajax( | |
`https://api.gbif.org/v1/species/search?q=${term}&rank=GENUS`, | |
options | |
); | |
} | |
export default defineComponent({ | |
setup() { |
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> | |
function searchSpecies(term, options) { | |
return ajax( | |
`https://api.gbif.org/v1/species/search?q=${term}&rank=GENUS`, | |
options | |
); | |
} | |
export default defineComponent({ | |
setup() { |
NewerOlder