Skip to content

Commit

Permalink
Merge branch 'main' into lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mloppie authored Feb 13, 2025
2 parents 9cebf4b + 013b67b commit 6e0a682
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,35 @@ const props = defineProps<{
const emit = defineEmits(['update-item']);
const debouncer = debounce((key: string, value: string = '') => {
emit('update-item', { key, value });
}, 300);
const makeDebouncer = (key: string) =>
debounce((value: string) => {
emit('update-item', { key, value });
}, 300);
const unitExpressionDebouncer = makeDebouncer('unitExpression');
const nameDebouncer = makeDebouncer('name');
const groundingDebouncer = makeDebouncer('grounding');
const descriptionDebouncer = makeDebouncer('description');
const nameText = computed({
get: () => props.name,
set: (newName) => debouncer('name', newName)
set: (newName) => nameDebouncer(newName as string)
});
const unitExpression = computed({
get: () => props.unitExpression,
set: (newUnitExpression) => debouncer('unitExpression', newUnitExpression)
set: (newUnitExpression) => unitExpressionDebouncer(newUnitExpression as string)
});
const descriptionText = computed({
get: () => props.description,
set: (newDescription) => {
debouncer('description', newDescription);
descriptionDebouncer(newDescription as string);
showDescription.value = !!newDescription;
}
});
const showDescription = ref<boolean>(!!descriptionText.value);
const grounding = computed({
get: () => props.grounding,
set: (newGrounding) => debouncer('grounding', newGrounding)
set: (newGrounding) => groundingDebouncer(newGrounding as string)
});
// If we are in preview mode and there is no content, show nothing
Expand Down

0 comments on commit 6e0a682

Please sign in to comment.