@drawnagency/primitives 0.1.26 → 0.1.27

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 (107) hide show
  1. package/dist/{chunk-UMSFICAC.js → chunk-DKOUFIP6.js} +0 -1
  2. package/dist/{chunk-FSVPD7TW.js → chunk-HXXZBTPF.js} +12 -5
  3. package/dist/{chunk-IP6ODLXX.js → chunk-JHSYLVKI.js} +19 -84
  4. package/dist/{chunk-P24YUT3O.js → chunk-MNK7XA6S.js} +1 -1
  5. package/dist/{chunk-EAEX6DS7.js → chunk-V43WVSVS.js} +3 -2
  6. package/dist/components/editor/SectionOrderingModal.d.ts +10 -0
  7. package/dist/components/editor/SectionOrderingModal.d.ts.map +1 -0
  8. package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
  9. package/dist/components/primitives/EditableRichText.d.ts.map +1 -1
  10. package/dist/components/sections/Button/index.d.ts.map +1 -1
  11. package/dist/components/sections/Colors/index.d.ts.map +1 -1
  12. package/dist/components/sections/DoDontMediaGrid/index.d.ts.map +1 -1
  13. package/dist/components/sections/IconList/index.d.ts.map +1 -1
  14. package/dist/components/sections/LinkHeading/index.d.ts.map +1 -1
  15. package/dist/components/sections/MediaGrid/index.d.ts.map +1 -1
  16. package/dist/components/sections/Prose/index.d.ts.map +1 -1
  17. package/dist/components/sections/SplitContent/index.d.ts.map +1 -1
  18. package/dist/components/sections/SubHeading/index.d.ts.map +1 -1
  19. package/dist/components/sections/SubSubHeading/index.d.ts.map +1 -1
  20. package/dist/components/sections/ViewRenderer.d.ts +0 -1
  21. package/dist/components/sections/ViewRenderer.d.ts.map +1 -1
  22. package/dist/components/sections/register-schemas.d.ts.map +1 -1
  23. package/dist/components/sections/register.d.ts.map +1 -1
  24. package/dist/components/shell/EditorShell.d.ts +0 -1
  25. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  26. package/dist/deploy/index.d.ts +2 -0
  27. package/dist/deploy/index.d.ts.map +1 -0
  28. package/dist/deploy/types.d.ts +12 -0
  29. package/dist/deploy/types.d.ts.map +1 -0
  30. package/dist/hooks/useEditorPublish.d.ts.map +1 -1
  31. package/dist/hooks/useMediaPipeline.d.ts.map +1 -1
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +10 -8
  35. package/dist/lib/dexie.d.ts +4 -1
  36. package/dist/lib/dexie.d.ts.map +1 -1
  37. package/dist/lib/dexie.js +319 -0
  38. package/dist/lib/index.js +3 -3
  39. package/dist/lib/nav.d.ts +2 -6
  40. package/dist/lib/nav.d.ts.map +1 -1
  41. package/dist/lib/registry.d.ts +14 -0
  42. package/dist/lib/registry.d.ts.map +1 -1
  43. package/dist/lib/text.d.ts +3 -0
  44. package/dist/lib/text.d.ts.map +1 -0
  45. package/dist/media/index.d.ts +4 -2
  46. package/dist/media/index.d.ts.map +1 -1
  47. package/dist/media/index.js +8 -6
  48. package/dist/media/provider.d.ts +7 -0
  49. package/dist/media/provider.d.ts.map +1 -0
  50. package/dist/media/resolve.d.ts +3 -2
  51. package/dist/media/resolve.d.ts.map +1 -1
  52. package/dist/media/types.d.ts +0 -9
  53. package/dist/media/types.d.ts.map +1 -1
  54. package/dist/schemas/index.js +3 -3
  55. package/dist/schemas/media.d.ts +0 -3
  56. package/dist/schemas/media.d.ts.map +1 -1
  57. package/dist/schemas/site-config.d.ts +1 -3
  58. package/dist/schemas/site-config.d.ts.map +1 -1
  59. package/dist/storage/index.d.ts +2 -0
  60. package/dist/storage/index.d.ts.map +1 -0
  61. package/dist/storage/types.d.ts +21 -0
  62. package/dist/storage/types.d.ts.map +1 -0
  63. package/package.json +5 -1
  64. package/src/components/editor/DragHandle.tsx +1 -1
  65. package/src/components/editor/SectionOrderingModal.tsx +215 -0
  66. package/src/components/editor/SectionWrapper.tsx +3 -1
  67. package/src/components/primitives/EditableRichText.tsx +4 -2
  68. package/src/components/sections/Button/index.tsx +1 -0
  69. package/src/components/sections/Colors/index.tsx +8 -0
  70. package/src/components/sections/DoDontMediaGrid/index.tsx +8 -0
  71. package/src/components/sections/IconList/index.tsx +4 -0
  72. package/src/components/sections/LinkHeading/index.tsx +2 -0
  73. package/src/components/sections/MediaGrid/index.tsx +8 -0
  74. package/src/components/sections/Prose/index.tsx +2 -0
  75. package/src/components/sections/SplitContent/index.tsx +16 -2
  76. package/src/components/sections/SubHeading/index.tsx +2 -0
  77. package/src/components/sections/SubSubHeading/index.tsx +2 -0
  78. package/src/components/sections/ViewRenderer.tsx +3 -1
  79. package/src/components/sections/register-schemas.ts +0 -2
  80. package/src/components/sections/register.ts +0 -2
  81. package/src/components/shell/EditorShell.tsx +40 -9
  82. package/src/deploy/index.ts +1 -0
  83. package/src/deploy/types.ts +12 -0
  84. package/src/hooks/useEditorPublish.ts +18 -43
  85. package/src/hooks/useMediaPipeline.ts +41 -11
  86. package/src/hooks/useResolvedMedia.ts +3 -3
  87. package/src/index.ts +2 -0
  88. package/src/lib/dexie.ts +28 -1
  89. package/src/lib/nav.ts +16 -9
  90. package/src/lib/registry.ts +10 -0
  91. package/src/lib/text.ts +8 -0
  92. package/src/media/index.ts +13 -4
  93. package/src/media/provider.ts +7 -0
  94. package/src/media/resolve.ts +9 -6
  95. package/src/media/types.ts +0 -9
  96. package/src/schemas/media.ts +0 -1
  97. package/src/schemas/site-config.ts +1 -0
  98. package/src/storage/index.ts +1 -0
  99. package/src/storage/types.ts +23 -0
  100. package/dist/components/sections/SplitContent/SplitContentSettings.d.ts +0 -9
  101. package/dist/components/sections/SplitContent/SplitContentSettings.d.ts.map +0 -1
  102. package/dist/media/github.d.ts +0 -3
  103. package/dist/media/github.d.ts.map +0 -1
  104. package/src/components/sections/SplitContent/SplitContentSettings.d.ts +0 -9
  105. package/src/components/sections/SplitContent/SplitContentSettings.d.ts.map +0 -1
  106. package/src/components/sections/SplitContent/SplitContentSettings.tsx +0 -42
  107. package/src/media/github.ts +0 -72
@@ -1,42 +0,0 @@
1
- import { useState } from "react";
2
- import { Select } from "../../shared/Select";
3
- import { Checkbox } from "../../shared/Checkbox";
4
-
5
- export function SplitContentSettings({
6
- imagePosition: initialPos,
7
- border: initialBorder,
8
- onChange,
9
- }: {
10
- imagePosition: "left" | "right";
11
- border: boolean;
12
- onChange: (values: { imagePosition: "left" | "right"; border: boolean }) => void;
13
- }) {
14
- const [imagePosition, setImagePosition] = useState(initialPos);
15
- const [border, setBorder] = useState(initialBorder);
16
-
17
- const emit = (overrides: Partial<{ imagePosition: "left" | "right"; border: boolean }>) =>
18
- onChange({ imagePosition, border, ...overrides });
19
-
20
- return (
21
- <div className="space-y-4">
22
- <Select
23
- label="Image Position"
24
- value={imagePosition}
25
- onChange={(val) => {
26
- const v = val as "left" | "right";
27
- setImagePosition(v);
28
- emit({ imagePosition: v });
29
- }}
30
- options={[
31
- { value: "left", label: "Left" },
32
- { value: "right", label: "Right" },
33
- ]}
34
- />
35
- <Checkbox
36
- checked={border}
37
- onChange={(v) => { setBorder(v); emit({ border: v }); }}
38
- label="Show border"
39
- />
40
- </div>
41
- );
42
- }
@@ -1,72 +0,0 @@
1
- import type { MediaAdapter, MediaFile, MediaItem, MediaManifest, ResolvedMedia } from "./types";
2
- import { sanitizeMediaName, mimeToExt, hashFileBuffer } from "./utils";
3
-
4
- export function createGitHubMediaAdapter(manifest: MediaManifest): MediaAdapter {
5
- return {
6
- async hash(file: MediaFile): Promise<string> {
7
- return hashFileBuffer(file.buffer);
8
- },
9
-
10
- async exists(hash: string): Promise<boolean> {
11
- return hash in manifest.images;
12
- },
13
-
14
- async process(file: MediaFile, hash: string, _sizes: number[]): Promise<MediaItem> {
15
- const name = sanitizeMediaName(file.originalName);
16
- const folder = `${name}-${hash}`;
17
- return {
18
- id: hash, hash, kind: "image", originalName: name,
19
- width: 0, height: 0, mimeType: "image/webp", size: 0, folder, variants: [], alt: "",
20
- };
21
- },
22
-
23
- async delete(id: string): Promise<void> {
24
- delete manifest.images[id];
25
- },
26
-
27
- resolve(id: string, sizes: number[]): ResolvedMedia | null {
28
- const item = manifest.images[id];
29
- if (!item) return null;
30
-
31
- if (item.kind === "video") {
32
- return {
33
- tag: "video",
34
- src: `/api/media/${id}/original.${mimeToExt(item.mimeType)}`,
35
- poster: `/api/media/${id}/poster.webp`,
36
- width: item.width, height: item.height,
37
- autoplay: true, loop: true, muted: true,
38
- };
39
- }
40
-
41
- if (item.kind === "animated") {
42
- return {
43
- tag: "img",
44
- src: `/api/media/${id}/original.${mimeToExt(item.mimeType)}`,
45
- width: item.width, height: item.height,
46
- };
47
- }
48
-
49
- // Static image with srcset
50
- const availableVariants = item.variants.filter((v) =>
51
- sizes.length === 0 || sizes.includes(v.width),
52
- );
53
- const sorted = [...availableVariants].sort((a, b) => a.width - b.width);
54
- const midIndex = Math.floor(sorted.length / 2);
55
- const defaultVariant = sorted[midIndex] ?? sorted[0];
56
- if (!defaultVariant) return null;
57
-
58
- const srcSet = sorted.map((v) => `/api/media/${id}/${v.width}.webp ${v.width}w`).join(", ");
59
-
60
- return {
61
- tag: "img",
62
- src: `/api/media/${id}/${defaultVariant.width}.webp`,
63
- srcSet,
64
- width: item.width, height: item.height,
65
- };
66
- },
67
-
68
- async list(): Promise<MediaItem[]> {
69
- return Object.values(manifest.images);
70
- },
71
- };
72
- }