Skip to content

Commit

Permalink
Merge branch 'main' into pr/KermanX/1972
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Dec 16, 2024
2 parents d09939e + 27e9e74 commit 86b834c
Show file tree
Hide file tree
Showing 9 changed files with 897 additions and 901 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "module",
"version": "0.50.0-beta.10",
"private": true,
"packageManager": "pnpm@9.14.4",
"packageManager": "pnpm@9.15.0",
"engines": {
"node": ">=18.0.0"
},
Expand Down
46 changes: 23 additions & 23 deletions packages/client/composables/useDragElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ export function useDragElementsUpdater(no: number) {
section = type === 'prop'
// eslint-disable-next-line regexp/no-super-linear-backtracking
? section.replace(/<(v-?drag-?\w*)(.*?)(\/)?>/gi, (full, tag, attrs, selfClose = '', index) => {
if (index === idx) {
replaced = true
const posMatch = attrs.match(/pos=".*?"/)
if (!posMatch)
return `<${tag}${ensureSuffix(' ', attrs)}pos="${posStr}"${selfClose}>`
const start = posMatch.index
const end = start + posMatch[0].length
return `<${tag}${attrs.slice(0, start)}pos="${posStr}"${attrs.slice(end)}${selfClose}>`
}
return full
})
if (index === idx) {
replaced = true
const posMatch = attrs.match(/pos=".*?"/)
if (!posMatch)
return `<${tag}${ensureSuffix(' ', attrs)}pos="${posStr}"${selfClose}>`
const start = posMatch.index
const end = start + posMatch[0].length
return `<${tag}${attrs.slice(0, start)}pos="${posStr}"${attrs.slice(end)}${selfClose}>`
}
return full
})
: section.replace(/(?<![</\w])v-drag(?:=".*?")?/gi, (full, index) => {
if (index === idx) {
replaced = true
return `v-drag="${posStr}"`
}
return full
})
if (index === idx) {
replaced = true
return `v-drag="${posStr}"`
}
return full
})

if (!replaced)
throw new Error(`[Slidev] VDrag Element ${id} is not found in the markdown source`)
Expand Down Expand Up @@ -182,16 +182,16 @@ export function useDragElement(directive: DirectiveBinding | null, posRaw?: stri
const configuredHeight = ref(pos[3] ?? 0)
const height = autoHeight
? computed({
get: () => (autoHeight ? actualHeight.value : configuredHeight.value) || 0,
set: v => !autoHeight && (configuredHeight.value = v),
})
get: () => (autoHeight ? actualHeight.value : configuredHeight.value) || 0,
set: v => !autoHeight && (configuredHeight.value = v),
})
: configuredHeight
const configuredY0 = autoHeight ? ref(pos[1]) : ref(pos[1] + pos[3] / 2)
const y0 = autoHeight
? computed({
get: () => configuredY0.value + height.value / 2,
set: v => configuredY0.value = v - height.value / 2,
})
get: () => configuredY0.value + height.value / 2,
set: v => configuredY0.value = v - height.value / 2,
})
: configuredY0

const containerStyle = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/internals/NavControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ if (__SLIDEV_FEATURE_RECORD__)
<div class="i-carbon:text-annotation-toggle" />
</IconButton>

<IconButton v-if="isPresenter" title="Toggle Presenter Layout" class="aspect-ratio-initial" @click="togglePresenterLayout">
<IconButton v-if="isPresenter" title="Toggle Presenter Layout" class="aspect-ratio-initial flex items-center" @click="togglePresenterLayout">
<div class="i-carbon:template" />
{{ presenterLayout }}
</IconButton>
Expand Down
9 changes: 9 additions & 0 deletions packages/client/pages/presenter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ onMounted(() => {
'bottom bottom';
}
.grid-container.layout3 {
grid-template-columns: 2fr 3fr;
grid-template-rows: 1fr 1fr min-content;
grid-template-areas:
'note next'
'main next'
'bottom bottom';
}
@media (max-aspect-ratio: 3/5) {
.grid-container.layout1 {
grid-template-columns: 1fr;
Expand Down
28 changes: 14 additions & 14 deletions packages/client/setup/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ const setup = createSingletonPromise(async () => {

const ata = configs.monacoTypesSource === 'cdn'
? setupTypeAcquisition({
projectName: 'TypeScript Playground',
typescript: ts as any, // Version mismatch. No problem found so far.
logger: console,
delegate: {
receivedFile: (code: string, path: string) => {
defaults.addExtraLib(code, `file://${path}`)
const uri = monaco.Uri.file(path)
if (monaco.editor.getModel(uri) === null)
monaco.editor.createModel(code, 'javascript', uri)
},
progress: (downloaded: number, total: number) => {
projectName: 'TypeScript Playground',
typescript: ts as any, // Version mismatch. No problem found so far.
logger: console,
delegate: {
receivedFile: (code: string, path: string) => {
defaults.addExtraLib(code, `file://${path}`)
const uri = monaco.Uri.file(path)
if (monaco.editor.getModel(uri) === null)
monaco.editor.createModel(code, 'javascript', uri)
},
progress: (downloaded: number, total: number) => {
// eslint-disable-next-line no-console
console.debug(`[Typescript ATA] ${downloaded} / ${total}`)
console.debug(`[Typescript ATA] ${downloaded} / ${total}`)
},
},
},
})
})
: () => { }

monaco.languages.register({ id: 'vue' })
Expand Down
2 changes: 1 addition & 1 deletion packages/client/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const presenterLayout = useLocalStorage('slidev-presenter-layout', 1, { l

export function togglePresenterLayout() {
presenterLayout.value = presenterLayout.value + 1
if (presenterLayout.value > 2)
if (presenterLayout.value > 3)
presenterLayout.value = 1
}

Expand Down
6 changes: 3 additions & 3 deletions packages/slidev/node/integrations/drawings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import fs from 'fs-extra'
function resolveDrawingsDir(options: ResolvedSlidevOptions): string | undefined {
return options.data.config.drawings.persist
? resolve(
dirname(options.entry),
options.data.config.drawings.persist,
)
dirname(options.entry),
options.data.config.drawings.persist,
)
: undefined
}

Expand Down
Loading

0 comments on commit 86b834c

Please sign in to comment.