@quartz-community/folder-page 0.1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
 
33
33
  // node_modules/inline-style-parser/cjs/index.js
34
34
  var require_cjs = __commonJS({
35
- "node_modules/inline-style-parser/cjs/index.js"(exports$1, module) {
35
+ "node_modules/inline-style-parser/cjs/index.js"(exports, module) {
36
36
  var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
37
37
  var NEWLINE_REGEX = /\n/g;
38
38
  var WHITESPACE_REGEX = /^\s*/;
@@ -170,12 +170,12 @@ var require_cjs = __commonJS({
170
170
 
171
171
  // node_modules/style-to-object/cjs/index.js
172
172
  var require_cjs2 = __commonJS({
173
- "node_modules/style-to-object/cjs/index.js"(exports$1) {
174
- var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
173
+ "node_modules/style-to-object/cjs/index.js"(exports) {
174
+ var __importDefault = exports && exports.__importDefault || function(mod) {
175
175
  return mod && mod.__esModule ? mod : { "default": mod };
176
176
  };
177
- Object.defineProperty(exports$1, "__esModule", { value: true });
178
- exports$1.default = StyleToObject;
177
+ Object.defineProperty(exports, "__esModule", { value: true });
178
+ exports.default = StyleToObject;
179
179
  var inline_style_parser_1 = __importDefault(require_cjs());
180
180
  function StyleToObject(style, iterator) {
181
181
  let styleObject = null;
@@ -203,9 +203,9 @@ var require_cjs2 = __commonJS({
203
203
 
204
204
  // node_modules/style-to-js/cjs/utilities.js
205
205
  var require_utilities = __commonJS({
206
- "node_modules/style-to-js/cjs/utilities.js"(exports$1) {
207
- Object.defineProperty(exports$1, "__esModule", { value: true });
208
- exports$1.camelCase = void 0;
206
+ "node_modules/style-to-js/cjs/utilities.js"(exports) {
207
+ Object.defineProperty(exports, "__esModule", { value: true });
208
+ exports.camelCase = void 0;
209
209
  var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
210
210
  var HYPHEN_REGEX = /-([a-z])/g;
211
211
  var NO_HYPHEN_REGEX = /^[^-]+$/;
@@ -235,14 +235,14 @@ var require_utilities = __commonJS({
235
235
  }
236
236
  return property.replace(HYPHEN_REGEX, capitalize);
237
237
  };
238
- exports$1.camelCase = camelCase;
238
+ exports.camelCase = camelCase;
239
239
  }
240
240
  });
241
241
 
242
242
  // node_modules/style-to-js/cjs/index.js
243
243
  var require_cjs3 = __commonJS({
244
- "node_modules/style-to-js/cjs/index.js"(exports$1, module) {
245
- var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
244
+ "node_modules/style-to-js/cjs/index.js"(exports, module) {
245
+ var __importDefault = exports && exports.__importDefault || function(mod) {
246
246
  return mod && mod.__esModule ? mod : { "default": mod };
247
247
  };
248
248
  var style_to_object_1 = __importDefault(require_cjs2());
@@ -279,6 +279,22 @@ function simplifySlug(fp) {
279
279
  const res = stripSlashes(trimSuffix(fp, "index"), true);
280
280
  return res.length === 0 ? "/" : res;
281
281
  }
282
+ function slugifyFilePath(fp, excludeExt) {
283
+ fp = stripSlashes(fp);
284
+ const ext = getFileExtension(fp);
285
+ const withoutFileExt = fp.replace(new RegExp(ext + "$"), "");
286
+ const finalExt = [".md", ".html", void 0].includes(ext) ? "" : ext;
287
+ let slug2 = _sluggify(withoutFileExt);
288
+ if (endsWith(slug2, "_index")) {
289
+ slug2 = slug2.replace(/_index$/, "index");
290
+ }
291
+ const segments = slug2.split("/");
292
+ if (segments.length >= 2 && segments[segments.length - 1] === segments[segments.length - 2]) {
293
+ segments[segments.length - 1] = "index";
294
+ slug2 = segments.join("/");
295
+ }
296
+ return slug2 + (finalExt ?? "");
297
+ }
282
298
  function joinSegments(...args) {
283
299
  if (args.length === 0) {
284
300
  return "";
@@ -312,6 +328,9 @@ function stripSlashes(s2, onlyStripPrefix) {
312
328
  }
313
329
  return s2;
314
330
  }
331
+ function getFileExtension(s2) {
332
+ return s2.match(/\.[A-Za-z0-9]+$/)?.[0];
333
+ }
315
334
  function isFolderPath(fplike) {
316
335
  return fplike.endsWith("/") || endsWith(fplike, "index") || endsWith(fplike, "index.md") || endsWith(fplike, "index.html");
317
336
  }
@@ -326,6 +345,14 @@ function resolveRelative(current, target) {
326
345
  const res = joinSegments(pathToRoot(current), simplifySlug(target));
327
346
  return res;
328
347
  }
348
+ function slugifyPath(s2) {
349
+ return s2.split("/").map(
350
+ (segment) => segment.replace(/\s/g, "-").replace(/&/g, "-and-").replace(/%/g, "-percent").replace(/\?/g, "").replace(/#/g, "").replace(/[<>:"|*]/g, "").toLowerCase()
351
+ ).join("/").replace(/\/$/, "");
352
+ }
353
+ function _sluggify(s2) {
354
+ return slugifyPath(s2);
355
+ }
329
356
 
330
357
  // node_modules/preact/dist/preact.mjs
331
358
  var n;
@@ -717,6 +744,7 @@ var html = create({
717
744
  allowFullScreen: boolean,
718
745
  allowPaymentRequest: boolean,
719
746
  allowUserMedia: boolean,
747
+ alpha: boolean,
720
748
  alt: null,
721
749
  as: null,
722
750
  async: boolean,
@@ -730,8 +758,12 @@ var html = create({
730
758
  checked: boolean,
731
759
  cite: null,
732
760
  className: spaceSeparated,
761
+ closedBy: null,
762
+ colorSpace: null,
733
763
  cols: number,
734
- colSpan: null,
764
+ colSpan: number,
765
+ command: null,
766
+ commandFor: null,
735
767
  content: null,
736
768
  contentEditable: booleanish,
737
769
  controls: boolean,
@@ -911,8 +943,10 @@ var html = create({
911
943
  seamless: boolean,
912
944
  selected: boolean,
913
945
  shadowRootClonable: boolean,
946
+ shadowRootCustomElementRegistry: boolean,
914
947
  shadowRootDelegatesFocus: boolean,
915
948
  shadowRootMode: null,
949
+ shadowRootSerializable: boolean,
916
950
  shape: null,
917
951
  size: number,
918
952
  sizes: null,
@@ -1049,8 +1083,11 @@ var html = create({
1049
1083
  allowTransparency: null,
1050
1084
  autoCorrect: null,
1051
1085
  autoSave: null,
1086
+ credentialless: boolean,
1052
1087
  disablePictureInPicture: boolean,
1053
1088
  disableRemotePlayback: boolean,
1089
+ exportParts: commaSeparated,
1090
+ part: spaceSeparated,
1054
1091
  prefix: null,
1055
1092
  property: null,
1056
1093
  results: number,
@@ -1104,6 +1141,7 @@ var svg = create({
1104
1141
  markerEnd: "marker-end",
1105
1142
  markerMid: "marker-mid",
1106
1143
  markerStart: "marker-start",
1144
+ maskType: "mask-type",
1107
1145
  navDown: "nav-down",
1108
1146
  navDownLeft: "nav-down-left",
1109
1147
  navDownRight: "nav-down-right",
@@ -1374,6 +1412,7 @@ var svg = create({
1374
1412
  markerWidth: null,
1375
1413
  mask: null,
1376
1414
  maskContentUnits: null,
1415
+ maskType: null,
1377
1416
  maskUnits: null,
1378
1417
  mathematical: null,
1379
1418
  max: null,
@@ -2287,10 +2326,7 @@ function childrenToString(children) {
2287
2326
  return String(children ?? "");
2288
2327
  }
2289
2328
  var builtinComponents = {
2290
- table: (props) => /* @__PURE__ */ u2("div", {
2291
- class: "table-container",
2292
- children: /* @__PURE__ */ u2("table", { ...props })
2293
- }),
2329
+ table: (props) => /* @__PURE__ */ u2("div", { class: "table-container", children: /* @__PURE__ */ u2("table", { ...props }) }),
2294
2330
  style: ({ children, ...rest }) => k("style", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } }),
2295
2331
  script: ({ children, ...rest }) => k("script", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } })
2296
2332
  };
@@ -2714,7 +2750,8 @@ function pagesFromAllFiles(allFiles, folderSlug, showSubfolders) {
2714
2750
  const subfolderFiles = /* @__PURE__ */ new Map();
2715
2751
  for (const file of allFiles) {
2716
2752
  if (file.unlisted === true) continue;
2717
- const fileSlug = file.slug;
2753
+ const rel = file.relativePath;
2754
+ const fileSlug = rel ? slugifyFilePath(rel) : file.slug;
2718
2755
  if (!fileSlug || !fileSlug.startsWith(folderPrefix)) continue;
2719
2756
  const relativePath = fileSlug.slice(folderPrefix.length);
2720
2757
  if (!relativePath || relativePath === "index") continue;
@@ -2840,7 +2877,9 @@ var FolderPage = (opts) => {
2840
2877
  for (const file of allFiles) {
2841
2878
  const slug2 = file?.slug;
2842
2879
  if (!slug2) continue;
2843
- const fileFolders = getFolders(slug2).filter((f3) => f3 !== "." && f3 !== "tags");
2880
+ const rel = file?.relativePath;
2881
+ const position3 = rel ? slugifyFilePath(rel) : slug2;
2882
+ const fileFolders = getFolders(position3).filter((f3) => f3 !== "." && f3 !== "tags");
2844
2883
  for (const f3 of fileFolders) {
2845
2884
  folders.add(f3);
2846
2885
  }