Skip to content

Commit

Permalink
Reorganize files
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshino committed Dec 14, 2024
1 parent 7776df9 commit a7b91d0
Show file tree
Hide file tree
Showing 60 changed files with 517 additions and 489 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/assets/list/primary-sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
selectedAssetFolder,
} from '$lib/services/assets';
import { getFolderLabelByCollection } from '$lib/services/assets/view';
import { getCollection } from '$lib/services/contents';
import { getCollection } from '$lib/services/contents/collection';
$: folders = [
{
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/assets/shared/info-panel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import AssetPreview from '$lib/components/assets/shared/asset-preview.svelte';
import { goto } from '$lib/services/app/navigation';
import { getAssetDetails, isMediaKind } from '$lib/services/assets';
import { getCollectionsByEntry, getFilesByEntry } from '$lib/services/contents';
import { getCollectionsByEntry } from '$lib/services/contents/collection';
import { getFilesByEntry } from '$lib/services/contents/collection/files';
import { getEntryTitle } from '$lib/services/contents/entry';
import { dateFormatOptions, timeFormatOptions } from '$lib/services/utils/date';
import { formatSize } from '$lib/services/utils/file';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import EmptyState from '$lib/components/common/empty-state.svelte';
import ViewSwitcher from '$lib/components/common/page-toolbar/view-switcher.svelte';
import { allAssetFolders, allAssets, getCollectionsByAsset } from '$lib/services/assets';
import { selectedCollection } from '$lib/services/contents';
import { selectedCollection } from '$lib/services/contents/collection';
import { selectAssetsView, showContentOverlay } from '$lib/services/contents/draft/editor';
import {
allCloudStorageServices,
Expand Down
7 changes: 4 additions & 3 deletions src/lib/components/contents/contents-page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import SecondarySidebar from '$lib/components/contents/list/secondary-sidebar.svelte';
import SecondaryToolbar from '$lib/components/contents/list/secondary-toolbar.svelte';
import { announcedPageStatus, parseLocation } from '$lib/services/app/navigation';
import { getCollection, getFile, selectedCollection } from '$lib/services/contents';
import { contentUpdatesToast } from '$lib/services/contents/data';
import { getCollection, selectedCollection } from '$lib/services/contents/collection';
import { contentUpdatesToast } from '$lib/services/contents/collection/data';
import { getFile } from '$lib/services/contents/collection/files';
import { listedEntries } from '$lib/services/contents/collection/view';
import { createDraft } from '$lib/services/contents/draft/create';
import { showContentOverlay } from '$lib/services/contents/draft/editor';
import { getEntryTitle } from '$lib/services/contents/entry';
import { listedEntries } from '$lib/services/contents/view';
/**
* Navigate to the content list or content details page given the URL hash.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/contents/details/toolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { goBack, goto } from '$lib/services/app/navigation';
import { backendName } from '$lib/services/backends';
import { siteConfig } from '$lib/services/config';
import { deleteEntries } from '$lib/services/contents/data';
import { deleteEntries } from '$lib/services/contents/collection/data';
import { entryDraft } from '$lib/services/contents/draft';
import { createDraft, duplicateDraft } from '$lib/services/contents/draft/create';
import { copyFromLocaleToast, entryEditorSettings } from '$lib/services/contents/draft/editor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
getDate,
getInputValue,
parseDateTimeConfig,
} from '$lib/components/contents/details/widgets/date-time/helper';
} from '$lib/services/contents/widgets/date-time';
/**
* @type {LocaleCode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
@see https://decapcms.org/docs/widgets/#datetime
-->
<script>
import {
getDate,
parseDateTimeConfig,
} from '$lib/components/contents/details/widgets/date-time/helper';
import { getCanonicalLocale } from '$lib/services/contents/i18n';
import { getDate, parseDateTimeConfig } from '$lib/services/contents/widgets/date-time';
import { dateFormatOptions, timeFormatOptions } from '$lib/services/utils/date';
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import { onMount } from 'svelte';
import { _ } from 'svelte-i18n';
import FieldEditor from '$lib/components/contents/details/editor/field-editor.svelte';
import { formatSummary } from '$lib/components/contents/details/widgets/list/helper';
import AddItemButton from '$lib/components/contents/details/widgets/object/add-item-button.svelte';
import ObjectHeader from '$lib/components/contents/details/widgets/object/object-header.svelte';
import { entryDraft } from '$lib/services/contents/draft';
import { getDefaultValues } from '$lib/services/contents/draft/create';
import { syncExpanderStates } from '$lib/services/contents/draft/editor';
import { updateListField } from '$lib/services/contents/draft/update';
import { defaultI18nConfig } from '$lib/services/contents/i18n';
import { formatSummary } from '$lib/services/contents/widgets/list';
/**
* @type {LocaleCode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
<script>
import { TextEditor } from '@sveltia/ui';
import { sleep } from '@sveltia/utils/misc';
import {
EditorComponent,
getComponentDef,
} from '$lib/services/contents/widgets/markdown/component';
import {
buttonNameMap,
defaultButtons,
defaultComponents,
defaultModes,
modeNameMap,
registeredComponents,
} from '$lib/components/contents/details/widgets/markdown';
import {
EditorComponent,
getComponentDef,
} from '$lib/components/contents/details/widgets/markdown/component';
} from '$lib/services/contents/widgets/markdown/index';
/**
* @type {LocaleCode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
import { _ } from 'svelte-i18n';
import FieldEditor from '$lib/components/contents/details/editor/field-editor.svelte';
import AddItemButton from '$lib/components/contents/details/widgets/object/add-item-button.svelte';
import { formatSummary } from '$lib/components/contents/details/widgets/object/helper';
import ObjectHeader from '$lib/components/contents/details/widgets/object/object-header.svelte';
import { entryDraft, i18nAutoDupEnabled } from '$lib/services/contents/draft';
import { getDefaultValues } from '$lib/services/contents/draft/create';
import { syncExpanderStates } from '$lib/services/contents/draft/editor';
import { copyDefaultLocaleValues } from '$lib/services/contents/draft/update';
import { getFieldConfig } from '$lib/services/contents/entry';
import { defaultI18nConfig } from '$lib/services/contents/i18n';
import { formatSummary } from '$lib/services/contents/widgets/object';
/**
* @type {LocaleCode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
@see https://decapcms.org/docs/widgets/#relation
-->
<script>
import { getOptions } from '$lib/components/contents/details/widgets/relation/helper';
import SelectEditor from '$lib/components/contents/details/widgets/select/select-editor.svelte';
import { getEntriesByCollection, getFile } from '$lib/services/contents';
import { getEntriesByCollection } from '$lib/services/contents/collection/entries';
import { getFile } from '$lib/services/contents/collection/files';
import { getOptions } from '$lib/services/contents/widgets/relation';
/**
* @type {LocaleCode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
@see https://decapcms.org/docs/widgets/#relation
-->
<script>
import { getOptions } from '$lib/components/contents/details/widgets/relation/helper';
import { getEntriesByCollection, getFile } from '$lib/services/contents';
import { getEntriesByCollection } from '$lib/services/contents/collection/entries';
import { getFile } from '$lib/services/contents/collection/files';
import { getListFormatter } from '$lib/services/contents/i18n';
import { getOptions } from '$lib/services/contents/widgets/relation';
/**
* @type {LocaleCode}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { _ } from 'svelte-i18n';
import { validateStringField } from '$lib/components/contents/details/widgets/string/helper';
import { validateStringField } from '$lib/services/contents/widgets/string';
/**
* @type {StringField | TextField}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<script>
import { TextInput } from '@sveltia/ui';
import { onMount } from 'svelte';
import { getDefaultValue } from '$lib/components/contents/details/widgets/uuid/helper';
import { entryDraft } from '$lib/services/contents/draft';
import { defaultI18nConfig } from '$lib/services/contents/i18n';
import { getDefaultValue } from '$lib/services/contents/widgets/uuid';
/**
* @type {LocaleCode}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/contents/list/entry-list-item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { Checkbox, GridCell, GridRow } from '@sveltia/ui';
import Image from '$lib/components/common/image.svelte';
import { goto } from '$lib/services/app/navigation';
import { selectedEntries } from '$lib/services/contents';
import { selectedEntries } from '$lib/services/contents/collection/entries';
import { listedEntries } from '$lib/services/contents/collection/view';
import { getEntryThumbnail, getEntryTitle } from '$lib/services/contents/entry';
import { listedEntries } from '$lib/services/contents/view';
/**
* @type {EntryCollection}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/contents/list/entry-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import ListingGrid from '$lib/components/common/listing-grid.svelte';
import EntryListItem from '$lib/components/contents/list/entry-list-item.svelte';
import { goto } from '$lib/services/app/navigation';
import { selectedCollection } from '$lib/services/contents';
import { currentView, entryGroups, listedEntries } from '$lib/services/contents/view';
import { selectedCollection } from '$lib/services/contents/collection';
import { currentView, entryGroups, listedEntries } from '$lib/services/contents/collection/view';
$: collection = (() => /** @type {EntryCollection | undefined} */ ($selectedCollection))();
$: viewType = $currentView.type;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/contents/list/file-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import ListContainer from '$lib/components/common/list-container.svelte';
import ListingGrid from '$lib/components/common/listing-grid.svelte';
import { goto } from '$lib/services/app/navigation';
import { selectedCollection } from '$lib/services/contents';
import { selectedCollection } from '$lib/services/contents/collection';
</script>

<ListContainer aria-label={$_('file_list')}>
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/contents/list/primary-sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import { _ } from 'svelte-i18n';
import { goto } from '$lib/services/app/navigation';
import { siteConfig } from '$lib/services/config';
import { allEntries, getEntriesByCollection, selectedCollection } from '$lib/services/contents';
import { allEntries } from '$lib/services/contents';
import { selectedCollection } from '$lib/services/contents/collection';
import { getEntriesByCollection } from '$lib/services/contents/collection/entries';
$: collections = $siteConfig?.collections.filter(({ hide }) => !hide) ?? [];
</script>
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/contents/list/primary-toolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import DOMPurify from 'isomorphic-dompurify';
import { marked } from 'marked';
import { _ } from 'svelte-i18n';
import { selectedCollection, selectedEntries } from '$lib/services/contents';
import { goto } from '$lib/services/app/navigation';
import DeleteEntriesDialog from '$lib/components/contents/shared/delete-entries-dialog.svelte';
import { goto } from '$lib/services/app/navigation';
import { selectedCollection } from '$lib/services/contents/collection';
import { selectedEntries } from '$lib/services/contents/collection/entries';
let showDeleteDialog = false;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/contents/list/secondary-sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import DropZone from '$lib/components/assets/shared/drop-zone.svelte';
import { goto } from '$lib/services/app/navigation';
import { allAssets, uploadingAssets } from '$lib/services/assets';
import { selectedCollection } from '$lib/services/contents';
import { currentView } from '$lib/services/contents/view';
import { selectedCollection } from '$lib/services/contents/collection';
import { currentView } from '$lib/services/contents/collection/view';
$: ({ internalPath, entryRelative } =
$selectedCollection?._assetFolder ?? /** @type {CollectionAssetFolder} */ ({}));
Expand Down
10 changes: 8 additions & 2 deletions src/lib/components/contents/list/secondary-toolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
import ItemSelector from '$lib/components/common/page-toolbar/item-selector.svelte';
import SortMenu from '$lib/components/common/page-toolbar/sort-menu.svelte';
import ViewSwitcher from '$lib/components/common/page-toolbar/view-switcher.svelte';
import { selectedCollection, selectedEntries } from '$lib/services/contents';
import { currentView, entryGroups, listedEntries, sortFields } from '$lib/services/contents/view';
import { selectedCollection } from '$lib/services/contents/collection';
import { selectedEntries } from '$lib/services/contents/collection/entries';
import {
currentView,
entryGroups,
listedEntries,
sortFields,
} from '$lib/services/contents/collection/view';
$: ({ name: collectionName, _thumbnailFieldName } =
$selectedCollection?._type === 'entry'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<script>
import { ConfirmationDialog } from '@sveltia/ui';
import { _ } from 'svelte-i18n';
import { selectedCollection, selectedEntries } from '$lib/services/contents';
import { deleteEntries } from '$lib/services/contents/data';
import { selectedCollection } from '$lib/services/contents/collection';
import { deleteEntries } from '$lib/services/contents/collection/data';
import { selectedEntries } from '$lib/services/contents/collection/entries';
import { listedEntries } from '$lib/services/contents/collection/view';
import { getAssociatedAssets } from '$lib/services/contents/entry';
import { listedEntries } from '$lib/services/contents/view';
export let open = false;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/global/main-router.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import WorkflowPage from '$lib/components/workflow/workflow-page.svelte';
import { parseLocation, selectedPageName } from '$lib/services/app/navigation';
import { showAssetOverlay } from '$lib/services/assets';
import { selectedCollection } from '$lib/services/contents';
import { selectedCollection } from '$lib/services/contents/collection';
import { showContentOverlay } from '$lib/services/contents/draft/editor';
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { _ } from 'svelte-i18n';
import { goto, selectedPageName } from '$lib/services/app/navigation';
import { selectedAssetFolder } from '$lib/services/assets';
import { selectedCollection } from '$lib/services/contents';
import { selectedCollection } from '$lib/services/contents/collection';
$: pages = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { SearchBar } from '@sveltia/ui';
import { _ } from 'svelte-i18n';
import { goBack, goto, parseLocation } from '$lib/services/app/navigation';
import { selectedCollection } from '$lib/services/contents';
import { selectedCollection } from '$lib/services/contents/collection';
import { searchTerms } from '$lib/services/search';
/**
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/search/entry-result-item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { GridCell, GridRow } from '@sveltia/ui';
import Image from '$lib/components/common/image.svelte';
import { goto } from '$lib/services/app/navigation';
import { getCollectionsByEntry, getFilesByEntry } from '$lib/services/contents';
import { getCollectionsByEntry } from '$lib/services/contents/collection';
import { getFilesByEntry } from '$lib/services/contents/collection/files';
import { getEntryThumbnail, getEntryTitle } from '$lib/services/contents/entry';
import { defaultI18nConfig } from '$lib/services/contents/i18n';
Expand Down
10 changes: 4 additions & 6 deletions src/lib/services/assets/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ import {
} from '$lib/services/assets';
import { backend, backendName } from '$lib/services/backends';
import { siteConfig } from '$lib/services/config';
import {
allEntries,
getCollectionsByEntry,
getEntriesByAssetURL,
getFilesByEntry,
} from '$lib/services/contents';
import { allEntries } from '$lib/services/contents';
import { getCollectionsByEntry } from '$lib/services/contents/collection';
import { getEntriesByAssetURL } from '$lib/services/contents/collection/entries';
import { getFilesByEntry } from '$lib/services/contents/collection/files';
import { createSavingEntryData } from '$lib/services/contents/draft/save';
import { renameIfNeeded } from '$lib/services/utils/file';

Expand Down
11 changes: 4 additions & 7 deletions src/lib/services/assets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ import mime from 'mime';
import { derived, get, writable } from 'svelte/store';
import { backend } from '$lib/services/backends';
import { siteConfig } from '$lib/services/config';
import {
getCollection,
getCollectionsByEntry,
getEntriesByAssetURL,
getFilesByEntry,
} from '$lib/services/contents';
import { fillSlugTemplate } from '$lib/services/contents/slug';
import { getCollection, getCollectionsByEntry } from '$lib/services/contents/collection';
import { getEntriesByAssetURL } from '$lib/services/contents/collection/entries';
import { getFilesByEntry } from '$lib/services/contents/collection/files';
import { fillSlugTemplate } from '$lib/services/contents/entry/slug';
import { createPath, resolvePath } from '$lib/services/utils/file';
import { convertImage, getMediaMetadata, renderPDF } from '$lib/services/utils/media';

Expand Down
3 changes: 2 additions & 1 deletion src/lib/services/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { get, writable } from 'svelte/store';
import YAML from 'yaml';
import { prefs } from '$lib/services/prefs';
import { getI18nConfig } from '$lib/services/contents/i18n';
import { allEntryFolders, getCollection, selectedCollection } from '$lib/services/contents';
import { getCollection, selectedCollection } from '$lib/services/contents/collection';
import { allEntryFolders } from '$lib/services/contents';
import { allBackendServices } from '$lib/services/backends';
import { allAssetFolders } from '$lib/services/assets';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { get, writable } from 'svelte/store';
import { allAssets } from '$lib/services/assets';
import { backend } from '$lib/services/backends';
import { allEntries, selectedCollection } from '$lib/services/contents';
import { allEntries } from '$lib/services/contents';
import { selectedCollection } from '$lib/services/contents/collection';

/**
* @type {import('svelte/store').Writable<UpdatesToastState>}
Expand Down
Loading

0 comments on commit a7b91d0

Please sign in to comment.