Move COMPONENT_API to src/generated

This commit is contained in:
venashial
2022-03-30 14:05:15 -07:00
parent 425c8cd1d3
commit cbc85ca98f
6 changed files with 17 additions and 8 deletions

View File

@@ -1,4 +1,6 @@
<script lang="ts">
// TODO: Make square icon `md` more rounded
import { onMount } from 'svelte'
import { classCombine } from '$lib/utils/classCombine'

View File

@@ -1,6 +1,7 @@
<script lang="ts">
// TODO: sizes
// TODO: icon only buttons should have uniform padding
// TODO: Could be a class
import { classCombine } from '$lib/utils/classCombine'

View File

@@ -1,4 +1,6 @@
<script lang="ts">
// TODO: Add fade out styling on top and bottom
import Checkbox from './Checkbox.svelte'
import type { SvelteComponent } from 'svelte'
import VirtualList from 'svelte-tiny-virtual-list'

View File

@@ -1,8 +1,9 @@
<script lang="ts">
import IconPencil from 'virtual:icons/heroicons-outline/pencil'
import { page } from '$app/stores'
import COMPONENT_API from '../../../generated/COMPONENT_API.json'
export let fileName = $page.url.pathname.substring($page.url.pathname.lastIndexOf('/') + 1)
export let fileName = $page.url.pathname.substring($page.url.pathname.lastIndexOf('/') + 1).replace('.html', '')
export let title = ''
if (!title) title = fileName
@@ -14,7 +15,7 @@
if (import.meta.env.DEV) {
import(`../../../lib/components/${title}.svelte?raw&sveld`).then(output => api = output.default)
} else {
fetch('/_app/COMPONENT_API.json').then(res => res.json()).then(output => api = output[`${title}.svelte`])
api = COMPONENT_API[`${title}.svelte`]
}
}
</script>