@frontlit/page-builder 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (34) hide show
  1. package/dist/blocks/index.js +2 -2
  2. package/dist/builder/index.js +5 -5
  3. package/dist/{chunk-PQTDUFKU.js → chunk-HEKBPKGS.js} +6 -6
  4. package/dist/{chunk-PQTDUFKU.js.map → chunk-HEKBPKGS.js.map} +1 -1
  5. package/dist/{chunk-YXLOVEQZ.js → chunk-I2LRKHSL.js} +5 -5
  6. package/dist/{chunk-YXLOVEQZ.js.map → chunk-I2LRKHSL.js.map} +1 -1
  7. package/dist/{chunk-OEQJQ4OA.js → chunk-KRQWGGAJ.js} +244 -6
  8. package/dist/chunk-KRQWGGAJ.js.map +1 -0
  9. package/dist/{chunk-BWOGREWJ.js → chunk-LL6CG6KH.js} +3 -3
  10. package/dist/{chunk-BWOGREWJ.js.map → chunk-LL6CG6KH.js.map} +1 -1
  11. package/dist/{chunk-FZBLE44D.js → chunk-XQE4RVNO.js} +4 -4
  12. package/dist/chunk-XQE4RVNO.js.map +1 -0
  13. package/dist/components/index.js +2 -2
  14. package/dist/index.js +5 -5
  15. package/dist/primitives/index.d.ts +68 -1
  16. package/dist/primitives/index.js +1 -1
  17. package/dist/renderer/index.js +4 -4
  18. package/dist/server/index.js +4 -2
  19. package/dist/server/index.js.map +1 -1
  20. package/dist/server/islands/code-snippet.js +1 -1
  21. package/dist/server/islands/code-snippet.js.map +1 -1
  22. package/dist/server/islands/header-mobile-menu.js +1 -1
  23. package/dist/server/islands/header-mobile-menu.js.map +1 -1
  24. package/dist/server/islands/tabs.d.ts +23 -0
  25. package/dist/server/islands/tabs.js +86 -0
  26. package/dist/server/islands/tabs.js.map +1 -0
  27. package/dist/server/islands/theme-mode-switcher.d.ts +1 -1
  28. package/dist/server/primitives.d.ts +81 -1
  29. package/dist/server/primitives.js +231 -36
  30. package/dist/server/primitives.js.map +1 -1
  31. package/dist/styles.css +343 -0
  32. package/package.json +2 -2
  33. package/dist/chunk-FZBLE44D.js.map +0 -1
  34. package/dist/chunk-OEQJQ4OA.js.map +0 -1
@@ -351,6 +351,73 @@ var PageCardHeader = ({
351
351
  return /* @__PURE__ */ jsx7("div", { className: classes, ...props, children: /* @__PURE__ */ jsx7(Header4, { theme, children }) });
352
352
  };
353
353
 
354
+ // src/server/primitives.ts
355
+ export * from "./islands/code-snippet.js";
356
+
357
+ // src/primitives/collapsible.tsx
358
+ import { ChevronRight } from "lucide-react";
359
+ import { jsx as jsx8, jsxs } from "react/jsx-runtime";
360
+ function Collapsible({
361
+ summary,
362
+ children,
363
+ defaultOpen,
364
+ variant = "bordered",
365
+ id,
366
+ theme,
367
+ className
368
+ }) {
369
+ const card = theme?.interactives?.card;
370
+ const typography = theme?.typography?.text2;
371
+ return /* @__PURE__ */ jsxs(
372
+ "details",
373
+ {
374
+ id,
375
+ open: defaultOpen,
376
+ className: cn(
377
+ "group min-w-0",
378
+ variant === "bordered" && [
379
+ "border border-border bg-card text-card-foreground",
380
+ card?.border?.radius ?? "rounded-md"
381
+ ],
382
+ className
383
+ ),
384
+ children: [
385
+ /* @__PURE__ */ jsxs(
386
+ "summary",
387
+ {
388
+ className: cn(
389
+ "flex cursor-pointer list-none items-center gap-2 text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",
390
+ variant === "bordered" ? "px-3 py-2" : "py-1",
391
+ typography?.fontFamily,
392
+ typography?.fontSize ?? "text-sm",
393
+ typography?.letterSpacing
394
+ ),
395
+ children: [
396
+ /* @__PURE__ */ jsx8(
397
+ ChevronRight,
398
+ {
399
+ "aria-hidden": "true",
400
+ className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-90"
401
+ }
402
+ ),
403
+ /* @__PURE__ */ jsx8("span", { className: "min-w-0 flex-1", children: summary })
404
+ ]
405
+ }
406
+ ),
407
+ /* @__PURE__ */ jsx8(
408
+ "div",
409
+ {
410
+ className: cn(
411
+ variant === "bordered" ? "border-t border-border p-3" : "pl-6 pt-1"
412
+ ),
413
+ children
414
+ }
415
+ )
416
+ ]
417
+ }
418
+ );
419
+ }
420
+
354
421
  // src/primitives/display.tsx
355
422
  var Display = createHeading(
356
423
  "Display",
@@ -384,14 +451,14 @@ var Header3 = createHeading(
384
451
  );
385
452
 
386
453
  // src/components/image.tsx
387
- import { jsx as jsx8 } from "react/jsx-runtime";
454
+ import { jsx as jsx9 } from "react/jsx-runtime";
388
455
  var registry = globalThis;
389
456
  function resolveImageAttributes(input) {
390
457
  return registry.__frontlitImageResolver?.(input) ?? null;
391
458
  }
392
459
 
393
460
  // src/primitives/image.tsx
394
- import { jsx as jsx9 } from "react/jsx-runtime";
461
+ import { jsx as jsx10 } from "react/jsx-runtime";
395
462
  var Image = ({
396
463
  src,
397
464
  alt = "",
@@ -404,7 +471,7 @@ var Image = ({
404
471
  const cardStyles = theme?.interactives?.card;
405
472
  const classes = cn("w-full object-cover", cardStyles?.border?.radius, className);
406
473
  const optimized = resolveImageAttributes({ src, alt, sizes, priority });
407
- return /* @__PURE__ */ jsx9(
474
+ return /* @__PURE__ */ jsx10(
408
475
  "img",
409
476
  {
410
477
  src,
@@ -420,15 +487,44 @@ var Image = ({
420
487
  );
421
488
  };
422
489
 
490
+ // src/primitives/inline-code.tsx
491
+ import { jsx as jsx11 } from "react/jsx-runtime";
492
+ function InlineCode({
493
+ children,
494
+ theme,
495
+ variant = "default",
496
+ className,
497
+ ...props
498
+ }) {
499
+ const typography = theme?.typography?.code;
500
+ return /* @__PURE__ */ jsx11(
501
+ "code",
502
+ {
503
+ className: cn(
504
+ // Code is literal: never inherit a theme's uppercase captions.
505
+ "break-words normal-case",
506
+ typography?.fontFamily ?? "font-jetbrains-mono",
507
+ // Relative to the surrounding text; the theme's code size is for blocks.
508
+ "text-[0.875em]",
509
+ typography?.letterSpacing,
510
+ variant === "default" ? "rounded bg-muted px-1 py-0.5 text-foreground" : "text-muted-foreground",
511
+ className
512
+ ),
513
+ ...props,
514
+ children
515
+ }
516
+ );
517
+ }
518
+
423
519
  // src/primitives/input.tsx
424
520
  import React3 from "react";
425
521
 
426
522
  // src/primitives/components/ui/input.tsx
427
523
  import * as React2 from "react";
428
- import { jsx as jsx10 } from "react/jsx-runtime";
524
+ import { jsx as jsx12 } from "react/jsx-runtime";
429
525
  var Input = React2.forwardRef(
430
526
  ({ className, type, ...props }, ref) => {
431
- return /* @__PURE__ */ jsx10(
527
+ return /* @__PURE__ */ jsx12(
432
528
  "input",
433
529
  {
434
530
  type,
@@ -445,7 +541,7 @@ var Input = React2.forwardRef(
445
541
  Input.displayName = "Input";
446
542
 
447
543
  // src/primitives/input.tsx
448
- import { jsx as jsx11 } from "react/jsx-runtime";
544
+ import { jsx as jsx13 } from "react/jsx-runtime";
449
545
  var Input2 = React3.forwardRef(
450
546
  ({
451
547
  className = "",
@@ -488,7 +584,7 @@ var Input2 = React3.forwardRef(
488
584
  inputStyles?.custom,
489
585
  className
490
586
  );
491
- return /* @__PURE__ */ jsx11(Input, { ref, className: classes, ...props });
587
+ return /* @__PURE__ */ jsx13(Input, { ref, className: classes, ...props });
492
588
  }
493
589
  );
494
590
  Input2.displayName = "Input";
@@ -500,11 +596,11 @@ import React5 from "react";
500
596
  import * as LabelPrimitive from "@radix-ui/react-label";
501
597
  import { cva as cva3 } from "class-variance-authority";
502
598
  import * as React4 from "react";
503
- import { jsx as jsx12 } from "react/jsx-runtime";
599
+ import { jsx as jsx14 } from "react/jsx-runtime";
504
600
  var labelVariants = cva3(
505
601
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
506
602
  );
507
- var Label = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
603
+ var Label = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
508
604
  LabelPrimitive.Root,
509
605
  {
510
606
  ref,
@@ -515,7 +611,7 @@ var Label = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
515
611
  Label.displayName = LabelPrimitive.Root.displayName;
516
612
 
517
613
  // src/primitives/label.tsx
518
- import { jsx as jsx13 } from "react/jsx-runtime";
614
+ import { jsx as jsx15 } from "react/jsx-runtime";
519
615
  var Label2 = React5.forwardRef(
520
616
  ({ className = "", theme, error = false, ...props }, ref) => {
521
617
  const typographyStyles = theme?.typography?.text2;
@@ -533,13 +629,13 @@ var Label2 = React5.forwardRef(
533
629
  error && "text-red-500",
534
630
  className
535
631
  );
536
- return /* @__PURE__ */ jsx13(Label, { ref, className: classes, ...props });
632
+ return /* @__PURE__ */ jsx15(Label, { ref, className: classes, ...props });
537
633
  }
538
634
  );
539
635
  Label2.displayName = "Label";
540
636
 
541
637
  // src/primitives/link.tsx
542
- import { jsx as jsx14 } from "react/jsx-runtime";
638
+ import { jsx as jsx16 } from "react/jsx-runtime";
543
639
  var Link = ({
544
640
  children,
545
641
  className = "",
@@ -578,7 +674,7 @@ var Link = ({
578
674
  linkStyles?.custom,
579
675
  className
580
676
  );
581
- return /* @__PURE__ */ jsx14(
677
+ return /* @__PURE__ */ jsx16(
582
678
  "span",
583
679
  {
584
680
  className: classes,
@@ -592,8 +688,42 @@ var Link = ({
592
688
  );
593
689
  };
594
690
 
691
+ // src/primitives/native-select.tsx
692
+ import React6 from "react";
693
+ import { jsx as jsx17 } from "react/jsx-runtime";
694
+ var NativeSelect = React6.forwardRef(
695
+ ({ className, theme, children, ...props }, ref) => {
696
+ const input = theme?.interactives?.input;
697
+ const typography = theme?.typography?.input;
698
+ return /* @__PURE__ */ jsx17(
699
+ "select",
700
+ {
701
+ ref,
702
+ className: cn(
703
+ "flex min-h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base leading-normal text-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
704
+ typography?.fontFamily,
705
+ typography?.fontSize,
706
+ typography?.fontWeight,
707
+ typography?.letterSpacing,
708
+ input?.padding?.x,
709
+ input?.padding?.y,
710
+ input?.border?.width,
711
+ input?.border?.style,
712
+ input?.border?.radius,
713
+ input?.shadow,
714
+ input?.custom,
715
+ className
716
+ ),
717
+ ...props,
718
+ children
719
+ }
720
+ );
721
+ }
722
+ );
723
+ NativeSelect.displayName = "NativeSelect";
724
+
595
725
  // src/primitives/preheader.tsx
596
- import { jsx as jsx15 } from "react/jsx-runtime";
726
+ import { jsx as jsx18 } from "react/jsx-runtime";
597
727
  var Preheader = ({
598
728
  children,
599
729
  className = "",
@@ -615,11 +745,11 @@ var Preheader = ({
615
745
  typographyStyles?.textOverflow,
616
746
  className
617
747
  );
618
- return /* @__PURE__ */ jsx15("p", { className: classes, ...props, children });
748
+ return /* @__PURE__ */ jsx18("p", { className: classes, ...props, children });
619
749
  };
620
750
 
621
751
  // src/primitives/section.tsx
622
- import React6 from "react";
752
+ import React7 from "react";
623
753
 
624
754
  // src/models/media.ts
625
755
  function getMediaUrl(media) {
@@ -634,7 +764,7 @@ function getMediaUrl(media) {
634
764
  }
635
765
 
636
766
  // src/primitives/section.tsx
637
- import { Fragment, jsx as jsx16, jsxs } from "react/jsx-runtime";
767
+ import { Fragment, jsx as jsx19, jsxs as jsxs2 } from "react/jsx-runtime";
638
768
  function resolveBackgroundLayer(background) {
639
769
  const attachment = background.backgroundAttachment || "scroll";
640
770
  if (background.type === "color") {
@@ -689,7 +819,7 @@ var Section = ({
689
819
  );
690
820
  const backgroundLayer = background ? resolveBackgroundLayer(background) : null;
691
821
  const isFixed = background && background.type !== "color" && background.backgroundAttachment === "fixed";
692
- return /* @__PURE__ */ jsx16(Fragment, { children: React6.createElement(
822
+ return /* @__PURE__ */ jsx19(Fragment, { children: React7.createElement(
693
823
  component,
694
824
  {
695
825
  // `overflow-clip` keeps a fixed-attachment layer painted
@@ -698,8 +828,8 @@ var Section = ({
698
828
  className: cn(classes, isFixed && "overflow-clip"),
699
829
  ...props
700
830
  },
701
- /* @__PURE__ */ jsxs(Fragment, { children: [
702
- backgroundLayer && /* @__PURE__ */ jsx16(
831
+ /* @__PURE__ */ jsxs2(Fragment, { children: [
832
+ backgroundLayer && /* @__PURE__ */ jsx19(
703
833
  "div",
704
834
  {
705
835
  "aria-hidden": true,
@@ -710,7 +840,7 @@ var Section = ({
710
840
  style: backgroundLayer.style
711
841
  }
712
842
  ),
713
- background && background.type === "image" && /* @__PURE__ */ jsx16(
843
+ background && background.type === "image" && /* @__PURE__ */ jsx19(
714
844
  "div",
715
845
  {
716
846
  "aria-hidden": true,
@@ -723,7 +853,7 @@ var Section = ({
723
853
  }
724
854
  }
725
855
  ),
726
- background && background.type === "image" && /* @__PURE__ */ jsx16(
856
+ background && background.type === "image" && /* @__PURE__ */ jsx19(
727
857
  "div",
728
858
  {
729
859
  "aria-hidden": true,
@@ -733,11 +863,13 @@ var Section = ({
733
863
  }
734
864
  }
735
865
  ),
736
- /* @__PURE__ */ jsx16(
866
+ /* @__PURE__ */ jsx19(
737
867
  "div",
738
868
  {
739
869
  className: cn(
740
- "mx-auto z-[3] relative overflow-hidden",
870
+ // Clips like overflow-hidden without becoming a scroll
871
+ // container, so sticky children (docs sidebars) still stick.
872
+ "mx-auto z-[3] relative overflow-clip",
741
873
  `lg:${theme?.structure?.page?.width || "max-w-6xl"}`,
742
874
  theme?.structure?.section?.padding?.x || "px-4",
743
875
  theme?.structure?.section?.padding?.y || "py-4"
@@ -750,7 +882,7 @@ var Section = ({
750
882
  };
751
883
 
752
884
  // src/primitives/subheader1.tsx
753
- import { jsx as jsx17 } from "react/jsx-runtime";
885
+ import { jsx as jsx20 } from "react/jsx-runtime";
754
886
  var Subheader1 = ({
755
887
  children,
756
888
  className = "",
@@ -770,11 +902,11 @@ var Subheader1 = ({
770
902
  typographyStyles?.textOverflow,
771
903
  className
772
904
  );
773
- return component === "h5" ? /* @__PURE__ */ jsx17("h5", { className: classes, ...props, children }) : /* @__PURE__ */ jsx17("span", { className: classes, ...props, children });
905
+ return component === "h5" ? /* @__PURE__ */ jsx20("h5", { className: classes, ...props, children }) : /* @__PURE__ */ jsx20("span", { className: classes, ...props, children });
774
906
  };
775
907
 
776
908
  // src/primitives/subheader2.tsx
777
- import { jsx as jsx18 } from "react/jsx-runtime";
909
+ import { jsx as jsx21 } from "react/jsx-runtime";
778
910
  var Subheader2 = ({
779
911
  children,
780
912
  className = "",
@@ -793,11 +925,70 @@ var Subheader2 = ({
793
925
  typographyStyles?.textOverflow,
794
926
  className
795
927
  ].filter(Boolean).join(" ");
796
- return /* @__PURE__ */ jsx18("h6", { className: classes, ...props, children });
928
+ return /* @__PURE__ */ jsx21("h6", { className: classes, ...props, children });
797
929
  };
798
930
 
931
+ // src/primitives/table.tsx
932
+ import { jsx as jsx22, jsxs as jsxs3 } from "react/jsx-runtime";
933
+ function Table({ columns, rows, theme, className }) {
934
+ const typography = theme?.typography?.text2;
935
+ const card = theme?.interactives?.card;
936
+ const text = cn(
937
+ typography?.fontFamily,
938
+ typography?.fontSize ?? "text-sm",
939
+ typography?.lineHeight,
940
+ typography?.letterSpacing
941
+ );
942
+ return /* @__PURE__ */ jsx22(
943
+ "div",
944
+ {
945
+ className: cn(
946
+ "w-full min-w-0 overflow-hidden border border-border",
947
+ card?.border?.radius ?? "rounded-md",
948
+ className
949
+ ),
950
+ children: /* @__PURE__ */ jsxs3("table", { className: cn("block w-full border-collapse md:table", text), children: [
951
+ /* @__PURE__ */ jsx22("thead", { className: "hidden md:table-header-group", children: /* @__PURE__ */ jsx22("tr", { className: "border-b border-border bg-muted/50", children: columns.map((column) => /* @__PURE__ */ jsx22(
952
+ "th",
953
+ {
954
+ scope: "col",
955
+ className: cn(
956
+ "px-3 py-2 text-left font-medium text-muted-foreground",
957
+ column.className
958
+ ),
959
+ children: column.label
960
+ },
961
+ column.key
962
+ )) }) }),
963
+ /* @__PURE__ */ jsx22("tbody", { className: "block md:table-row-group", children: rows.map((row, index) => /* @__PURE__ */ jsx22(
964
+ "tr",
965
+ {
966
+ className: "block border-b border-border px-3 py-2 last:border-b-0 md:table-row md:p-0",
967
+ children: columns.map((column) => /* @__PURE__ */ jsx22(
968
+ "td",
969
+ {
970
+ "data-label": column.label,
971
+ className: cn(
972
+ "block min-w-0 break-words py-1 align-top text-foreground before:mr-2 before:text-muted-foreground before:content-[attr(data-label)':'] md:table-cell md:px-3 md:py-2 md:before:content-none",
973
+ column.className
974
+ ),
975
+ children: row[column.key]
976
+ },
977
+ column.key
978
+ ))
979
+ },
980
+ index
981
+ )) })
982
+ ] })
983
+ }
984
+ );
985
+ }
986
+
987
+ // src/server/primitives.ts
988
+ export * from "./islands/tabs.js";
989
+
799
990
  // src/primitives/text1.tsx
800
- import { jsx as jsx19 } from "react/jsx-runtime";
991
+ import { jsx as jsx23 } from "react/jsx-runtime";
801
992
  var Text1 = ({
802
993
  children,
803
994
  className = "",
@@ -820,11 +1011,11 @@ var Text1 = ({
820
1011
  typographyStyles?.textOverflow,
821
1012
  className
822
1013
  );
823
- return component === "p" ? /* @__PURE__ */ jsx19("p", { className: classes, ...props, children }) : /* @__PURE__ */ jsx19("span", { className: classes, ...props, children });
1014
+ return component === "p" ? /* @__PURE__ */ jsx23("p", { className: classes, ...props, children }) : /* @__PURE__ */ jsx23("span", { className: classes, ...props, children });
824
1015
  };
825
1016
 
826
1017
  // src/primitives/text2.tsx
827
- import { jsx as jsx20 } from "react/jsx-runtime";
1018
+ import { jsx as jsx24 } from "react/jsx-runtime";
828
1019
  var Text2 = ({
829
1020
  children,
830
1021
  className = "",
@@ -847,13 +1038,13 @@ var Text2 = ({
847
1038
  typographyStyles?.textOverflow,
848
1039
  className
849
1040
  );
850
- return component === "p" ? /* @__PURE__ */ jsx20("p", { className: classes, ...props, children }) : /* @__PURE__ */ jsx20("span", { className: classes, ...props, children });
1041
+ return component === "p" ? /* @__PURE__ */ jsx24("p", { className: classes, ...props, children }) : /* @__PURE__ */ jsx24("span", { className: classes, ...props, children });
851
1042
  };
852
1043
 
853
1044
  // src/primitives/textarea.tsx
854
- import React7 from "react";
855
- import { jsx as jsx21 } from "react/jsx-runtime";
856
- var Textarea = React7.forwardRef(
1045
+ import React8 from "react";
1046
+ import { jsx as jsx25 } from "react/jsx-runtime";
1047
+ var Textarea = React8.forwardRef(
857
1048
  ({ className = "", theme, error = false, ...props }, ref) => {
858
1049
  const inputStyles = theme?.interactives?.input;
859
1050
  const typographyStyles = theme?.typography?.input;
@@ -876,7 +1067,7 @@ var Textarea = React7.forwardRef(
876
1067
  inputStyles?.custom,
877
1068
  className
878
1069
  );
879
- return /* @__PURE__ */ jsx21("textarea", { ref, className: classes, ...props });
1070
+ return /* @__PURE__ */ jsx25("textarea", { ref, className: classes, ...props });
880
1071
  }
881
1072
  );
882
1073
  Textarea.displayName = "Textarea";
@@ -884,15 +1075,18 @@ export {
884
1075
  Badge2 as Badge,
885
1076
  Button2 as Button,
886
1077
  Caption,
1078
+ Collapsible,
887
1079
  Display,
888
1080
  Header1,
889
1081
  Header2,
890
1082
  Header3,
891
1083
  Header4,
892
1084
  Image,
1085
+ InlineCode,
893
1086
  Input2 as Input,
894
1087
  Label2 as Label,
895
1088
  Link,
1089
+ NativeSelect,
896
1090
  PageCard,
897
1091
  PageCardContent,
898
1092
  PageCardHeader,
@@ -902,6 +1096,7 @@ export {
902
1096
  Subheader1,
903
1097
  Subheader2,
904
1098
  TAILWIND_TEXT_PX,
1099
+ Table,
905
1100
  Text1,
906
1101
  Text2,
907
1102
  Textarea,