@enigmax/primitives 0.25.0 → 0.26.0

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 (48) hide show
  1. package/dist/chunk-4SZ5N7BA.js +121 -0
  2. package/dist/chunk-EYZ366LP.js +189 -0
  3. package/dist/chunk-ISXB5RUH.js +380 -0
  4. package/dist/chunk-JJVZYW5C.js +946 -0
  5. package/dist/chunk-QIIV2QSV.js +108 -0
  6. package/dist/chunk-RUEQ3TGP.js +155 -0
  7. package/dist/clipboard-menu-BvXJCSFN.d.ts +93 -0
  8. package/dist/context-BfjYGPnH.d.ts +54 -0
  9. package/dist/{clipboard-menu-B_ouitfS.d.ts → context-menu-D3FtTn7v.d.ts} +1 -91
  10. package/dist/index.d.ts +266 -2
  11. package/dist/index.js +4 -2
  12. package/dist/menu-MSQSE6U5.js +54 -0
  13. package/dist/menu-PNQRTRNV.js +33 -0
  14. package/dist/next/index.d.ts +6 -2
  15. package/dist/next/index.js +10 -6
  16. package/dist/react/context-menu.d.ts +8 -54
  17. package/dist/react/image.d.ts +109 -0
  18. package/dist/react/image.js +3 -0
  19. package/dist/react/index.d.ts +6 -2
  20. package/dist/react/index.js +10 -6
  21. package/dist/react/input.js +1 -1
  22. package/dist/react/video.d.ts +120 -0
  23. package/dist/react/video.js +3 -0
  24. package/dist/react-router/index.d.ts +6 -2
  25. package/dist/react-router/index.js +10 -6
  26. package/dist/viewer-73LSE6RR.js +3 -0
  27. package/package.json +15 -2
  28. package/recipes/image/styles.css +182 -0
  29. package/recipes/video/styles.css +154 -0
  30. package/registry.json +465 -0
  31. package/src/core/image-viewer.ts +222 -0
  32. package/src/core/player.ts +303 -0
  33. package/src/index.ts +52 -0
  34. package/src/react/image/icons.tsx +55 -0
  35. package/src/react/image/index.tsx +185 -0
  36. package/src/react/image/menu.tsx +76 -0
  37. package/src/react/image/styles.ts +213 -0
  38. package/src/react/image/types.ts +113 -0
  39. package/src/react/image/viewer.tsx +571 -0
  40. package/src/react/index.ts +3 -0
  41. package/src/react/video/icons.tsx +135 -0
  42. package/src/react/video/index.tsx +724 -0
  43. package/src/react/video/menu.tsx +66 -0
  44. package/src/react/video/rail.tsx +99 -0
  45. package/src/react/video/styles.ts +161 -0
  46. package/src/react/video/types.ts +135 -0
  47. /package/dist/{chunk-3MGBZOAU.js → chunk-RMNXVWQ4.js} +0 -0
  48. /package/dist/{chunk-MSOCCQGH.js → chunk-T7I6WJSN.js} +0 -0
@@ -0,0 +1,135 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ /**
4
+ * The player's icons, drawn rather than loaded - a sprite would be a request per player.
5
+ *
6
+ * All of them are on ONE 24x24 grid and inside it. That is not a formality: the gear used to
7
+ * carry a path with absolute `V21` and `H4` commands in it, which drew a shape half again the
8
+ * size of the box and hanging off the bottom of its button while every other control sat
9
+ * centred. An icon that leaves the viewBox cannot be centred by the button it is in.
10
+ *
11
+ * The size comes from the stylesheet (`--enigma-video-icon-size`), not from the label's font:
12
+ * `1.25em` of a 13px bar is a 16px icon, and the same markup in a project with larger text
13
+ * silently grew a different player.
14
+ */
15
+
16
+ function Glyph({ children, filled = false }: { children: ReactNode; filled?: boolean; }): ReactNode {
17
+ return (
18
+ <svg
19
+ viewBox="0 0 24 24"
20
+ width="1em"
21
+ height="1em"
22
+ fill={filled ? "currentColor" : "none"}
23
+ stroke={filled ? "none" : "currentColor"}
24
+ strokeWidth={2}
25
+ strokeLinecap="round"
26
+ strokeLinejoin="round"
27
+ aria-hidden="true"
28
+ >
29
+ {children}
30
+ </svg>
31
+ );
32
+ }
33
+
34
+ export function Play(): ReactNode {
35
+ // Centroid at x 11.7 rather than the box's 12: a triangle centred by its bounding box
36
+ // reads as sitting too far left, which is why every player nudges it right.
37
+ return <Glyph filled><path d="M8 5v14l11-7z" /></Glyph>;
38
+ }
39
+
40
+ export function Pause(): ReactNode {
41
+ return <Glyph filled><path d="M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" /></Glyph>;
42
+ }
43
+
44
+ export function Volume(): ReactNode {
45
+ return <Glyph><path d="M11 5 6 9H2v6h4l5 4z" /><path d="M15.5 8.5a5 5 0 0 1 0 7" /><path d="M19 5a10 10 0 0 1 0 14" /></Glyph>;
46
+ }
47
+
48
+ export function VolumeLow(): ReactNode {
49
+ return <Glyph><path d="M11 5 6 9H2v6h4l5 4z" /><path d="M15.5 8.5a5 5 0 0 1 0 7" /></Glyph>;
50
+ }
51
+
52
+ export function Muted(): ReactNode {
53
+ return <Glyph><path d="M11 5 6 9H2v6h4l5 4z" /><path d="m16 9 6 6M22 9l-6 6" /></Glyph>;
54
+ }
55
+
56
+ export function Captions(): ReactNode {
57
+ return <Glyph><rect x="2" y="5" width="20" height="14" rx="2.5" /><path d="M7 11h3M7 15h5M14 11h3M14 15h3" /></Glyph>;
58
+ }
59
+
60
+ /** The same box with the lines struck through, for captions that are off. */
61
+ export function CaptionsOff(): ReactNode {
62
+ return (
63
+ <Glyph>
64
+ <path d="M10.5 5H19.5a2.5 2.5 0 0 1 2.5 2.5v9M18 19H4.5A2.5 2.5 0 0 1 2 16.5v-9A2.5 2.5 0 0 1 4.5 5" />
65
+ <path d="M7 11h3M7 15h5" />
66
+ <path d="m3 3 18 18" />
67
+ </Glyph>
68
+ );
69
+ }
70
+
71
+ export function Settings(): ReactNode {
72
+ return (
73
+ <Glyph>
74
+ <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2Z" />
75
+ <circle cx="12" cy="12" r="3" />
76
+ </Glyph>
77
+ );
78
+ }
79
+
80
+ export function Pip(): ReactNode {
81
+ return <Glyph><path d="M21 11V6.5A2.5 2.5 0 0 0 18.5 4h-13A2.5 2.5 0 0 0 3 6.5v9A2.5 2.5 0 0 0 5.5 18H9" /><rect x="12" y="12" width="9" height="7" rx="1.5" /></Glyph>;
82
+ }
83
+
84
+ /** The screen with the signal arcs - the glyph every platform casts with. */
85
+ export function Cast(): ReactNode {
86
+ return (
87
+ <Glyph>
88
+ <path d="M3 8V6.5A2.5 2.5 0 0 1 5.5 4h13A2.5 2.5 0 0 1 21 6.5v11a2.5 2.5 0 0 1-2.5 2.5H13" />
89
+ <path d="M3 12a8 8 0 0 1 8 8" />
90
+ <path d="M3 16a4 4 0 0 1 4 4" />
91
+ <path d="M3 20h.01" />
92
+ </Glyph>
93
+ );
94
+ }
95
+
96
+ export function Expand(): ReactNode {
97
+ return <Glyph><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" /></Glyph>;
98
+ }
99
+
100
+ export function Collapse(): ReactNode {
101
+ return <Glyph><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5" /></Glyph>;
102
+ }
103
+
104
+ export function Download(): ReactNode {
105
+ return <Glyph><path d="M12 4v11M7 11l5 5 5-5M4 19h16" /></Glyph>;
106
+ }
107
+
108
+ /** The tick beside a chosen row in the settings panel. */
109
+ export function Check(): ReactNode {
110
+ return <Glyph><path d="m5 12.5 4.5 4.5L19 7" /></Glyph>;
111
+ }
112
+
113
+ export function ChevronRight(): ReactNode {
114
+ return <Glyph><path d="m9 5 7 7-7 7" /></Glyph>;
115
+ }
116
+
117
+ export function ChevronLeft(): ReactNode {
118
+ return <Glyph><path d="m15 5-7 7 7 7" /></Glyph>;
119
+ }
120
+
121
+ export function Loop(): ReactNode {
122
+ return <Glyph><path d="M17 2.5 20.5 6 17 9.5" /><path d="M3.5 12V9a3 3 0 0 1 3-3h14" /><path d="M7 21.5 3.5 18 7 14.5" /><path d="M20.5 12v3a3 3 0 0 1-3 3h-14" /></Glyph>;
123
+ }
124
+
125
+ export function Link(): ReactNode {
126
+ return <Glyph><path d="M10 13a5 5 0 0 0 7.07 0l2.83-2.83a5 5 0 0 0-7.07-7.07L11.5 4.4" /><path d="M14 11a5 5 0 0 0-7.07 0L4.1 13.83a5 5 0 0 0 7.07 7.07l1.3-1.3" /></Glyph>;
127
+ }
128
+
129
+ export function Clock(): ReactNode {
130
+ return <Glyph><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3.5 2" /></Glyph>;
131
+ }
132
+
133
+ export function Speed(): ReactNode {
134
+ return <Glyph><path d="M12 20a8 8 0 1 0-8-8" /><path d="M4 20h16" /><path d="m12 12 4.5-4.5" /></Glyph>;
135
+ }