@mmapp/react 0.1.0-alpha.18 → 0.1.0-alpha.19

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 (52) hide show
  1. package/dist/actions-MFI2V4DX.mjs +116 -0
  2. package/dist/atoms/index.d.mts +2 -2
  3. package/dist/atoms/index.d.ts +2 -2
  4. package/dist/atoms/index.js +1 -1
  5. package/dist/atoms/index.mjs +1 -1
  6. package/dist/builtin-atoms-C-sNyYJl.d.mts +647 -0
  7. package/dist/builtin-atoms-C-sNyYJl.d.ts +647 -0
  8. package/dist/builtin-atoms-DCKrjG7i.d.mts +96 -0
  9. package/dist/builtin-atoms-DCKrjG7i.d.ts +96 -0
  10. package/dist/builtin-atoms-DRD3EwG6.d.mts +648 -0
  11. package/dist/builtin-atoms-DRD3EwG6.d.ts +648 -0
  12. package/dist/builtin-atoms-jt04b7Rw.d.mts +643 -0
  13. package/dist/builtin-atoms-jt04b7Rw.d.ts +643 -0
  14. package/dist/chunk-247T4GDJ.mjs +677 -0
  15. package/dist/chunk-3H6CR7E7.mjs +1924 -0
  16. package/dist/chunk-3PL6FL6I.mjs +96 -0
  17. package/dist/chunk-3SJSW3C4.mjs +2039 -0
  18. package/dist/chunk-5OI2VI57.mjs +1964 -0
  19. package/dist/chunk-CL6FYZ43.mjs +105 -0
  20. package/dist/chunk-ENQOCZI5.mjs +1938 -0
  21. package/dist/chunk-FB3WCZAU.mjs +512 -0
  22. package/dist/chunk-GLJ7VC7Z.mjs +684 -0
  23. package/dist/chunk-HHMWR6NA.mjs +504 -0
  24. package/dist/chunk-HULEMSN2.mjs +120 -0
  25. package/dist/chunk-J5MW6CRU.mjs +1938 -0
  26. package/dist/chunk-PNTTKNYU.mjs +677 -0
  27. package/dist/chunk-TY5OTJP4.mjs +684 -0
  28. package/dist/chunk-WV7DVCP6.mjs +513 -0
  29. package/dist/chunk-YFMPTGUF.mjs +677 -0
  30. package/dist/{chunk-2VJQJM7S.mjs → chunk-ZDWACXZN.mjs} +1 -1
  31. package/dist/composition-BJ6QQTWT.mjs +12 -0
  32. package/dist/composition-XBGKKCI7.mjs +57 -0
  33. package/dist/content-QVPFUG4P.mjs +246 -0
  34. package/dist/control-flow-CBREHWJW.mjs +35 -0
  35. package/dist/control-flow-FWBOI6SM.mjs +35 -0
  36. package/dist/control-flow-ZWUGCDSP.mjs +35 -0
  37. package/dist/data-WCMIZYKD.mjs +97 -0
  38. package/dist/grouping-E6F377VZ.mjs +204 -0
  39. package/dist/grouping-FRPOEXO3.mjs +233 -0
  40. package/dist/index.d.mts +4 -433
  41. package/dist/index.d.ts +4 -433
  42. package/dist/index.js +3648 -581
  43. package/dist/index.mjs +335 -1040
  44. package/dist/input-PUOZDNSI.mjs +222 -0
  45. package/dist/layout-RATDMCLP.mjs +106 -0
  46. package/dist/navigation-VCT7ZBMA.mjs +15 -0
  47. package/dist/navigation-WFV7YWOU.mjs +14 -0
  48. package/dist/player/index.d.mts +37 -11
  49. package/dist/player/index.d.ts +37 -11
  50. package/dist/player/index.js +3280 -174
  51. package/dist/player/index.mjs +55 -5
  52. package/package.json +4 -4
@@ -0,0 +1,96 @@
1
+ // src/player/atoms/composition.tsx
2
+ import React, { createContext, useContext, useMemo } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var SlotRegistryContext = createContext(/* @__PURE__ */ new Map());
5
+ var SlotRegistryProvider = ({ contributions, children }) => {
6
+ const registry = useMemo(() => {
7
+ const map = /* @__PURE__ */ new Map();
8
+ for (const c of contributions) {
9
+ const list = map.get(c.name) ?? [];
10
+ list.push(c);
11
+ map.set(c.name, list);
12
+ }
13
+ for (const [, list] of map) {
14
+ list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
15
+ }
16
+ return map;
17
+ }, [contributions]);
18
+ return /* @__PURE__ */ jsx(SlotRegistryContext.Provider, { value: registry, children });
19
+ };
20
+ function useSlotContributions(name) {
21
+ const registry = useContext(SlotRegistryContext);
22
+ return registry.get(name) ?? [];
23
+ }
24
+ var Slot = ({ children, name, fallback, className, style }) => {
25
+ const slotName = name ?? "";
26
+ const contributions = useSlotContributions(slotName);
27
+ const content = contributions.length > 0 ? contributions.map((c, i) => /* @__PURE__ */ jsx(React.Fragment, { children: c.tree }, i)) : children ?? fallback;
28
+ if (!content) return null;
29
+ return /* @__PURE__ */ jsx(
30
+ "div",
31
+ {
32
+ className,
33
+ "data-slot": slotName,
34
+ style,
35
+ children: content
36
+ }
37
+ );
38
+ };
39
+ var ModuleOutlet = ({ children, module: moduleName, basePath, className, style }) => {
40
+ const moduleKey = moduleName ?? "";
41
+ const contributions = useSlotContributions(`module:${moduleKey}`);
42
+ if (contributions.length > 0) {
43
+ return /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ className,
47
+ "data-module": moduleKey,
48
+ style,
49
+ children: contributions.map((c, i) => /* @__PURE__ */ jsx(React.Fragment, { children: c.tree }, i))
50
+ }
51
+ );
52
+ }
53
+ if (children) {
54
+ return /* @__PURE__ */ jsx(
55
+ "div",
56
+ {
57
+ className,
58
+ "data-module": moduleKey,
59
+ style,
60
+ children
61
+ }
62
+ );
63
+ }
64
+ return /* @__PURE__ */ jsxs(
65
+ "div",
66
+ {
67
+ className,
68
+ "data-module": moduleKey,
69
+ style: {
70
+ padding: 16,
71
+ border: "1px dashed #cbd5e0",
72
+ borderRadius: 8,
73
+ color: "#a0aec0",
74
+ fontSize: 13,
75
+ textAlign: "center",
76
+ ...style
77
+ },
78
+ children: [
79
+ "Module: ",
80
+ String(moduleName ?? "unknown"),
81
+ basePath ? /* @__PURE__ */ jsxs("span", { children: [
82
+ " (",
83
+ String(basePath),
84
+ ")"
85
+ ] }) : null
86
+ ]
87
+ }
88
+ );
89
+ };
90
+
91
+ export {
92
+ SlotRegistryProvider,
93
+ useSlotContributions,
94
+ Slot,
95
+ ModuleOutlet
96
+ };