astro-md-editor 0.0.3 → 0.0.5

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.
Files changed (25) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/index-UQt6zCrS.js +334 -0
  3. package/.output/public/assets/{main-_miJG8oz.js → main-DzXOjsqg.js} +1 -1
  4. package/.output/public/assets/styles-CezfLgHY.css +1 -0
  5. package/.output/server/{__root-C4T8UKZy.mjs → __root-CL_tq3ov.mjs} +1 -1
  6. package/.output/server/_libs/mixmark-io__domino.mjs +16632 -0
  7. package/.output/server/_libs/turndown.mjs +687 -675
  8. package/.output/server/_ssr/IconPickerPopover-fNUx2jAc.mjs +125 -0
  9. package/.output/server/_ssr/{ImageAssetBrowser-DWEdNK_g.mjs → ImageAssetBrowser-DNDdTqtf.mjs} +2 -2
  10. package/.output/server/_ssr/{collections.server-DyZEpKg6.mjs → collections.server-s12asITg.mjs} +24 -1
  11. package/.output/server/_ssr/{file-history.api-BLrUovD8.mjs → file-history.api-oydnxFVV.mjs} +8 -2
  12. package/.output/server/_ssr/{image-assets.server-Dn044pdj.mjs → image-assets.server-Ci2E1_Tm.mjs} +4 -2
  13. package/.output/server/_ssr/{image-preview.api-bqd1erIP.mjs → image-preview.api-pcN5PQhH.mjs} +2 -2
  14. package/.output/server/_ssr/{index-wJDNoCM2.mjs → index-BjQuGIib.mjs} +7 -2
  15. package/.output/server/_ssr/{index-2cOxFkCu.mjs → index-Bn1uKwTu.mjs} +527 -97
  16. package/.output/server/_ssr/index.mjs +17 -11
  17. package/.output/server/_ssr/{router-sxRLAh5a.mjs → router-dPC3iVPs.mjs} +2 -2
  18. package/.output/server/{_tanstack-start-manifest_v-CWdBk-ge.mjs → _tanstack-start-manifest_v-Da8tuNDH.mjs} +1 -1
  19. package/.output/server/index.mjs +50 -50
  20. package/LICENSE.md +21 -0
  21. package/README.md +71 -69
  22. package/package.json +3 -2
  23. package/scripts/bootstrap-collections.mjs +59 -13
  24. package/.output/public/assets/index-DVVq2QjK.js +0 -334
  25. package/.output/public/assets/styles-yeMm8TG7.css +0 -1
@@ -0,0 +1,125 @@
1
+ import { c as createServerRpc } from "./createServerRpc-29xaFZcb.mjs";
2
+ import { c as createServerFn } from "./index.mjs";
3
+ import "../_libs/tanstack__history.mjs";
4
+ import "../_libs/tanstack__router-core.mjs";
5
+ import "../_libs/cookie-es.mjs";
6
+ import "../_libs/tiny-invariant.mjs";
7
+ import "../_libs/seroval.mjs";
8
+ import "../_libs/seroval-plugins.mjs";
9
+ import "node:stream/web";
10
+ import "node:stream";
11
+ import "node:async_hooks";
12
+ import "../_libs/h3-v2.mjs";
13
+ import "../_libs/rou3.mjs";
14
+ import "../_libs/srvx.mjs";
15
+ import "node:http";
16
+ import "node:https";
17
+ import "node:http2";
18
+ import "../_libs/react.mjs";
19
+ import "../_libs/tanstack__react-router.mjs";
20
+ import "../_libs/react-dom.mjs";
21
+ import "util";
22
+ import "crypto";
23
+ import "async_hooks";
24
+ import "stream";
25
+ import "../_libs/isbot.mjs";
26
+ import "../_libs/tiny-warning.mjs";
27
+ function isObjectRecord(value) {
28
+ return typeof value === "object" && value !== null && !Array.isArray(value);
29
+ }
30
+ const listIconifyCollectionsServerFn_createServerFn_handler = createServerRpc({
31
+ id: "3ba1a566c82090c8422dd6ca7258b2e1aed644206364441faf1bd80942f21745",
32
+ name: "listIconifyCollectionsServerFn",
33
+ filename: "src/components/editor/IconPickerPopover.tsx"
34
+ }, (opts) => listIconifyCollectionsServerFn.__executeServer(opts));
35
+ const listIconifyCollectionsServerFn = createServerFn({
36
+ method: "GET"
37
+ }).handler(listIconifyCollectionsServerFn_createServerFn_handler, async () => {
38
+ const response = await fetch("https://api.iconify.design/collections?pretty=0");
39
+ if (!response.ok) {
40
+ throw new Error(`Iconify collections request failed (${response.status})`);
41
+ }
42
+ const payload = await response.json();
43
+ if (!isObjectRecord(payload)) {
44
+ throw new Error("Invalid Iconify collections response.");
45
+ }
46
+ const collections = [];
47
+ for (const [prefix, rawValue] of Object.entries(payload)) {
48
+ if (!isObjectRecord(rawValue)) {
49
+ continue;
50
+ }
51
+ const name = typeof rawValue.name === "string" && rawValue.name.trim().length > 0 ? rawValue.name.trim() : prefix;
52
+ const total = typeof rawValue.total === "number" && Number.isFinite(rawValue.total) ? rawValue.total : 0;
53
+ const category = typeof rawValue.category === "string" && rawValue.category.trim().length > 0 ? rawValue.category.trim() : void 0;
54
+ collections.push({
55
+ prefix,
56
+ name,
57
+ total,
58
+ category
59
+ });
60
+ }
61
+ return collections.sort((a, b) => {
62
+ return a.name.localeCompare(b.name, void 0, {
63
+ sensitivity: "base"
64
+ });
65
+ });
66
+ });
67
+ const listCollectionIconsServerFn_createServerFn_handler = createServerRpc({
68
+ id: "c9dff6ed7373b505d6aeeb84c63f87a0d0c205051d9d817929a5b500e5e79e03",
69
+ name: "listCollectionIconsServerFn",
70
+ filename: "src/components/editor/IconPickerPopover.tsx"
71
+ }, (opts) => listCollectionIconsServerFn.__executeServer(opts));
72
+ const listCollectionIconsServerFn = createServerFn({
73
+ method: "POST"
74
+ }).inputValidator((payload) => {
75
+ if (!isObjectRecord(payload)) {
76
+ throw new Error("Invalid icon collection payload.");
77
+ }
78
+ const prefix = payload.prefix;
79
+ if (typeof prefix !== "string" || prefix.trim().length === 0) {
80
+ throw new Error("Missing icon collection prefix.");
81
+ }
82
+ return {
83
+ prefix: prefix.trim().toLowerCase()
84
+ };
85
+ }).handler(listCollectionIconsServerFn_createServerFn_handler, async ({
86
+ data
87
+ }) => {
88
+ const response = await fetch(`https://api.iconify.design/collection?prefix=${encodeURIComponent(data.prefix)}&pretty=0`);
89
+ if (!response.ok) {
90
+ throw new Error(`Iconify collection request failed (${response.status})`);
91
+ }
92
+ const payload = await response.json();
93
+ if (!isObjectRecord(payload)) {
94
+ throw new Error("Invalid Iconify collection response.");
95
+ }
96
+ const iconNames = /* @__PURE__ */ new Set();
97
+ const uncategorized = payload.uncategorized;
98
+ if (Array.isArray(uncategorized)) {
99
+ for (const item of uncategorized) {
100
+ if (typeof item === "string" && item.length > 0) {
101
+ iconNames.add(item);
102
+ }
103
+ }
104
+ }
105
+ const categories = payload.categories;
106
+ if (isObjectRecord(categories)) {
107
+ for (const categoryItems of Object.values(categories)) {
108
+ if (!Array.isArray(categoryItems)) {
109
+ continue;
110
+ }
111
+ for (const item of categoryItems) {
112
+ if (typeof item === "string" && item.length > 0) {
113
+ iconNames.add(item);
114
+ }
115
+ }
116
+ }
117
+ }
118
+ return [...iconNames].sort((a, b) => a.localeCompare(b, void 0, {
119
+ sensitivity: "base"
120
+ }));
121
+ });
122
+ export {
123
+ listCollectionIconsServerFn_createServerFn_handler,
124
+ listIconifyCollectionsServerFn_createServerFn_handler
125
+ };
@@ -1,9 +1,9 @@
1
1
  import { c as createServerRpc } from "./createServerRpc-29xaFZcb.mjs";
2
- import { l as listImageAssetsForFile, r as readImageAssetPreviewById } from "./image-assets.server-Dn044pdj.mjs";
2
+ import { l as listImageAssetsForFile, r as readImageAssetPreviewById } from "./image-assets.server-Ci2E1_Tm.mjs";
3
3
  import { c as createServerFn } from "./index.mjs";
4
4
  import "node:fs/promises";
5
5
  import "node:path";
6
- import "./collections.server-DyZEpKg6.mjs";
6
+ import "./collections.server-s12asITg.mjs";
7
7
  import "../_libs/tanstack__history.mjs";
8
8
  import "../_libs/tanstack__router-core.mjs";
9
9
  import "../_libs/cookie-es.mjs";
@@ -33,11 +33,15 @@ function asFieldUiMap(value) {
33
33
  }
34
34
  const parsed = {};
35
35
  for (const [key, rawValue] of Object.entries(record)) {
36
- if (rawValue === "image" || rawValue === "imageArray" || rawValue === "color") {
36
+ if (rawValue === "image" || rawValue === "imageArray" || rawValue === "color" || rawValue === "icon") {
37
37
  if (rawValue === "color") {
38
38
  parsed[key] = { kind: "color" };
39
39
  continue;
40
40
  }
41
+ if (rawValue === "icon") {
42
+ parsed[key] = { kind: "icon" };
43
+ continue;
44
+ }
41
45
  parsed[key] = {
42
46
  kind: rawValue,
43
47
  mode: "asset"
@@ -59,10 +63,29 @@ function asFieldUiMap(value) {
59
63
  parsed[key] = {
60
64
  kind: "color"
61
65
  };
66
+ continue;
67
+ }
68
+ if (rawConfig.kind === "icon") {
69
+ const iconLibraries = asStringArray(rawConfig.iconLibraries) ?? asStringArray(rawConfig.icon_libraries);
70
+ parsed[key] = {
71
+ kind: "icon",
72
+ iconLibraries
73
+ };
62
74
  }
63
75
  }
64
76
  return Object.keys(parsed).length > 0 ? parsed : void 0;
65
77
  }
78
+ function asStringArray(value) {
79
+ if (!Array.isArray(value)) {
80
+ return void 0;
81
+ }
82
+ const parsed = [
83
+ ...new Set(
84
+ value.filter((item) => typeof item === "string").map((item) => item.trim().toLowerCase()).filter((item) => item.length > 0)
85
+ )
86
+ ];
87
+ return parsed.length > 0 ? parsed : void 0;
88
+ }
66
89
  function cloneObjectRecord(value) {
67
90
  return JSON.parse(JSON.stringify(value));
68
91
  }
@@ -3,7 +3,7 @@ import { execFile as execFile$1 } from "node:child_process";
3
3
  import { isAbsolute, resolve, relative } from "node:path";
4
4
  import { promisify } from "node:util";
5
5
  import { m as matter } from "../_libs/gray-matter.mjs";
6
- import { getCollectionsRootPath } from "./collections.server-DyZEpKg6.mjs";
6
+ import { getCollectionsRootPath } from "./collections.server-s12asITg.mjs";
7
7
  import { c as createServerFn } from "./index.mjs";
8
8
  import "../_libs/react.mjs";
9
9
  import "fs";
@@ -132,7 +132,13 @@ function parseGitHistoryOutput(params) {
132
132
  if (parts.length < 5) {
133
133
  continue;
134
134
  }
135
- const [sha = "", shortSha = "", author = "", dateIso = "", ...messageParts] = parts;
135
+ const [
136
+ sha = "",
137
+ shortSha = "",
138
+ author = "",
139
+ dateIso = "",
140
+ ...messageParts
141
+ ] = parts;
136
142
  if (!sha || !shortSha || !dateIso) {
137
143
  continue;
138
144
  }
@@ -1,6 +1,6 @@
1
1
  import { readdir, readFile } from "node:fs/promises";
2
2
  import { dirname, resolve, relative, join, extname } from "node:path";
3
- import { getCollectionsRootPath } from "./collections.server-DyZEpKg6.mjs";
3
+ import { getCollectionsRootPath } from "./collections.server-s12asITg.mjs";
4
4
  const IMAGE_MIME_TYPES = {
5
5
  ".png": "image/png",
6
6
  ".jpg": "image/jpeg",
@@ -141,7 +141,9 @@ async function readImagePreviewBySourcePath(params) {
141
141
  throw new Error("Image path is empty.");
142
142
  }
143
143
  if (isRemoteSourcePath(normalizedSourcePath)) {
144
- throw new Error("Remote image URLs are not resolved through local preview.");
144
+ throw new Error(
145
+ "Remote image URLs are not resolved through local preview."
146
+ );
145
147
  }
146
148
  const currentFileAbsolutePath = resolve(params.currentFilePath);
147
149
  assertPathWithinRoot(rootDir, currentFileAbsolutePath);
@@ -1,9 +1,9 @@
1
1
  import { c as createServerRpc } from "./createServerRpc-29xaFZcb.mjs";
2
- import { a as readImagePreviewBySourcePath } from "./image-assets.server-Dn044pdj.mjs";
2
+ import { a as readImagePreviewBySourcePath } from "./image-assets.server-Ci2E1_Tm.mjs";
3
3
  import { c as createServerFn } from "./index.mjs";
4
4
  import "node:fs/promises";
5
5
  import "node:path";
6
- import "./collections.server-DyZEpKg6.mjs";
6
+ import "./collections.server-s12asITg.mjs";
7
7
  import "../_libs/tanstack__history.mjs";
8
8
  import "../_libs/tanstack__router-core.mjs";
9
9
  import "../_libs/cookie-es.mjs";
@@ -2,7 +2,7 @@ import { c as createServerRpc } from "./createServerRpc-29xaFZcb.mjs";
2
2
  import { writeFile, unlink, access, mkdir } from "node:fs/promises";
3
3
  import { resolve } from "node:path";
4
4
  import { m as matter } from "../_libs/gray-matter.mjs";
5
- import { getCollectionsData, updateCollectionsFileCache, removeCollectionsFileCache, getCollectionsRootPath, appendCollectionsFileCache } from "./collections.server-DyZEpKg6.mjs";
5
+ import { getCollectionsData, updateCollectionsFileCache, removeCollectionsFileCache, getCollectionsRootPath, appendCollectionsFileCache } from "./collections.server-s12asITg.mjs";
6
6
  import { c as createServerFn } from "./index.mjs";
7
7
  import "../_libs/react.mjs";
8
8
  import "fs";
@@ -121,7 +121,12 @@ async function createEditorSelection(input) {
121
121
  }
122
122
  const extension = inferFileExtension(collection.files);
123
123
  const rootPath = getCollectionsRootPath();
124
- const collectionDir = resolve(rootPath, "src", "content", input.collectionName);
124
+ const collectionDir = resolve(
125
+ rootPath,
126
+ "src",
127
+ "content",
128
+ input.collectionName
129
+ );
125
130
  const nextFilePath = resolve(collectionDir, `${normalizedSlug}${extension}`);
126
131
  try {
127
132
  await access(nextFilePath);