Skip to content

Commit

Permalink
fix: build -d
Browse files Browse the repository at this point in the history
  • Loading branch information
arpowers committed Sep 13, 2024
1 parent 7acb762 commit ccab864
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 99 deletions.
71 changes: 71 additions & 0 deletions @fiction/cards/CardTextPost.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<script lang="ts" setup>
import type { Card } from '@fiction/site/card'
import type { InputModes } from '@fiction/ui/common/XText.vue'
import { getNested, setNested, vue } from '@fiction/core'
import XText from '@fiction/ui/common/XText.vue'
const props = defineProps({
card: { type: Object as vue.PropType<Card>, required: true },
tag: { type: String as vue.PropType<'h1' | 'h2' | 'h3' | 'h4' | 'div' | 'span' | 'p' | 'a'>, default: 'div' },
path: { type: String, required: true },
placeholder: { type: String, default: 'Placeholder' },
fallback: { type: String, default: '' },
animate: { type: [String, Boolean] as vue.PropType<'rise' | 'fade' | boolean>, default: undefined },
mode: { type: String as vue.PropType<InputModes>, default: 'text' },
editKey: { type: [Boolean, String], default: true },
})
const attrs = vue.useAttrs()
const textEl = vue.ref<HTMLElement>()
const data = vue.computed(() => props.card.userConfig.value)
function getNewUserConfig(v: string) {
return setNested({ data: data.value, path: props.path, value: v })
}
function onValue(v: string) {
props.card.userConfig.value = getNewUserConfig(v)
}
function onInput(v: string) {
const userConfig = getNewUserConfig(v)
const cardId = props.card.cardId
props.card?.syncCard({ caller: 'updateUserConfig', cardConfig: { cardId, userConfig } })
}
const value = vue.computed(() => {
return getNested({ path: props.path, data: data.value }) as string
})
const isContentEditable = vue.computed(() => props.card.site?.isEditable.value)
function shouldStopProp(event: MouseEvent) {
if (isContentEditable.value) {
event.stopPropagation()
event.preventDefault()
const cardId = props.card.cardId
props.card?.site?.setActiveCard({ cardId })
}
}
const editOrAnimate = vue.computed(() => props.card.site?.siteMode.value === 'editable' ? false : props.animate)
</script>

<template>
<XText
ref="textEl"
:data-key="path"
v-bind="attrs"
:animate="editOrAnimate"
:tag
:is-editable="isContentEditable"
:edit-key="editKey"
:model-value="value"
:placeholder
:fallback
@click="shouldStopProp($event)"
@update:model-value="onValue($event)"
@input="onInput($event)"
/>
</template>
2 changes: 1 addition & 1 deletion @fiction/cards/magazine/ElMagazine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ vue.onServerPrefetch(async () => {
})
vue.onMounted(async () => {
vue.watch(() => routeSlug.value, async () => {
vue.watch(() => [routeSlug.value, uc.value.posts?.format], async () => {
await load()
}, { immediate: true })
})
Expand Down
4 changes: 2 additions & 2 deletions @fiction/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}
],
"dependencies": {
"@aws-sdk/client-cloudfront": "^3.650.0",
"@aws-sdk/client-s3": "^3.651.0",
"@aws-sdk/client-cloudfront": "^3.651.1",
"@aws-sdk/client-s3": "^3.651.1",
"@egoist/tailwindcss-icons": "^1.8.1",
"@faker-js/faker": "^9.0.0",
"@iconify-json/carbon": "^1.2.1",
Expand Down
4 changes: 2 additions & 2 deletions @fiction/core/plugin-media/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ abstract class MediaQuery extends Query<SaveMediaSettings> {

return result
}
catch (_e) {
catch {
return undefined
}
finally {
Expand Down Expand Up @@ -457,7 +457,7 @@ export class QueryManageMedia extends MediaQuery {
return { status: 'success', data: media }
}

async handleDelete(params: MediaParams & { _action: 'delete' }, meta: EndpointMeta): Promise<EndpointResponse<TableMediaConfig[]>> {
async handleDelete(params: MediaParams & { _action: 'delete' }, _meta: EndpointMeta): Promise<EndpointResponse<TableMediaConfig[]>> {
const { orgId, where } = params

if (!Array.isArray(where)) {
Expand Down
1 change: 0 additions & 1 deletion @fiction/core/utils/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const colorThemeBright = ['red', 'orange', 'amber', 'yellow', 'lime', 'gr
export const colorTheme = ['slate', 'gray', 'zinc', 'neutral', 'stone', 'black', 'white', ...colorThemeBright] as const
export const colorThemeUser = ['theme', 'primary', 'default', 'overlay', 'naked', ...colorTheme] as const

type InvertedColor = `${(typeof colorTheme)[number]}Inverted`
// Create a union type that includes both regular and inverted colors
export type ColorThemeBright = (typeof colorThemeBright)[number]
export type ColorTheme = (typeof colorTheme)[number]
Expand Down
4 changes: 2 additions & 2 deletions @fiction/core/utils/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export function requireIfExists<T = unknown>(mod: string): T | undefined {
if (e.code === 'MODULE_NOT_FOUND') {
// get module missing in error message
// https://stackoverflow.com/a/32808869
const m = e.message.match(/(?<=')(.*?)(?=')/g)
const m = e.message.match(/(?<=').*?(?=')/g)

if (m && !m.includes(mod))
throw error
Expand All @@ -221,7 +221,7 @@ export function resolveIfExists(mod: string): string | undefined {
if (e.code === 'MODULE_NOT_FOUND') {
// get module missing in error message
// https://stackoverflow.com/a/32808869
const m = e.message.match(/(?<=')(.*?)(?=')/g)
const m = e.message.match(/(?<=').*?(?=')/g)

if (m && !m.includes(mod))
throw error
Expand Down
8 changes: 0 additions & 8 deletions @fiction/forms/deck/InputWrap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ const inputComponent = vue.computed(() => uc.value.inputType ? inputs[uc.value.i
const inputEl = vue.ref<HTMLElement>()
const submitEl = vue.ref<HTMLElement>()
function submitCard() {
props.form.nextCard()
}
const layout = vue.computed<CardLayoutMode>(() => {
const conf = props.card.fullConfig.value
const out = conf.layout && conf.media ? conf.layout : 'background'
Expand Down Expand Up @@ -113,10 +109,6 @@ const buttonText = vue.computed(() => {
})
const ic = vue.computed(() => props.form?.activeCard.value)
function handleValidChange(valid: boolean) {
props.form.setCurrentCardValid(valid)
}
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion @fiction/plugins/plugin-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"@fiction/core": "workspace:*",
"@fiction/plugin-unsplash": "workspace:*",
"@pinecone-database/pinecone": "^3.0.3",
"openai": "^4.60.1",
"openai": "^4.61.0",
"tailwindcss": "^3.4.11",
"vue": "^3.5.5"
},
Expand Down
Loading

0 comments on commit ccab864

Please sign in to comment.