fluxplugin 1.0.2 → 1.0.4

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 (50) hide show
  1. package/README.md +15 -12
  2. package/dist/browser/chunks/chunk-AV4KI7LI.js +1792 -0
  3. package/dist/browser/chunks/{chunk-TL63576R.js → chunk-OAYWYU5O.js} +48 -11
  4. package/dist/browser/index.js +3 -1
  5. package/dist/browser/manager-ui.js +386 -185
  6. package/dist/browser/react.js +46 -2
  7. package/dist/cli.js +3622 -257
  8. package/dist/node/chunks/{chunk-EVX2O65A.js → chunk-SDCGUBEW.js} +49 -11
  9. package/dist/node/chunks/{chunk-C7VWZZOX.js → chunk-ZLA5XUXN.js} +175 -51
  10. package/dist/node/cli-api.js +742 -76
  11. package/dist/node/index.js +3 -1
  12. package/dist/node/main.js +8 -2
  13. package/dist/node/preload.js +1 -1
  14. package/dist/types/cli/build.d.ts +5 -0
  15. package/dist/types/cli/cli.d.ts +2 -0
  16. package/dist/types/cli/dist.d.ts +18 -0
  17. package/dist/types/cli/host-templates.d.ts +2 -0
  18. package/dist/types/cli/store.d.ts +13 -0
  19. package/dist/types/cli/templates.d.ts +2 -0
  20. package/dist/types/core/manifest.d.ts +15 -1
  21. package/dist/types/core/protocol.d.ts +18 -5
  22. package/dist/types/core/registry.d.ts +11 -0
  23. package/dist/types/core/routes.d.ts +3 -1
  24. package/dist/types/main/adapters.d.ts +3 -0
  25. package/dist/types/main/assets.d.ts +8 -0
  26. package/dist/types/main/github-registry.d.ts +2 -1
  27. package/dist/types/main/index.d.ts +1 -0
  28. package/dist/types/main/registry.d.ts +55 -18
  29. package/dist/types/main/stores.d.ts +7 -1
  30. package/dist/types/manager-ui/index.d.ts +35 -3
  31. package/dist/types/react/base-css.d.ts +6 -2
  32. package/dist/types/react/http-bridge.d.ts +5 -0
  33. package/dist/types/react/i18n.d.ts +33 -0
  34. package/dist/types/react/index.d.ts +5 -0
  35. package/dist/types/react/markdown.d.ts +2 -1
  36. package/dist/types/react/media.d.ts +33 -0
  37. package/dist/types/react/settings.d.ts +6 -0
  38. package/dist/types/react/sidebar.d.ts +42 -0
  39. package/dist/types/react/theme.d.ts +42 -4
  40. package/dist/types/react/ui.d.ts +42 -0
  41. package/docs/CUSTOMIZING.md +56 -0
  42. package/docs/STORE.md +19 -0
  43. package/docs/screenshots/plugin-page.png +0 -0
  44. package/docs/screenshots/settings-appearance.png +0 -0
  45. package/docs/screenshots/site-guide-dark.png +0 -0
  46. package/docs/screenshots/site-home.png +0 -0
  47. package/docs/screenshots/site-mobile.png +0 -0
  48. package/docs/screenshots/site-search.png +0 -0
  49. package/package.json +1 -1
  50. package/dist/browser/chunks/chunk-VXQJIDXW.js +0 -1232
@@ -532,7 +532,7 @@ var manifestSchema = s.object({
532
532
  /** Detailed description as Markdown (default: ./README.md). Rendered safely: no raw HTML. */
533
533
  readme: s.string().optional(),
534
534
  /** Explanation video (https URL; YouTube and Vimeo are embedded, other hosts become a link). */
535
- video: s.string({ pattern: /^https:\/\/\S+$/ }).optional(),
535
+ video: s.string({ pattern: /^(https:\/\/\S+|\.\/\S+)$/ }).optional(),
536
536
  categories: s.array(s.string()).default([]),
537
537
  keywords: s.array(s.string()).default([]),
538
538
  /** Extra links: docs, support, changelog, funding... */
@@ -593,24 +593,33 @@ function validateManifest(raw, opts = {}) {
593
593
  }
594
594
  return { ok: issues.length === 0, manifest: issues.length ? void 0 : manifest, issues, warnings };
595
595
  }
596
- function videoEmbedUrl(url) {
596
+ var MEDIA_EXT = /\.(mp4|m4v|webm|ogv|ogg|mov)(\?.*)?$/i;
597
+ function parseVideo(url) {
597
598
  if (!url) return void 0;
599
+ if (url.startsWith("./")) return MEDIA_EXT.test(url) ? { kind: "html5", url, src: url } : void 0;
598
600
  let u;
599
601
  try {
600
602
  u = new URL(url);
601
603
  } catch {
602
604
  return void 0;
603
605
  }
606
+ if (u.protocol !== "https:") return void 0;
607
+ if (MEDIA_EXT.test(u.pathname)) return { kind: "html5", url, src: url };
604
608
  const host = u.hostname.replace(/^www\./, "");
609
+ const last = u.pathname.split("/").filter(Boolean).pop() ?? "";
605
610
  let id;
606
611
  if (host === "youtu.be") id = u.pathname.slice(1);
607
- else if (host === "youtube.com" || host === "m.youtube.com") id = u.searchParams.get("v") ?? (/^\/(embed|shorts)\//.test(u.pathname) ? u.pathname.split("/")[2] : void 0);
608
- if (id && /^[\w-]{6,20}$/.test(id)) return `https://www.youtube-nocookie.com/embed/${id}`;
609
- if (host === "vimeo.com" || host === "player.vimeo.com") {
610
- const vid = u.pathname.split("/").filter(Boolean).pop();
611
- if (vid && /^\d+$/.test(vid)) return `https://player.vimeo.com/video/${vid}`;
612
- }
613
- return void 0;
612
+ else if (host === "youtube.com" || host === "m.youtube.com" || host === "youtube-nocookie.com") id = u.searchParams.get("v") ?? (/^\/(embed|shorts|live)\//.test(u.pathname) ? u.pathname.split("/")[2] : void 0);
613
+ if (id && /^[\w-]{6,20}$/.test(id)) return { kind: "youtube", url, embedUrl: `https://www.youtube-nocookie.com/embed/${id}` };
614
+ if ((host === "vimeo.com" || host === "player.vimeo.com") && /^\d+$/.test(last)) return { kind: "vimeo", url, embedUrl: `https://player.vimeo.com/video/${last}` };
615
+ if (host === "dailymotion.com" && /^\/(embed\/)?video\//.test(u.pathname) && /^\w+$/.test(last)) return { kind: "dailymotion", url, embedUrl: `https://www.dailymotion.com/embed/video/${last}` };
616
+ if (host === "dai.ly" && /^\w+$/.test(last)) return { kind: "dailymotion", url, embedUrl: `https://www.dailymotion.com/embed/video/${last}` };
617
+ if (host === "loom.com" && /^\/(share|embed)\//.test(u.pathname) && /^[\w-]+$/.test(last)) return { kind: "loom", url, embedUrl: `https://www.loom.com/embed/${last}` };
618
+ if (host === "streamable.com" && /^\w+$/.test(last)) return { kind: "streamable", url, embedUrl: `https://streamable.com/e/${last}` };
619
+ return { kind: "link", url };
620
+ }
621
+ function videoEmbedUrl(url) {
622
+ return parseVideo(url)?.embedUrl;
614
623
  }
615
624
 
616
625
  // src/core/events.ts
@@ -1043,6 +1052,32 @@ var MenuRegistry = class extends Registry {
1043
1052
  register(item, owner) {
1044
1053
  return this.add(`${item.location}:${item.id}`, item, owner);
1045
1054
  }
1055
+ /**
1056
+ * Hierarchical view of a location: items that name a `parent`, plus the parent's own `children`, are nested under it
1057
+ * (sorted by order). Unknown parents fall back to top level, so a missing plugin never hides its siblings.
1058
+ */
1059
+ tree(location) {
1060
+ const flat = this.items(location);
1061
+ const byId = new Map(flat.map((i) => [i.id, i]));
1062
+ const toNode = (i) => ({ ...i, children: [...i.children ?? []] });
1063
+ const nodes = new Map(flat.map((i) => [i.id, toNode(i)]));
1064
+ const roots = [];
1065
+ for (const i of flat) {
1066
+ const n = nodes.get(i.id);
1067
+ const parent = i.parent && i.parent !== i.id ? nodes.get(i.parent) : void 0;
1068
+ if (parent && byId.has(i.parent)) parent.children.push(n);
1069
+ else roots.push(n);
1070
+ }
1071
+ const sort = (list) => {
1072
+ list.sort((a, b) => (a.order ?? 100) - (b.order ?? 100) || a.label.localeCompare(b.label));
1073
+ for (const n of list) {
1074
+ if (n.children?.length) sort(n.children);
1075
+ else delete n.children;
1076
+ }
1077
+ };
1078
+ sort(roots);
1079
+ return roots;
1080
+ }
1046
1081
  items(location) {
1047
1082
  return this.list().filter((m) => m.location === location && (!m.when || m.when())).sort((a, b) => (a.group ?? "").localeCompare(b.group ?? "") || (a.order ?? 100) - (b.order ?? 100) || a.label.localeCompare(b.label));
1048
1083
  }
@@ -2309,10 +2344,11 @@ var PluginManager = class {
2309
2344
  id: `route:${route.fullPath}`,
2310
2345
  location: menu.location ?? "sidebar",
2311
2346
  label: menu.label ?? meta.title ?? route.fullPath,
2312
- icon: meta.icon,
2347
+ icon: menu.icon ?? meta.icon,
2313
2348
  path: route.fullPath,
2314
2349
  order: menu.order,
2315
- group: menu.group
2350
+ group: menu.group,
2351
+ parent: menu.parent
2316
2352
  },
2317
2353
  owner
2318
2354
  );
@@ -2600,6 +2636,7 @@ export {
2600
2636
  menuLocations,
2601
2637
  manifestSchema,
2602
2638
  validateManifest,
2639
+ parseVideo,
2603
2640
  videoEmbedUrl,
2604
2641
  matchesPattern,
2605
2642
  EventBus,
@@ -57,6 +57,7 @@ import {
57
57
  normalizePath,
58
58
  parseOrThrow,
59
59
  parseVersion,
60
+ parseVideo,
60
61
  pluginApi,
61
62
  preloadMember,
62
63
  routePatternMatches,
@@ -68,7 +69,7 @@ import {
68
69
  validateManifest,
69
70
  videoEmbedUrl,
70
71
  withTimeout
71
- } from "./chunks/chunk-TL63576R.js";
72
+ } from "./chunks/chunk-OAYWYU5O.js";
72
73
  export {
73
74
  BUILTIN_PERMISSIONS,
74
75
  CHANNELS,
@@ -128,6 +129,7 @@ export {
128
129
  normalizePath,
129
130
  parseOrThrow,
130
131
  parseVersion,
132
+ parseVideo,
131
133
  pluginApi,
132
134
  preloadMember,
133
135
  routePatternMatches,