@drawnagency/primitives 0.1.11 → 0.1.13

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 (71) hide show
  1. package/dist/{chunk-6SK5BLG3.js → chunk-46QI4FDZ.js} +1 -1
  2. package/dist/{chunk-XQXZHDNR.js → chunk-EAEX6DS7.js} +4 -1
  3. package/dist/{chunk-32H6Q6CX.js → chunk-P24YUT3O.js} +1 -1
  4. package/dist/components/editor/AudienceIndicator.d.ts +9 -0
  5. package/dist/components/editor/AudienceIndicator.d.ts.map +1 -0
  6. package/dist/components/editor/IndicatorPill.d.ts +18 -0
  7. package/dist/components/editor/IndicatorPill.d.ts.map +1 -0
  8. package/dist/components/editor/SectionWrapper.d.ts +1 -1
  9. package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
  10. package/dist/components/editor/StatusIndicator.d.ts +29 -0
  11. package/dist/components/editor/StatusIndicator.d.ts.map +1 -0
  12. package/dist/components/editor/index.d.ts +3 -1
  13. package/dist/components/editor/index.d.ts.map +1 -1
  14. package/dist/components/shared/Popover.d.ts +1 -1
  15. package/dist/components/shared/Popover.d.ts.map +1 -1
  16. package/dist/components/shared/SegmentedControl.d.ts +13 -0
  17. package/dist/components/shared/SegmentedControl.d.ts.map +1 -0
  18. package/dist/components/shared/SplitButton.d.ts +17 -0
  19. package/dist/components/shared/SplitButton.d.ts.map +1 -0
  20. package/dist/components/shell/BuildStatusIndicator.d.ts +9 -0
  21. package/dist/components/shell/BuildStatusIndicator.d.ts.map +1 -0
  22. package/dist/components/shell/EditorContext.d.ts +2 -0
  23. package/dist/components/shell/EditorContext.d.ts.map +1 -1
  24. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  25. package/dist/hooks/index.d.ts +2 -0
  26. package/dist/hooks/index.d.ts.map +1 -1
  27. package/dist/hooks/useBuildStatus.d.ts +11 -0
  28. package/dist/hooks/useBuildStatus.d.ts.map +1 -0
  29. package/dist/hooks/useContentLifecycle.d.ts +13 -0
  30. package/dist/hooks/useContentLifecycle.d.ts.map +1 -0
  31. package/dist/hooks/useEditorPublish.d.ts +6 -1
  32. package/dist/hooks/useEditorPublish.d.ts.map +1 -1
  33. package/dist/index.js +3 -3
  34. package/dist/lib/dexie.d.ts +8 -1
  35. package/dist/lib/dexie.d.ts.map +1 -1
  36. package/dist/lib/index.js +2 -2
  37. package/dist/lib/registry.d.ts +6 -1
  38. package/dist/lib/registry.d.ts.map +1 -1
  39. package/dist/schemas/index.js +2 -2
  40. package/dist/schemas/site-config.d.ts +8 -6
  41. package/dist/schemas/site-config.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/src/components/editor/{AudiencePicker.tsx → AudienceIndicator.tsx} +25 -49
  44. package/src/components/editor/IndicatorPill.tsx +119 -0
  45. package/src/components/editor/SectionWrapper.tsx +59 -13
  46. package/src/components/editor/StatusIndicator.tsx +148 -0
  47. package/src/components/editor/index.ts +3 -1
  48. package/src/components/sections/SectionLayout.tsx +1 -1
  49. package/src/components/shared/Navigation.tsx +3 -3
  50. package/src/components/shared/Popover.tsx +26 -4
  51. package/src/components/shared/PopoverItem.tsx +1 -1
  52. package/src/components/shared/SegmentedControl.tsx +43 -0
  53. package/src/components/shared/SplitButton.tsx +97 -0
  54. package/src/components/shell/BuildStatusIndicator.tsx +67 -0
  55. package/src/components/shell/EditorContext.tsx +5 -1
  56. package/src/components/shell/EditorShell.tsx +180 -52
  57. package/src/hooks/index.ts +2 -0
  58. package/src/hooks/useBuildStatus.ts +139 -0
  59. package/src/hooks/useContentLifecycle.ts +34 -0
  60. package/src/hooks/useEditorPublish.ts +234 -66
  61. package/src/lib/dexie.ts +43 -2
  62. package/src/lib/registry.ts +6 -1
  63. package/src/schemas/site-config.ts +5 -1
  64. package/dist/components/editor/AudiencePicker.d.ts +0 -9
  65. package/dist/components/editor/AudiencePicker.d.ts.map +0 -1
  66. package/dist/components/editor/StatusBadge.d.ts +0 -7
  67. package/dist/components/editor/StatusBadge.d.ts.map +0 -1
  68. package/dist/components/editor/StatusPicker.d.ts +0 -9
  69. package/dist/components/editor/StatusPicker.d.ts.map +0 -1
  70. package/src/components/editor/StatusBadge.tsx +0 -30
  71. package/src/components/editor/StatusPicker.tsx +0 -86
@@ -2,9 +2,13 @@ import { z } from "zod";
2
2
  import { MediaConfigSchema } from "./media";
3
3
  import { HexColorSchema } from "./shared";
4
4
 
5
+ const StatusSchema = z.enum(["draft", "live", "archived", "published"]).transform(
6
+ (val) => val === "published" ? "live" as const : val,
7
+ );
8
+
5
9
  export const SectionMetaSchema = z.object({
6
10
  type: z.string(),
7
- status: z.enum(["draft", "published", "archived"]),
11
+ status: StatusSchema,
8
12
  access: z.array(z.string()),
9
13
  });
10
14
 
@@ -1,9 +0,0 @@
1
- import type { Audience } from "../../auth/types";
2
- interface Props {
3
- access: string[];
4
- audiences: Audience[];
5
- onChange: (access: string[]) => void;
6
- }
7
- export declare function AudiencePicker({ access, audiences, onChange }: Props): import("react/jsx-runtime").JSX.Element;
8
- export {};
9
- //# sourceMappingURL=AudiencePicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudiencePicker.d.ts","sourceRoot":"","sources":["../../../src/components/editor/AudiencePicker.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAyFpE"}
@@ -1,7 +0,0 @@
1
- interface StatusBadgeProps {
2
- status: string;
3
- dirty?: boolean;
4
- }
5
- export declare function StatusBadge({ status, dirty }: StatusBadgeProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
7
- //# sourceMappingURL=StatusBadge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/components/editor/StatusBadge.tsx"],"names":[],"mappings":"AAIA,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAQD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,gBAAgB,2CAc9D"}
@@ -1,9 +0,0 @@
1
- type Status = "draft" | "published" | "archived";
2
- interface Props {
3
- status: Status;
4
- dirty?: boolean;
5
- onChange: (status: Status) => void;
6
- }
7
- export declare function StatusPicker({ status, dirty, onChange }: Props): import("react/jsx-runtime").JSX.Element;
8
- export {};
9
- //# sourceMappingURL=StatusPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatusPicker.d.ts","sourceRoot":"","sources":["../../../src/components/editor/StatusPicker.tsx"],"names":[],"mappings":"AAMA,KAAK,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjD,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAgBD,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAyD9D"}
@@ -1,30 +0,0 @@
1
- import { cn } from "../../lib/cn";
2
-
3
- type Status = "published" | "draft" | "archived";
4
-
5
- interface StatusBadgeProps {
6
- status: string;
7
- dirty?: boolean;
8
- }
9
-
10
- const statusClasses: Record<Status, string> = {
11
- published: "bg-status-published-bg text-status-published-text",
12
- draft: "bg-status-draft-bg text-status-draft-text",
13
- archived: "bg-status-archived-bg text-status-archived-text",
14
- };
15
-
16
- export function StatusBadge({ status, dirty }: StatusBadgeProps) {
17
- return (
18
- <span
19
- className={cn(
20
- "rounded-full px-2 py-0.5 text-xs font-medium",
21
- statusClasses[status as Status] ?? statusClasses.archived,
22
- )}
23
- >
24
- {status}
25
- {dirty && (
26
- <span className="ml-1 opacity-70">· Unsaved</span>
27
- )}
28
- </span>
29
- );
30
- }
@@ -1,86 +0,0 @@
1
- import { useRef, useState } from "react";
2
- import { Check } from "lucide-react";
3
- import { cn } from "../../lib/cn";
4
- import { Popover } from "../shared/Popover";
5
- import { PopoverItem } from "../shared/PopoverItem";
6
-
7
- type Status = "draft" | "published" | "archived";
8
-
9
- interface Props {
10
- status: Status;
11
- dirty?: boolean;
12
- onChange: (status: Status) => void;
13
- }
14
-
15
- const STATUSES: Status[] = ["draft", "published", "archived"];
16
-
17
- const statusClasses: Record<Status, string> = {
18
- published: "bg-status-published-bg text-status-published-text",
19
- draft: "bg-status-draft-bg text-status-draft-text",
20
- archived: "bg-status-archived-bg text-status-archived-text",
21
- };
22
-
23
- const dotClasses: Record<Status, string> = {
24
- published: "bg-status-published-bg",
25
- draft: "bg-status-draft-bg",
26
- archived: "bg-status-archived-bg",
27
- };
28
-
29
- export function StatusPicker({ status, dirty, onChange }: Props) {
30
- const [open, setOpen] = useState(false);
31
- const buttonRef = useRef<HTMLButtonElement>(null);
32
-
33
- function handleSelect(next: Status) {
34
- if (next !== status) onChange(next);
35
- setOpen(false);
36
- }
37
-
38
- return (
39
- <div className="relative">
40
- <button
41
- ref={buttonRef}
42
- type="button"
43
- onClick={() => setOpen((v) => !v)}
44
- aria-haspopup="true"
45
- aria-expanded={open}
46
- className={cn(
47
- "cursor-pointer rounded-full px-2 py-0.5 text-xs font-medium",
48
- statusClasses[status] ?? statusClasses.archived,
49
- )}
50
- >
51
- {status}
52
- {dirty && <span className="ml-1 opacity-70">· Unsaved</span>}
53
- </button>
54
-
55
- <Popover
56
- isOpen={open}
57
- onClose={() => setOpen(false)}
58
- anchorRef={buttonRef}
59
- align="end"
60
- className="w-44"
61
- >
62
- <ul role="radiogroup" aria-label="Section status" className="py-1">
63
- {STATUSES.map((s) => {
64
- const checked = s === status;
65
- return (
66
- <li key={s}>
67
- <PopoverItem
68
- role="radio"
69
- aria-checked={checked}
70
- onClick={() => handleSelect(s)}
71
- >
72
- <span
73
- aria-hidden="true"
74
- className={cn("h-3 w-3 shrink-0 rounded-full border border-base-200", dotClasses[s])}
75
- />
76
- <span className="flex-1 text-sm font-medium capitalize text-base-contrast">{s}</span>
77
- {checked && <Check size={14} strokeWidth={3} className="text-primary" />}
78
- </PopoverItem>
79
- </li>
80
- );
81
- })}
82
- </ul>
83
- </Popover>
84
- </div>
85
- );
86
- }