@drawnagency/primitives 0.1.94 → 0.1.96

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 (82) hide show
  1. package/dist/{chunk-UFOWXOG6.js → chunk-CS2ECR3U.js} +9 -3
  2. package/dist/{chunk-GDLH3LVH.js → chunk-CSVGCAIH.js} +7 -6
  3. package/dist/chunk-EUSWEVOA.js +29 -0
  4. package/dist/{chunk-677NTHAZ.js → chunk-PTOLUMGV.js} +3 -0
  5. package/dist/{chunk-XYFZ57AS.js → chunk-YUUUCDXN.js} +59 -5
  6. package/dist/components/brandguide/Colors.d.ts +2 -2
  7. package/dist/components/brandguide/Colors.d.ts.map +1 -1
  8. package/dist/components/brandguide/ColorsEditable.d.ts +2 -2
  9. package/dist/components/brandguide/ColorsEditable.d.ts.map +1 -1
  10. package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
  11. package/dist/components/editor/SettingsForm.d.ts.map +1 -1
  12. package/dist/components/editor/index.js +4 -3
  13. package/dist/components/primitives/index.js +1 -1
  14. package/dist/components/sections/Container/Container.d.ts +2 -2
  15. package/dist/components/sections/Container/Container.d.ts.map +1 -1
  16. package/dist/components/sections/brand-guide.js +2 -2
  17. package/dist/components/sections/register-schemas.js +4 -4
  18. package/dist/components/sections/register.js +4 -4
  19. package/dist/components/shared/HistoryChangesModal.d.ts +39 -0
  20. package/dist/components/shared/HistoryChangesModal.d.ts.map +1 -0
  21. package/dist/components/shared/HistoryPopover.d.ts +3 -1
  22. package/dist/components/shared/HistoryPopover.d.ts.map +1 -1
  23. package/dist/components/shared/Navigation.d.ts.map +1 -1
  24. package/dist/components/shared/Popover.d.ts +10 -1
  25. package/dist/components/shared/Popover.d.ts.map +1 -1
  26. package/dist/components/shell/EditorModal.d.ts +6 -1
  27. package/dist/components/shell/EditorModal.d.ts.map +1 -1
  28. package/dist/components/shell/EditorModalContext.d.ts +3 -2
  29. package/dist/components/shell/EditorModalContext.d.ts.map +1 -1
  30. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  31. package/dist/hooks/useEditorPublish.d.ts +5 -1
  32. package/dist/hooks/useEditorPublish.d.ts.map +1 -1
  33. package/dist/index.js +45 -37
  34. package/dist/lib/events.d.ts +18 -0
  35. package/dist/lib/events.d.ts.map +1 -1
  36. package/dist/lib/history-buckets.d.ts +30 -0
  37. package/dist/lib/history-buckets.d.ts.map +1 -0
  38. package/dist/lib/index-ops.d.ts +77 -0
  39. package/dist/lib/index-ops.d.ts.map +1 -0
  40. package/dist/lib/index-ops.js +223 -0
  41. package/dist/lib/index.d.ts +1 -1
  42. package/dist/lib/index.d.ts.map +1 -1
  43. package/dist/lib/index.js +6 -4
  44. package/dist/lib/media-folders.d.ts +13 -0
  45. package/dist/lib/media-folders.d.ts.map +1 -1
  46. package/dist/lib/media-folders.js +172 -0
  47. package/dist/lib/registry.d.ts +7 -1
  48. package/dist/lib/registry.d.ts.map +1 -1
  49. package/dist/lib/theme-vars.d.ts +19 -4
  50. package/dist/lib/theme-vars.d.ts.map +1 -1
  51. package/dist/schemas/index.js +1 -1
  52. package/dist/storage/index.d.ts +1 -1
  53. package/dist/storage/index.d.ts.map +1 -1
  54. package/dist/storage/index.js +9 -3
  55. package/dist/storage/types.d.ts +44 -0
  56. package/dist/storage/types.d.ts.map +1 -1
  57. package/package.json +9 -1
  58. package/src/components/brandguide/Colors.tsx +2 -1
  59. package/src/components/brandguide/ColorsEditable.tsx +2 -1
  60. package/src/components/editor/SectionWrapper.tsx +1 -0
  61. package/src/components/editor/SettingsForm.tsx +5 -2
  62. package/src/components/sections/Container/Container.tsx +5 -4
  63. package/src/components/shared/HistoryChangesModal.tsx +256 -0
  64. package/src/components/shared/HistoryPopover.tsx +255 -76
  65. package/src/components/shared/Navigation.tsx +30 -9
  66. package/src/components/shared/Popover.tsx +95 -2
  67. package/src/components/shell/EditorModal.tsx +26 -4
  68. package/src/components/shell/EditorModalContext.tsx +5 -4
  69. package/src/components/shell/EditorShell.tsx +51 -2
  70. package/src/components/shell/SiteSettingsModal.tsx +1 -1
  71. package/src/hooks/useEditorPublish.ts +15 -6
  72. package/src/lib/events.ts +11 -0
  73. package/src/lib/history-buckets.ts +190 -0
  74. package/src/lib/index-ops.ts +309 -0
  75. package/src/lib/index.ts +1 -1
  76. package/src/lib/media-folders.ts +16 -0
  77. package/src/lib/registry.ts +9 -1
  78. package/src/lib/theme-vars.ts +25 -4
  79. package/src/storage/index.ts +1 -1
  80. package/src/storage/types.ts +55 -0
  81. package/dist/chunk-VAOW4WXQ.js +0 -15
  82. package/dist/{chunk-ZKGMLLUQ.js → chunk-IFCQWC3G.js} +3 -3
@@ -0,0 +1,172 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
3
+ // src/lib/media-folders.ts
4
+ function createFolderId() {
5
+ const bytes = new Uint8Array(6);
6
+ crypto.getRandomValues(bytes);
7
+ return `f_${Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("")}`;
8
+ }
9
+ function isCyclicFolder(folders, id) {
10
+ const max = Object.keys(folders).length;
11
+ let cursor = folders[id]?.parentId ?? null;
12
+ for (let steps = 0; cursor !== null && folders[cursor] && steps <= max; steps++) {
13
+ if (cursor === id) return true;
14
+ cursor = folders[cursor].parentId;
15
+ }
16
+ return false;
17
+ }
18
+ function effectiveParentId(folders, id) {
19
+ const parentId = folders[id]?.parentId ?? null;
20
+ if (parentId === null || !folders[parentId]) return null;
21
+ return isCyclicFolder(folders, id) ? null : parentId;
22
+ }
23
+ function childFolderIds(folders, parentId) {
24
+ return Object.keys(folders).filter((id) => effectiveParentId(folders, id) === parentId).sort((a, b) => folders[a].name.localeCompare(folders[b].name, void 0, { sensitivity: "base" }));
25
+ }
26
+ function buildFolderTree(folders) {
27
+ const build = (parentId) => childFolderIds(folders, parentId).map((id) => ({
28
+ id,
29
+ name: folders[id].name,
30
+ children: build(id)
31
+ }));
32
+ return build(null);
33
+ }
34
+ function folderPathNames(folders, id) {
35
+ const names = [];
36
+ let cursor = id;
37
+ while (cursor !== null && folders[cursor]) {
38
+ names.unshift(folders[cursor].name);
39
+ cursor = effectiveParentId(folders, cursor);
40
+ }
41
+ return names;
42
+ }
43
+ function folderPathIds(folders, id) {
44
+ const ids = [];
45
+ let cursor = id;
46
+ while (cursor !== null && folders[cursor]) {
47
+ ids.unshift(cursor);
48
+ cursor = effectiveParentId(folders, cursor);
49
+ }
50
+ return ids;
51
+ }
52
+ function descendantFolderIds(folders, id) {
53
+ const result = /* @__PURE__ */ new Set([id]);
54
+ const ids = Object.keys(folders);
55
+ let grew = true;
56
+ while (grew) {
57
+ grew = false;
58
+ for (const fid of ids) {
59
+ if (result.has(fid)) continue;
60
+ const parent = effectiveParentId(folders, fid);
61
+ if (parent !== null && result.has(parent)) {
62
+ result.add(fid);
63
+ grew = true;
64
+ }
65
+ }
66
+ }
67
+ return result;
68
+ }
69
+ function canMoveFolder(folders, id, targetParentId) {
70
+ if (!folders[id]) return false;
71
+ if (targetParentId === null) return effectiveParentId(folders, id) !== null;
72
+ if (!folders[targetParentId]) return false;
73
+ if (descendantFolderIds(folders, id).has(targetParentId)) return false;
74
+ return effectiveParentId(folders, id) !== targetParentId;
75
+ }
76
+ function uniqueFolderName(folders, parentId, desired, excludeId) {
77
+ const base = desired.trim();
78
+ const siblings = new Set(
79
+ childFolderIds(folders, parentId).filter((id) => id !== excludeId).map((id) => folders[id].name.toLowerCase())
80
+ );
81
+ if (!siblings.has(base.toLowerCase())) return base;
82
+ for (let n = 2; ; n++) {
83
+ const candidate = `${base} (${n})`;
84
+ if (!siblings.has(candidate.toLowerCase())) return candidate;
85
+ }
86
+ }
87
+ function itemFolderId(folders, item) {
88
+ return item.folderId && folders[item.folderId] ? item.folderId : null;
89
+ }
90
+ function recursiveItemCounts(folders, items) {
91
+ const counts = {};
92
+ for (const item of items) {
93
+ let cursor = itemFolderId(folders, item);
94
+ const seen = /* @__PURE__ */ new Set();
95
+ while (cursor !== null && !seen.has(cursor)) {
96
+ seen.add(cursor);
97
+ counts[cursor] = (counts[cursor] ?? 0) + 1;
98
+ cursor = effectiveParentId(folders, cursor);
99
+ }
100
+ }
101
+ return counts;
102
+ }
103
+ function healMediaManifest(manifest) {
104
+ const folders = {};
105
+ for (const [id, f] of Object.entries(manifest.folders)) {
106
+ folders[id] = { ...f, parentId: effectiveParentId(manifest.folders, id) };
107
+ }
108
+ const images = {};
109
+ for (const [id, entry] of Object.entries(manifest.images)) {
110
+ if (entry.folderId && !folders[entry.folderId]) {
111
+ const { folderId: _dropped, ...rest } = entry;
112
+ images[id] = rest;
113
+ } else {
114
+ images[id] = entry;
115
+ }
116
+ }
117
+ return { ...manifest, images, folders };
118
+ }
119
+ function rebaseMediaManifest(local, remote) {
120
+ return { ...local, images: { ...remote.images, ...local.images } };
121
+ }
122
+ function assembleSavedManifest(manifest, uploadedItems, deletedIds) {
123
+ const images = { ...manifest.images };
124
+ for (const entry of uploadedItems) images[entry.id] = entry;
125
+ for (const id of deletedIds) delete images[id];
126
+ return healMediaManifest({ ...manifest, images });
127
+ }
128
+ function planFolderUpload(files, folders, currentFolderId, newId = createFolderId) {
129
+ const newFolders = {};
130
+ const byName = /* @__PURE__ */ new Map();
131
+ for (const [fid, f] of Object.entries(folders)) {
132
+ byName.set(`${effectiveParentId(folders, fid)}/${f.name.toLowerCase()}`, fid);
133
+ }
134
+ const ensureDir = (segments) => {
135
+ let parent = currentFolderId;
136
+ for (const segment of segments) {
137
+ const key = `${parent}/${segment.toLowerCase()}`;
138
+ let fid = byName.get(key);
139
+ if (!fid) {
140
+ fid = newId();
141
+ newFolders[fid] = { name: segment, parentId: parent };
142
+ byName.set(key, fid);
143
+ }
144
+ parent = fid;
145
+ }
146
+ return parent;
147
+ };
148
+ const fileTargets = files.map(({ file, relativePath }) => {
149
+ const segments = relativePath.split("/").filter(Boolean);
150
+ segments.pop();
151
+ return { file, folderId: ensureDir(segments) };
152
+ });
153
+ return { newFolders, fileTargets };
154
+ }
155
+ export {
156
+ assembleSavedManifest,
157
+ buildFolderTree,
158
+ canMoveFolder,
159
+ childFolderIds,
160
+ createFolderId,
161
+ descendantFolderIds,
162
+ effectiveParentId,
163
+ folderPathIds,
164
+ folderPathNames,
165
+ healMediaManifest,
166
+ isCyclicFolder,
167
+ itemFolderId,
168
+ planFolderUpload,
169
+ rebaseMediaManifest,
170
+ recursiveItemCounts,
171
+ uniqueFolderName
172
+ };
@@ -66,12 +66,18 @@ export type Thumbnail = {
66
66
  value: string;
67
67
  };
68
68
  export type CustomSettingsFormProps = Record<string, any>;
69
+ export interface ModalOptions {
70
+ /** Content is a tab set — lock the modal height so tab switches don't resize it. */
71
+ tabbed?: boolean;
72
+ }
73
+ /** Signature of the editor's modal opener as threaded down to sections. */
74
+ export type OpenModal = (title: string, content: ReactNode, options?: ModalOptions) => void;
69
75
  export interface SectionProps<T = unknown> {
70
76
  content: T;
71
77
  options?: Record<string, unknown>;
72
78
  onChange?: (content: T) => void;
73
79
  isEditMode: boolean;
74
- openModal?: (title: string, content: ReactNode) => void;
80
+ openModal?: OpenModal;
75
81
  /** Delete this whole section. Used e.g. when a colors section's last swatch
76
82
  * is dragged into another section, leaving it empty. */
77
83
  onDelete?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lib/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAI3E,MAAM,MAAM,gBAAgB,GACxB;IACE,IAAI,EAAE,MAAM,CAA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AG,IAAI,CAElE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAE9E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAEjE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEtE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE3D;AAED,wBAAgB,cAAc,IAAI,iBAAiB,EAAE,CAEpD;AAED,wBAAgB,aAAa,IAAI,OAAO,EAAE,CAEzC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
@@ -1,10 +1,11 @@
1
1
  import type { SiteConfig } from "../schemas/site-config";
2
2
  /**
3
3
  * Computes the CSS value for the brand `--color-primary` / `--color-primary-contrast`
4
- * custom properties. When darkMode is "optional" AND a dark variant is set, the
5
- * value is a CSS `light-dark(<light>, <dark>)` expression — the browser resolves
6
- * it per the element's `color-scheme` (the `.dark` class sets `color-scheme: dark`;
7
- * `:root` sets `color-scheme: light`). Otherwise it's the plain light hex.
4
+ * / `--color-on-primary` custom properties. When darkMode is "optional" AND a dark
5
+ * variant is set, the value is a CSS `light-dark(<light>, <dark>)` expression — the
6
+ * browser resolves it per the element's `color-scheme` (the `.dark` class sets
7
+ * `color-scheme: dark`; `:root` sets `color-scheme: light`). Otherwise it's the
8
+ * plain light hex.
8
9
  *
9
10
  * Single source of truth for every injection site: Layout.astro / LoginLayout.astro
10
11
  * (SSR inline `<html style>`) and EditorShell (live setProperty + localStorage).
@@ -12,5 +13,19 @@ import type { SiteConfig } from "../schemas/site-config";
12
13
  type ThemeColorConfig = Pick<SiteConfig, "primaryColor" | "primaryContrast" | "primaryColorDark" | "primaryContrastDark" | "darkMode">;
13
14
  export declare function primaryVarValue(c?: Partial<ThemeColorConfig> | null): string;
14
15
  export declare function accentVarValue(c?: Partial<ThemeColorConfig> | null): string;
16
+ /**
17
+ * Foreground ink for text drawn ON a `--color-primary`-filled surface (branded
18
+ * plates, primary cards). Derived from `primaryColor` with the same
19
+ * black/white WCAG pick the editor's accent "Suggest" button uses, so a
20
+ * primary-filled surface is legible on every brand without configuration.
21
+ *
22
+ * This exists because `--color-primary-contrast` cannot serve the role: it is
23
+ * the *accent* — brands legitimately repoint it at a decorative colour (Siete's
24
+ * gold on aubergine) that reads as a highlight but cannot carry body copy.
25
+ * Sections should consume `var(--color-on-primary)` for text on primary and
26
+ * keep `--color-primary-contrast` for accents, and derive softer inks by mixing
27
+ * the two brand tokens: `color-mix(in srgb, var(--color-on-primary) 70%, var(--color-primary))`.
28
+ */
29
+ export declare function onPrimaryVarValue(c?: Partial<ThemeColorConfig> | null): string;
15
30
  export {};
16
31
  //# sourceMappingURL=theme-vars.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-vars.d.ts","sourceRoot":"","sources":["../../src/lib/theme-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;;GASG;AACH,KAAK,gBAAgB,GAAG,IAAI,CAC1B,UAAU,EACV,cAAc,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,UAAU,CAC7F,CAAC;AASF,wBAAgB,eAAe,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,MAAM,CAE5E;AAED,wBAAgB,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,MAAM,CAE3E"}
1
+ {"version":3,"file":"theme-vars.d.ts","sourceRoot":"","sources":["../../src/lib/theme-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD;;;;;;;;;;GAUG;AACH,KAAK,gBAAgB,GAAG,IAAI,CAC1B,UAAU,EACV,cAAc,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,UAAU,CAC7F,CAAC;AASF,wBAAgB,eAAe,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,MAAM,CAE5E;AAED,wBAAgB,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,MAAM,CAE3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,MAAM,CAI9E"}
@@ -20,6 +20,7 @@ import {
20
20
  getSectionContentSchema,
21
21
  getSectionSchema
22
22
  } from "../chunk-TZQPOR5A.js";
23
+ import "../chunk-VKAGMEKE.js";
23
24
  import {
24
25
  ChatbotConfigSchema,
25
26
  ChatbotTaskSchema,
@@ -42,7 +43,6 @@ import {
42
43
  VariantSchema,
43
44
  normalizeSiteIndex
44
45
  } from "../chunk-RHWWQV3J.js";
45
- import "../chunk-VKAGMEKE.js";
46
46
  import "../chunk-FM4M4Q2W.js";
47
47
  import "../chunk-NSCT3AMV.js";
48
48
  import "../chunk-JSBRDJBE.js";
@@ -1,3 +1,3 @@
1
1
  export type { StorageProvider, FileWrite, AssetStore } from "./types";
2
- export { StorageConflictError, ASSET_CACHE_CONTROL } from "./types";
2
+ export { StorageConflictError, ASSET_CACHE_CONTROL, IDEMPOTENCY_TRAILER, IDEMPOTENCY_KEY_RE, withIdempotencyTrailer } from "./types";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
@@ -1,9 +1,15 @@
1
1
  import {
2
2
  ASSET_CACHE_CONTROL,
3
- StorageConflictError
4
- } from "../chunk-VAOW4WXQ.js";
3
+ IDEMPOTENCY_KEY_RE,
4
+ IDEMPOTENCY_TRAILER,
5
+ StorageConflictError,
6
+ withIdempotencyTrailer
7
+ } from "../chunk-EUSWEVOA.js";
5
8
  import "../chunk-JSBRDJBE.js";
6
9
  export {
7
10
  ASSET_CACHE_CONTROL,
8
- StorageConflictError
11
+ IDEMPOTENCY_KEY_RE,
12
+ IDEMPOTENCY_TRAILER,
13
+ StorageConflictError,
14
+ withIdempotencyTrailer
9
15
  };
@@ -24,7 +24,51 @@ export interface StorageProvider {
24
24
  listDirectory(path: string, options?: {
25
25
  draft?: boolean;
26
26
  }): Promise<string[]>;
27
+ /**
28
+ * Find a recent commit on the draft branch whose message carries the given
29
+ * `Idempotency-Key:` trailer, returning its sha (null if not found).
30
+ *
31
+ * This exists to make a retried write LEGIBLE, not to make it safe — safety is
32
+ * already `writeFiles`' baseVersion check, which a retry cannot get past once
33
+ * the original landed (the head moved, so the retry's baseVersion is stale).
34
+ * What the check cannot do is tell "your write failed" from "your write
35
+ * succeeded and you didn't hear back", and it reports both as a conflict. A
36
+ * caller that tagged its write can ask that question here.
37
+ *
38
+ * OPTIONAL: providers that cannot search history omit it, and callers fall
39
+ * back to surfacing the plain conflict.
40
+ *
41
+ * Best-effort by contract. It searches a BOUNDED window, so an old key reads
42
+ * as absent, and an implementation may answer "not found" when the history
43
+ * read itself fails — failing closed keeps the conflict rather than inventing
44
+ * a replay. So `null` means "could not confirm", NOT "your write did not
45
+ * land": a caller must not tell the user the earlier attempt failed.
46
+ */
47
+ findCommitByIdempotencyKey?(key: string, options?: {
48
+ limit?: number;
49
+ }): Promise<string | null>;
27
50
  }
51
+ /**
52
+ * Commit-message trailer carrying a write's idempotency key. The commit itself is
53
+ * the store — no table, and no TTL to tune: keys live exactly as long as the
54
+ * draft branch, and `promoteDraft` deletes it, which is the correct lifetime
55
+ * (after a publish there is no draft, so an old write must not replay).
56
+ */
57
+ export declare const IDEMPOTENCY_TRAILER = "Idempotency-Key";
58
+ /**
59
+ * Keys are interpolated into a commit message, so the charset is enforced HERE,
60
+ * at the interpolation point, and not only by the caller that happens to have a
61
+ * schema. A key containing a newline would let a caller append arbitrary further
62
+ * trailer lines to the commit.
63
+ */
64
+ export declare const IDEMPOTENCY_KEY_RE: RegExp;
65
+ /**
66
+ * Build a commit message carrying `key` as a trailer, or return `subject`
67
+ * unchanged when no key is given. Throws on a malformed key: every caller
68
+ * reaches this through a write path that should have validated first, so an
69
+ * invalid key here is a bug, not user input to be tolerated.
70
+ */
71
+ export declare function withIdempotencyTrailer(subject: string, key?: string): string;
28
72
  export type FileWrite = {
29
73
  path: string;
30
74
  content: string | Uint8Array | null;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;aACjB,cAAc,EAAE,MAAM,GAAG,IAAI;gBAA7B,cAAc,EAAE,MAAM,GAAG,IAAI;CAI1D;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CACR,KAAK,EAAE,SAAS,EAAE,EAClB,OAAO,EAAE,MAAM,EAIf,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GACxC,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;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;AAE7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,eAAe,CACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAC5B,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEnE,oEAAoE;IACpE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEnC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC,sDAAsD;IACtD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;CACpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawnagency/primitives",
3
- "version": "0.1.94",
3
+ "version": "0.1.96",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -60,6 +60,14 @@
60
60
  "types": "./dist/lib/registry.d.ts",
61
61
  "default": "./dist/lib/registry.js"
62
62
  },
63
+ "./lib/index-ops": {
64
+ "types": "./dist/lib/index-ops.d.ts",
65
+ "default": "./dist/lib/index-ops.js"
66
+ },
67
+ "./lib/media-folders": {
68
+ "types": "./dist/lib/media-folders.d.ts",
69
+ "default": "./dist/lib/media-folders.js"
70
+ },
63
71
  "./lib/migrate-sections-transform": {
64
72
  "types": "./dist/lib/migrate-sections-transform.d.ts",
65
73
  "default": "./dist/lib/migrate-sections-transform.js"
@@ -3,6 +3,7 @@ import ColorsView from "./ColorsView";
3
3
  import ColorsEditable from "./ColorsEditable";
4
4
  import type { ColorItem } from "../sections/Colors/schema";
5
5
  import type { SectionContent } from "../../schemas/sections";
6
+ import type { OpenModal } from "../../lib/registry";
6
7
 
7
8
  interface Props {
8
9
  colors: ColorItem[];
@@ -11,7 +12,7 @@ interface Props {
11
12
  collapsing?: boolean;
12
13
  showLabel?: boolean;
13
14
  onChange?: (content: SectionContent) => void;
14
- openModal?: (title: string, content: ReactNode) => void;
15
+ openModal?: OpenModal;
15
16
  onDelete?: () => void;
16
17
  }
17
18
 
@@ -8,6 +8,7 @@ import ColorSwatchSettings from "./ColorSwatchSettings";
8
8
  import { getContrastClass, createColorItem } from "./colors-shared";
9
9
  import type { ColorItem } from "../sections/Colors/schema";
10
10
  import type { SectionContent } from "../../schemas/sections";
11
+ import type { OpenModal } from "../../lib/registry";
11
12
 
12
13
  export function buildContent(
13
14
  colors: ColorItem[],
@@ -32,7 +33,7 @@ export default function ColorsEditable({
32
33
  collapsing?: boolean;
33
34
  showLabel?: boolean;
34
35
  onChange: (content: SectionContent) => void;
35
- openModal: (title: string, content: ReactNode) => void;
36
+ openModal: OpenModal;
36
37
  onDelete?: () => void;
37
38
  }) {
38
39
  const [expanded, setExpanded] = useState(!collapsing);
@@ -206,6 +206,7 @@ export function SectionWrapper({
206
206
  onChange={(result) => onSectionChange(result as unknown as Record<string, unknown>)}
207
207
  tabs={definition.settingsTabs}
208
208
  />,
209
+ { tabbed: (definition.settingsTabs?.length ?? 0) > 0 },
209
210
  );
210
211
  }
211
212
  }
@@ -194,9 +194,12 @@ export function SettingsForm({ schema, values, onChange, tabs }: SettingsFormPro
194
194
 
195
195
  const listed = new Set(tabs.flatMap((t) => t.fields));
196
196
  const otherKeys = Object.keys(schema).filter((key) => !listed.has(key));
197
+ // min-h-0 + overflow-y-auto: the modal locks its height for tabbed content,
198
+ // so a long tab scrolls in place rather than growing the dialog.
199
+ const panel = "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-px";
197
200
  const tabItems = [
198
- ...tabs.map((t) => ({ id: t.label, label: t.label, content: <div className="flex flex-col gap-4">{fields(t.fields)}</div> })),
199
- ...(otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: <div className="flex flex-col gap-4">{fields(otherKeys)}</div> }] : []),
201
+ ...tabs.map((t) => ({ id: t.label, label: t.label, content: <div className={panel}>{fields(t.fields)}</div> })),
202
+ ...(otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: <div className={panel}>{fields(otherKeys)}</div> }] : []),
200
203
  ];
201
204
  return <Tabs tabs={tabItems} fullBleedTabBar />;
202
205
  }
@@ -1,6 +1,6 @@
1
1
  import { type ComponentType, type ReactNode } from "react";
2
2
  import type { Edge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
3
- import { getSection } from "../../../lib/registry";
3
+ import { getSection, type OpenModal } from "../../../lib/registry";
4
4
  import { cn } from "../../../lib/cn";
5
5
  import { containerGridClass, colSpanClass, spacerHiddenClass, masonryColumnsClass } from "../../../lib/container-grid";
6
6
  import { ChildBlockWrapper } from "../../editor/ChildBlockWrapper";
@@ -27,7 +27,7 @@ type ChildComponent = ComponentType<{
27
27
  options: Record<string, unknown>;
28
28
  isEditMode: boolean;
29
29
  onChange?: (content: unknown) => void;
30
- openModal?: (title: string, content: ReactNode) => void;
30
+ openModal?: OpenModal;
31
31
  }>;
32
32
 
33
33
  interface ContainerChildProps {
@@ -48,7 +48,7 @@ interface ContainerChildProps {
48
48
  onColSpanChange: (span: number) => void;
49
49
  onOpenSettings?: () => void;
50
50
  onChildContentChange?: (content: unknown) => void;
51
- openModal?: (title: string, content: ReactNode) => void;
51
+ openModal?: OpenModal;
52
52
  /** Drag/drop hitbox edges: ["left","right"] in grid (row flow), ["top","bottom"] in masonry
53
53
  * (CSS multi-column stacks items vertically). Defaults to ROW_EDGES. */
54
54
  allowedEdges?: Edge[];
@@ -134,7 +134,7 @@ export interface ContainerProps {
134
134
  content: { id?: string; content: ContainerContent };
135
135
  isEditMode: boolean;
136
136
  onChange?: (content: unknown) => void;
137
- openModal?: (title: string, content: ReactNode) => void;
137
+ openModal?: OpenModal;
138
138
  }
139
139
 
140
140
  /**
@@ -296,6 +296,7 @@ export function Container({ content, isEditMode, onChange, openModal }: Containe
296
296
  onChange={applyResult}
297
297
  tabs={def.settingsTabs}
298
298
  />,
299
+ { tabbed: (def.settingsTabs?.length ?? 0) > 0 },
299
300
  );
300
301
  }
301
302
  };