mirror of
https://github.com/quartz-community/folder-page.git
synced 2026-07-22 02:50:24 +00:00
chore: rebuild dist outputs
This commit is contained in:
parent
8e3e632729
commit
a4d0b92a1a
5 changed files with 21 additions and 36 deletions
6
dist/components/index.d.ts
vendored
6
dist/components/index.d.ts
vendored
|
|
@ -1,9 +1,9 @@
|
|||
export { _ as FolderContent } from '../FolderContent-DEXAgZWS.js';
|
||||
import { QuartzComponent, SortFn } from '@quartz-community/types';
|
||||
export { SortFn } from '@quartz-community/types';
|
||||
export { byDateAndAlphabetical } from '@quartz-community/utils/sort';
|
||||
|
||||
declare function byDateAndAlphabetical(cfg: unknown): SortFn;
|
||||
declare function byDateAndAlphabeticalFolderFirst(cfg: unknown): SortFn;
|
||||
declare function byDateAndAlphabeticalFolderFirst(_cfg: unknown): SortFn;
|
||||
declare const PageList: QuartzComponent;
|
||||
|
||||
export { PageList, byDateAndAlphabetical, byDateAndAlphabeticalFolderFirst };
|
||||
export { PageList, byDateAndAlphabeticalFolderFirst };
|
||||
|
|
|
|||
32
dist/components/index.js
vendored
32
dist/components/index.js
vendored
|
|
@ -1,6 +1,10 @@
|
|||
import { getDate } from '@quartz-community/utils/sort';
|
||||
export { byDateAndAlphabetical } from '@quartz-community/utils/sort';
|
||||
import { jsx, jsxs } from 'preact/jsx-runtime';
|
||||
import { htmlToJsx } from '@quartz-community/utils/jsx';
|
||||
|
||||
// src/components/PageList.tsx
|
||||
|
||||
// src/util/path.ts
|
||||
function joinSegments(...args) {
|
||||
if (args.length === 0) return "";
|
||||
|
|
@ -38,32 +42,14 @@ function resolveRelative(current, target) {
|
|||
function isFolderPath(fplike) {
|
||||
return fplike.endsWith("/") || endsWith(fplike, "index") || endsWith(fplike, "index.md") || endsWith(fplike, "index.html");
|
||||
}
|
||||
function getDate(cfg, data) {
|
||||
const type = cfg?.defaultDateType ?? "created";
|
||||
return data.dates?.[type];
|
||||
}
|
||||
function byDateAndAlphabetical(cfg) {
|
||||
return (f1, f2) => {
|
||||
if (f1.dates && f2.dates) {
|
||||
return (getDate(cfg, f2)?.getTime() ?? 0) - (getDate(cfg, f1)?.getTime() ?? 0);
|
||||
} else if (f1.dates && !f2.dates) {
|
||||
return -1;
|
||||
} else if (!f1.dates && f2.dates) {
|
||||
return 1;
|
||||
}
|
||||
const f1Title = f1.frontmatter?.title?.toLowerCase() ?? "";
|
||||
const f2Title = f2.frontmatter?.title?.toLowerCase() ?? "";
|
||||
return f1Title.localeCompare(f2Title);
|
||||
};
|
||||
}
|
||||
function byDateAndAlphabeticalFolderFirst(cfg) {
|
||||
function byDateAndAlphabeticalFolderFirst(_cfg) {
|
||||
return (f1, f2) => {
|
||||
const f1IsFolder = isFolderPath(f1.slug ?? "");
|
||||
const f2IsFolder = isFolderPath(f2.slug ?? "");
|
||||
if (f1IsFolder && !f2IsFolder) return -1;
|
||||
if (!f1IsFolder && f2IsFolder) return 1;
|
||||
if (f1.dates && f2.dates) {
|
||||
return (getDate(cfg, f2)?.getTime() ?? 0) - (getDate(cfg, f1)?.getTime() ?? 0);
|
||||
return (getDate(f2)?.getTime() ?? 0) - (getDate(f1)?.getTime() ?? 0);
|
||||
} else if (f1.dates && !f2.dates) {
|
||||
return -1;
|
||||
} else if (!f1.dates && f2.dates) {
|
||||
|
|
@ -88,7 +74,7 @@ var PageList = ({
|
|||
limit,
|
||||
sort
|
||||
}) => {
|
||||
const sorter = sort ?? byDateAndAlphabeticalFolderFirst(cfg);
|
||||
const sorter = sort ?? byDateAndAlphabeticalFolderFirst();
|
||||
let list = [...allFiles].sort(sorter);
|
||||
if (limit) {
|
||||
list = list.slice(0, limit);
|
||||
|
|
@ -101,7 +87,7 @@ var PageList = ({
|
|||
/* @__PURE__ */ jsx("p", { class: "meta", children: page.dates && /* @__PURE__ */ jsx(
|
||||
DateDisplay,
|
||||
{
|
||||
date: getDate(cfg, page),
|
||||
date: getDate(page),
|
||||
locale: cfg?.locale ?? "en-US"
|
||||
}
|
||||
) }),
|
||||
|
|
@ -286,6 +272,6 @@ var FolderContent_default = ((opts) => {
|
|||
return FolderContent;
|
||||
});
|
||||
|
||||
export { FolderContent_default as FolderContent, PageList, byDateAndAlphabetical, byDateAndAlphabeticalFolderFirst };
|
||||
export { FolderContent_default as FolderContent, PageList, byDateAndAlphabeticalFolderFirst };
|
||||
//# sourceMappingURL=index.js.map
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
dist/components/index.js.map
vendored
2
dist/components/index.js.map
vendored
File diff suppressed because one or more lines are too long
15
dist/index.js
vendored
15
dist/index.js
vendored
|
|
@ -1,7 +1,10 @@
|
|||
import { getDate } from '@quartz-community/utils/sort';
|
||||
import { jsxs, jsx } from 'preact/jsx-runtime';
|
||||
import { htmlToJsx } from '@quartz-community/utils/jsx';
|
||||
import path from 'path';
|
||||
|
||||
// src/components/PageList.tsx
|
||||
|
||||
// src/util/path.ts
|
||||
function joinSegments(...args) {
|
||||
if (args.length === 0) return "";
|
||||
|
|
@ -39,18 +42,14 @@ function resolveRelative(current, target) {
|
|||
function isFolderPath(fplike) {
|
||||
return fplike.endsWith("/") || endsWith(fplike, "index") || endsWith(fplike, "index.md") || endsWith(fplike, "index.html");
|
||||
}
|
||||
function getDate(cfg, data) {
|
||||
const type = cfg?.defaultDateType ?? "created";
|
||||
return data.dates?.[type];
|
||||
}
|
||||
function byDateAndAlphabeticalFolderFirst(cfg) {
|
||||
function byDateAndAlphabeticalFolderFirst(_cfg) {
|
||||
return (f1, f2) => {
|
||||
const f1IsFolder = isFolderPath(f1.slug ?? "");
|
||||
const f2IsFolder = isFolderPath(f2.slug ?? "");
|
||||
if (f1IsFolder && !f2IsFolder) return -1;
|
||||
if (!f1IsFolder && f2IsFolder) return 1;
|
||||
if (f1.dates && f2.dates) {
|
||||
return (getDate(cfg, f2)?.getTime() ?? 0) - (getDate(cfg, f1)?.getTime() ?? 0);
|
||||
return (getDate(f2)?.getTime() ?? 0) - (getDate(f1)?.getTime() ?? 0);
|
||||
} else if (f1.dates && !f2.dates) {
|
||||
return -1;
|
||||
} else if (!f1.dates && f2.dates) {
|
||||
|
|
@ -75,7 +74,7 @@ var PageList = ({
|
|||
limit,
|
||||
sort
|
||||
}) => {
|
||||
const sorter = sort ?? byDateAndAlphabeticalFolderFirst(cfg);
|
||||
const sorter = sort ?? byDateAndAlphabeticalFolderFirst();
|
||||
let list = [...allFiles].sort(sorter);
|
||||
if (limit) {
|
||||
list = list.slice(0, limit);
|
||||
|
|
@ -88,7 +87,7 @@ var PageList = ({
|
|||
/* @__PURE__ */ jsx("p", { class: "meta", children: page.dates && /* @__PURE__ */ jsx(
|
||||
DateDisplay,
|
||||
{
|
||||
date: getDate(cfg, page),
|
||||
date: getDate(page),
|
||||
locale: cfg?.locale ?? "en-US"
|
||||
}
|
||||
) }),
|
||||
|
|
|
|||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue