Skip to content

Commit

Permalink
fix: allow settings key to be used in mockPageData
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-8 committed Aug 14, 2024
1 parent 1c002ec commit 7a3edc0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/kitbook/src/lib/routes/[...file]/MainPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
pagesStore,
loadedModules: { variantsModule: initialVariantsModule, compositionsModules: initialCompositionsModules, markdown: initialMarkdown },
pageKey,
settings,
kitbook_settings: settings,
rpc_client,
} = data)
$: ({ viewports: projectViewports, addLanguageToUrl, githubURL, title: kitbookTitle, darkMode } = settings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const shared_meta: VariantMeta = {
}

const shared_data = {
settings: {
kitbook_settings: {
title: 'Demo Kitbook',
description: '',
},
Expand Down Expand Up @@ -119,7 +119,7 @@ const docs_page: GroupedPage = {
export const i18n: Variant<Component> = {
data: {
...shared_data,
settings: {
kitbook_settings: {
title: 'i18n Kitbook',
description: '',
expandTree: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/kitbook/src/lib/routes/layoutLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface LayoutLoadInput {
export interface LayoutLoadResult {
pages: GroupedPageMap
pagesStore: typeof pagesStore
settings: KitbookSettings
kitbook_settings: KitbookSettings // prefixed to allow users to use the settings keyword in the mockedPageData
rpc_client: typeof rpc_client
}

Expand All @@ -37,7 +37,7 @@ export function layoutLoad({
return {
pages: initialPages,
pagesStore,
settings,
kitbook_settings: settings,
rpc_client,
...(mockedPageData || {}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const shared_data = {

canMount: true,
darkMode: false,
settings: null,
kitbook_settings: null,
rpc_client: null,
} satisfies Partial<Variant<Component>['data']>

Expand Down
2 changes: 1 addition & 1 deletion packages/kitbook/src/lib/routes/tools/Tools.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export let detailsForTools: ToolsComponentDetails
export let changeState: (data: ToolsChangeState) => void
$: ({ viewports, _languageInsertedKitbookRoute } = data.settings)
$: ({ viewports, _languageInsertedKitbookRoute } = data.kitbook_settings)
$: ({ filename, tagName, serializedState } = detailsForTools)
$: variantsFilename = filename?.replace('.svelte', '.variants.ts')
$: svxFilename = filename?.replace('.svelte', '.md')
Expand Down
2 changes: 1 addition & 1 deletion packages/kitbook/src/lib/routes/tools/Tools.variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type Component from './Tools.svelte'
const shared = {
changeState: data => console.info({ changeState: data }),
data: {
settings: {
kitbook_settings: {
description: 'This is a description',
title: 'This is a title',
viewports: [{ width: 500, height: 200 }],
Expand Down

0 comments on commit 7a3edc0

Please sign in to comment.