dune-react 0.0.9 → 0.0.11

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 (210) hide show
  1. package/dist/components/puck-base/article-card.js +1 -1
  2. package/dist/components/puck-base/button.d.ts +0 -1
  3. package/dist/components/puck-base/button.js +5 -4
  4. package/dist/components/puck-base/card.js +0 -1
  5. package/dist/components/puck-base/content.js +0 -1
  6. package/dist/components/puck-base/core/fields.d.ts +2 -150
  7. package/dist/components/puck-base/core/fields.js +7 -83
  8. package/dist/components/puck-base/core/styles.d.ts +1946 -0
  9. package/dist/components/puck-base/core/styles.js +250 -0
  10. package/dist/components/puck-base/core/with-editable.d.ts +5 -7
  11. package/dist/components/puck-base/core/with-editable.js +69 -64
  12. package/dist/components/puck-base/{action-field.d.ts → fields/action-field.d.ts} +1 -1
  13. package/dist/components/puck-base/{action-field.js → fields/action-field.js} +91 -16
  14. package/dist/components/puck-base/fields/auto-field.d.ts +0 -1
  15. package/dist/components/puck-base/fields/auto-field.js +2 -90
  16. package/dist/components/puck-base/form.js +0 -1
  17. package/dist/components/puck-base/index.d.ts +1 -1
  18. package/dist/components/puck-base/navigation-menu.d.ts +18 -0
  19. package/dist/components/puck-base/navigation-menu.js +202 -0
  20. package/dist/components/puck-block/banner-sections/announcement-banner-1/announcement-banner.d.ts +9 -7
  21. package/dist/components/puck-block/banner-sections/announcement-banner-1/announcement-banner.js +11 -8
  22. package/dist/components/puck-block/banner-sections/announcement-banner-1/index.js +19 -37
  23. package/dist/components/puck-block/banner-sections/marquee-1/index.js +26 -24
  24. package/dist/components/puck-block/banner-sections/marquee-1/marquee.d.ts +9 -9
  25. package/dist/components/puck-block/banner-sections/marquee-1/marquee.js +28 -21
  26. package/dist/components/puck-block/banner-sections/props.d.ts +22 -0
  27. package/dist/components/puck-block/contact-sections/contact-us-1/contact-us.d.ts +13 -4
  28. package/dist/components/puck-block/contact-sections/contact-us-1/contact-us.js +114 -105
  29. package/dist/components/puck-block/contact-sections/contact-us-1/index.js +87 -7
  30. package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.d.ts +15 -11
  31. package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.js +27 -22
  32. package/dist/components/puck-block/contact-sections/contact-us-2/index.js +54 -52
  33. package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.d.ts +15 -12
  34. package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.js +29 -24
  35. package/dist/components/puck-block/contact-sections/contact-us-3/index.js +73 -60
  36. package/dist/components/puck-block/contact-sections/props.d.ts +65 -0
  37. package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.d.ts +13 -9
  38. package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.js +28 -30
  39. package/dist/components/puck-block/cta-sections/banner-cta-1/index.js +23 -25
  40. package/dist/components/puck-block/cta-sections/cta-1/cta.d.ts +6 -4
  41. package/dist/components/puck-block/cta-sections/cta-1/cta.js +5 -7
  42. package/dist/components/puck-block/cta-sections/cta-1/index.js +5 -9
  43. package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.d.ts +10 -10
  44. package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.js +48 -22
  45. package/dist/components/puck-block/cta-sections/gradient-cta-1/index.js +36 -29
  46. package/dist/components/puck-block/cta-sections/newsletter-signup-1/index.js +13 -5
  47. package/dist/components/puck-block/cta-sections/newsletter-signup-1/newsletter-signup.d.ts +7 -3
  48. package/dist/components/puck-block/cta-sections/newsletter-signup-1/newsletter-signup.js +35 -32
  49. package/dist/components/puck-block/cta-sections/promo-section-1/index.js +5 -7
  50. package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.d.ts +6 -4
  51. package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.js +93 -79
  52. package/dist/components/puck-block/cta-sections/props.d.ts +47 -0
  53. package/dist/components/puck-block/faq-sections/accordion-1/accordion.d.ts +6 -4
  54. package/dist/components/puck-block/faq-sections/accordion-1/accordion.js +44 -33
  55. package/dist/components/puck-block/faq-sections/accordion-1/index.js +3 -5
  56. package/dist/components/puck-block/faq-sections/faq-1/faq.d.ts +9 -7
  57. package/dist/components/puck-block/faq-sections/faq-1/faq.js +50 -44
  58. package/dist/components/puck-block/faq-sections/faq-1/index.js +12 -14
  59. package/dist/components/puck-block/faq-sections/faq-2/faq-2.d.ts +6 -4
  60. package/dist/components/puck-block/faq-sections/faq-2/faq-2.js +4 -6
  61. package/dist/components/puck-block/faq-sections/faq-2/index.js +4 -5
  62. package/dist/components/puck-block/faq-sections/props.d.ts +30 -0
  63. package/dist/components/puck-block/feature-sections/bento-1/bento.d.ts +6 -4
  64. package/dist/components/puck-block/feature-sections/bento-1/bento.js +2 -4
  65. package/dist/components/puck-block/feature-sections/bento-1/index.js +4 -5
  66. package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.d.ts +6 -4
  67. package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.js +2 -4
  68. package/dist/components/puck-block/feature-sections/feature-cards-1/index.js +4 -7
  69. package/dist/components/puck-block/feature-sections/feature-showcase-1/feature-showcase.d.ts +6 -4
  70. package/dist/components/puck-block/feature-sections/feature-showcase-1/feature-showcase.js +2 -4
  71. package/dist/components/puck-block/feature-sections/feature-showcase-1/index.js +4 -5
  72. package/dist/components/puck-block/feature-sections/icon-grid-1/icon-grid.d.ts +6 -4
  73. package/dist/components/puck-block/feature-sections/icon-grid-1/icon-grid.js +59 -53
  74. package/dist/components/puck-block/feature-sections/icon-grid-1/index.js +7 -8
  75. package/dist/components/puck-block/feature-sections/product-features-1/index.js +4 -5
  76. package/dist/components/puck-block/feature-sections/product-features-1/product-features.d.ts +6 -4
  77. package/dist/components/puck-block/feature-sections/product-features-1/product-features.js +2 -4
  78. package/dist/components/puck-block/feature-sections/props.d.ts +48 -0
  79. package/dist/components/puck-block/footer-sections/footer-1/footer.d.ts +5 -3
  80. package/dist/components/puck-block/footer-sections/footer-1/footer.js +6 -6
  81. package/dist/components/puck-block/footer-sections/footer-1/index.js +3 -5
  82. package/dist/components/puck-block/footer-sections/props.d.ts +31 -0
  83. package/dist/components/puck-block/gallery-sections/gallery-1/gallery.d.ts +9 -7
  84. package/dist/components/puck-block/gallery-sections/gallery-1/gallery.js +48 -40
  85. package/dist/components/puck-block/gallery-sections/gallery-1/index.js +33 -35
  86. package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.d.ts +6 -4
  87. package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.js +19 -13
  88. package/dist/components/puck-block/gallery-sections/gallery-2/index.js +4 -6
  89. package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.d.ts +7 -5
  90. package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.js +5 -7
  91. package/dist/components/puck-block/gallery-sections/gallery-3/index.js +13 -14
  92. package/dist/components/puck-block/gallery-sections/props.d.ts +26 -0
  93. package/dist/components/puck-block/header-sections/header-1/header.d.ts +11 -6
  94. package/dist/components/puck-block/header-sections/header-1/header.js +34 -28
  95. package/dist/components/puck-block/header-sections/header-1/index.d.ts +1 -1
  96. package/dist/components/puck-block/header-sections/header-1/index.js +26 -30
  97. package/dist/components/puck-block/header-sections/props.d.ts +41 -0
  98. package/dist/components/puck-block/header-sections/sticky-nav-1/index.js +12 -12
  99. package/dist/components/puck-block/header-sections/sticky-nav-1/sticky-nav.d.ts +8 -6
  100. package/dist/components/puck-block/header-sections/sticky-nav-1/sticky-nav.js +5 -5
  101. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.d.ts +7 -5
  102. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.js +19 -5
  103. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/index.js +17 -17
  104. package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.d.ts +8 -4
  105. package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.js +36 -26
  106. package/dist/components/puck-block/hero-sections/gradient-hero-1/index.js +19 -15
  107. package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.d.ts +7 -6
  108. package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.js +8 -11
  109. package/dist/components/puck-block/hero-sections/grid-hero-1/index.js +43 -11
  110. package/dist/components/puck-block/hero-sections/hero-1/hero.d.ts +6 -4
  111. package/dist/components/puck-block/hero-sections/hero-1/hero.js +6 -8
  112. package/dist/components/puck-block/hero-sections/hero-1/index.js +4 -4
  113. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.d.ts +9 -7
  114. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.js +65 -59
  115. package/dist/components/puck-block/hero-sections/image-hero-1/index.js +35 -36
  116. package/dist/components/puck-block/hero-sections/props.d.ts +71 -0
  117. package/dist/components/puck-block/hero-sections/split-hero-1/index.js +6 -5
  118. package/dist/components/puck-block/hero-sections/split-hero-1/split-hero.d.ts +8 -8
  119. package/dist/components/puck-block/hero-sections/split-hero-1/split-hero.js +48 -47
  120. package/dist/components/puck-block/hero-sections/video-hero-1/index.js +4 -3
  121. package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.d.ts +6 -2
  122. package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.js +30 -22
  123. package/dist/components/puck-block/location-sections/location-1/index.js +44 -42
  124. package/dist/components/puck-block/location-sections/location-1/location.d.ts +8 -6
  125. package/dist/components/puck-block/location-sections/location-1/location.js +8 -15
  126. package/dist/components/puck-block/location-sections/location-2/index.js +66 -57
  127. package/dist/components/puck-block/location-sections/location-2/location.d.ts +12 -6
  128. package/dist/components/puck-block/location-sections/location-2/location.js +8 -14
  129. package/dist/components/puck-block/location-sections/location-3/index.js +25 -24
  130. package/dist/components/puck-block/location-sections/location-3/location.d.ts +10 -6
  131. package/dist/components/puck-block/location-sections/location-3/location.js +12 -11
  132. package/dist/components/puck-block/location-sections/props.d.ts +45 -0
  133. package/dist/components/puck-block/metrics-sections/props.d.ts +43 -0
  134. package/dist/components/puck-block/metrics-sections/stats-1/index.js +6 -7
  135. package/dist/components/puck-block/metrics-sections/stats-1/stats.d.ts +7 -5
  136. package/dist/components/puck-block/metrics-sections/stats-1/stats.js +61 -55
  137. package/dist/components/puck-block/metrics-sections/stats-2/index.js +4 -7
  138. package/dist/components/puck-block/metrics-sections/stats-2/stats-2.d.ts +6 -4
  139. package/dist/components/puck-block/metrics-sections/stats-2/stats-2.js +4 -7
  140. package/dist/components/puck-block/metrics-sections/stats-3/index.js +19 -29
  141. package/dist/components/puck-block/metrics-sections/stats-3/stats-3.d.ts +7 -6
  142. package/dist/components/puck-block/metrics-sections/stats-3/stats-3.js +22 -13
  143. package/dist/components/puck-block/pricing-sections/comparison-1/comparison.d.ts +7 -5
  144. package/dist/components/puck-block/pricing-sections/comparison-1/comparison.js +45 -39
  145. package/dist/components/puck-block/pricing-sections/comparison-1/index.js +5 -7
  146. package/dist/components/puck-block/pricing-sections/pricing-1/index.js +10 -13
  147. package/dist/components/puck-block/pricing-sections/pricing-1/pricing.d.ts +8 -6
  148. package/dist/components/puck-block/pricing-sections/pricing-1/pricing.js +47 -35
  149. package/dist/components/puck-block/pricing-sections/pricing-2/index.js +7 -12
  150. package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.d.ts +6 -4
  151. package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.js +60 -57
  152. package/dist/components/puck-block/pricing-sections/props.d.ts +46 -0
  153. package/dist/components/puck-block/showcase-sections/before-after-1/before-after.d.ts +7 -5
  154. package/dist/components/puck-block/showcase-sections/before-after-1/before-after.js +8 -10
  155. package/dist/components/puck-block/showcase-sections/before-after-1/index.js +6 -8
  156. package/dist/components/puck-block/showcase-sections/case-study-1/case-study.d.ts +6 -2
  157. package/dist/components/puck-block/showcase-sections/case-study-1/case-study.js +29 -21
  158. package/dist/components/puck-block/showcase-sections/case-study-1/index.js +4 -3
  159. package/dist/components/puck-block/showcase-sections/props.d.ts +48 -0
  160. package/dist/components/puck-block/showcase-sections/step-by-step-1/index.js +3 -5
  161. package/dist/components/puck-block/showcase-sections/step-by-step-1/step-by-step.d.ts +6 -4
  162. package/dist/components/puck-block/showcase-sections/step-by-step-1/step-by-step.js +38 -41
  163. package/dist/components/puck-block/team-sections/props.d.ts +39 -0
  164. package/dist/components/puck-block/team-sections/team-grid-1/index.js +5 -6
  165. package/dist/components/puck-block/team-sections/team-grid-1/team-grid.d.ts +6 -4
  166. package/dist/components/puck-block/team-sections/team-grid-1/team-grid.js +23 -17
  167. package/dist/components/puck-block/team-sections/team-grid-2/index.js +4 -7
  168. package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.d.ts +6 -4
  169. package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.js +5 -7
  170. package/dist/components/puck-block/team-sections/team-profiles-1/index.js +4 -5
  171. package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.d.ts +6 -4
  172. package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.js +5 -7
  173. package/dist/components/puck-block/testimonial-sections/customers-1/customers.d.ts +9 -7
  174. package/dist/components/puck-block/testimonial-sections/customers-1/customers.js +8 -11
  175. package/dist/components/puck-block/testimonial-sections/customers-1/index.js +17 -17
  176. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/index.js +15 -12
  177. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.d.ts +7 -3
  178. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.js +33 -24
  179. package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.js +17 -16
  180. package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.d.ts +6 -4
  181. package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.js +5 -7
  182. package/dist/components/puck-block/testimonial-sections/props.d.ts +34 -0
  183. package/dist/components/puck-block/testimonial-sections/review-section-1/index.js +17 -16
  184. package/dist/components/puck-block/testimonial-sections/review-section-1/review-section.d.ts +8 -6
  185. package/dist/components/puck-block/testimonial-sections/review-section-1/review-section.js +22 -17
  186. package/dist/components/puck-block/testimonial-sections/testimonials-1/index.js +17 -17
  187. package/dist/components/puck-block/testimonial-sections/testimonials-1/testimonials.d.ts +8 -6
  188. package/dist/components/puck-block/testimonial-sections/testimonials-1/testimonials.js +100 -67
  189. package/dist/components/puck-block/text-sections/articles-1/articles.d.ts +7 -5
  190. package/dist/components/puck-block/text-sections/articles-1/articles.js +41 -34
  191. package/dist/components/puck-block/text-sections/articles-1/index.js +24 -25
  192. package/dist/components/puck-block/text-sections/content-section-1/content-section.d.ts +7 -5
  193. package/dist/components/puck-block/text-sections/content-section-1/content-section.js +6 -9
  194. package/dist/components/puck-block/text-sections/content-section-1/index.js +14 -16
  195. package/dist/components/puck-block/text-sections/props.d.ts +58 -0
  196. package/dist/components/puck-block/text-sections/rich-text-1/index.js +13 -15
  197. package/dist/components/puck-block/text-sections/rich-text-1/rich-text.d.ts +7 -5
  198. package/dist/components/puck-block/text-sections/rich-text-1/rich-text.js +11 -11
  199. package/dist/components/puck-block/text-sections/tab-section-1/index.js +4 -5
  200. package/dist/components/puck-block/text-sections/tab-section-1/tab-section.d.ts +6 -4
  201. package/dist/components/puck-block/text-sections/tab-section-1/tab-section.js +10 -8
  202. package/dist/components/puck-block/text-sections/timeline-1/index.js +3 -5
  203. package/dist/components/puck-block/text-sections/timeline-1/timeline.d.ts +6 -4
  204. package/dist/components/puck-block/text-sections/timeline-1/timeline.js +3 -5
  205. package/dist/components/puck-block/text-sections/two-column-1/index.js +4 -6
  206. package/dist/components/puck-block/text-sections/two-column-1/two-column.d.ts +6 -4
  207. package/dist/components/puck-block/text-sections/two-column-1/two-column.js +5 -7
  208. package/dist/components/shadcn/navigation-menu.js +8 -33
  209. package/dist/index.js +3 -2
  210. package/package.json +2 -2
@@ -0,0 +1,250 @@
1
+ const paddingLevel = {
2
+ type: "select",
3
+ options: [
4
+ { label: "none", value: "none" },
5
+ { label: "small", value: "small" },
6
+ { label: "medium", value: "medium" },
7
+ { label: "large", value: "large" }
8
+ ],
9
+ ai: { instructions: "Never select none as an option" }
10
+ };
11
+ const padding = {
12
+ type: "object",
13
+ objectFields: { top: paddingLevel, bottom: paddingLevel },
14
+ ai: { exclude: true }
15
+ };
16
+ const sectionStyle = {
17
+ type: "select",
18
+ label: "Section Style",
19
+ options: [
20
+ { label: "Default", value: "default" },
21
+ { label: "Dark", value: "dark" },
22
+ { label: "Muted", value: "muted" },
23
+ { label: "Inverted", value: "inverted" },
24
+ { label: "Custom", value: "custom" }
25
+ ],
26
+ ai: {
27
+ instructions: "Match the section's background tone: use 'dark' for dark/black backgrounds, 'muted' for gray/subtle backgrounds, 'inverted' for full contrast reversal. Default for standard light backgrounds."
28
+ }
29
+ };
30
+ const backgroundColor = {
31
+ type: "text",
32
+ label: "Background Color",
33
+ ai: {
34
+ instructions: "Set a custom background color in oklch format (e.g. 'oklch(0.2 0.05 260)'). Only use when sectionStyle is 'custom'."
35
+ }
36
+ };
37
+ const backgroundImage = {
38
+ type: "text",
39
+ label: "Background Image URL",
40
+ ai: {
41
+ instructions: "URL for a full-width background image behind the section.",
42
+ stream: false
43
+ }
44
+ };
45
+ const sectionOverlay = {
46
+ type: "select",
47
+ label: "Overlay",
48
+ options: [
49
+ { label: "None", value: "none" },
50
+ { label: "Gradient Top", value: "gradient-top" },
51
+ { label: "Gradient Bottom", value: "gradient-bottom" },
52
+ { label: "Noise", value: "noise" }
53
+ ],
54
+ ai: {
55
+ instructions: "Use gradient overlays when the section has a background image that needs text contrast. Use noise for subtle texture."
56
+ }
57
+ };
58
+ const sectionBaseStyleFields = {
59
+ sectionStyle,
60
+ backgroundColor,
61
+ padding
62
+ };
63
+ const paddingDefaults = { top: "medium", bottom: "medium" };
64
+ const sectionBaseStyleDefaults = {
65
+ sectionStyle: "default",
66
+ backgroundColor: "",
67
+ padding: paddingDefaults
68
+ };
69
+ function createStylesField(extraFields) {
70
+ return {
71
+ type: "object",
72
+ label: "Styles",
73
+ objectFields: {
74
+ ...sectionBaseStyleFields,
75
+ ...extraFields
76
+ }
77
+ };
78
+ }
79
+ function createStylesDefaults(extraDefaults) {
80
+ return {
81
+ ...sectionBaseStyleDefaults,
82
+ ...extraDefaults
83
+ };
84
+ }
85
+ const bannerStylesField = createStylesField({
86
+ textColor: { type: "text", label: "Text Color" },
87
+ align: {
88
+ type: "radio",
89
+ options: [
90
+ { label: "Left", value: "left" },
91
+ { label: "Center", value: "center" },
92
+ { label: "Right", value: "right" }
93
+ ]
94
+ },
95
+ size: {
96
+ type: "radio",
97
+ options: [
98
+ { label: "Small", value: "small" },
99
+ { label: "Default", value: "default" }
100
+ ]
101
+ }
102
+ });
103
+ const bannerStylesDefaults = createStylesDefaults();
104
+ createStylesField({
105
+ backgroundImage,
106
+ overlay: sectionOverlay,
107
+ align: {
108
+ type: "radio",
109
+ options: [
110
+ { label: "Left", value: "left" },
111
+ { label: "Center", value: "center" }
112
+ ]
113
+ },
114
+ minHeight: {
115
+ type: "select",
116
+ label: "Min Height",
117
+ options: [
118
+ { label: "Medium", value: "medium" },
119
+ { label: "Large", value: "large" },
120
+ { label: "Full", value: "full" }
121
+ ]
122
+ }
123
+ });
124
+ const heroStylesDefaults = createStylesDefaults();
125
+ createStylesField({
126
+ layout: {
127
+ type: "radio",
128
+ label: "Layout",
129
+ options: [
130
+ { label: "Contained", value: "contained" },
131
+ { label: "Full Bleed", value: "full-bleed" }
132
+ ]
133
+ }
134
+ });
135
+ createStylesDefaults();
136
+ createStylesField({
137
+ columns: {
138
+ type: "select",
139
+ label: "Columns",
140
+ options: [
141
+ { label: "2", value: 2 },
142
+ { label: "3", value: 3 },
143
+ { label: "4", value: 4 }
144
+ ]
145
+ }
146
+ });
147
+ createStylesDefaults();
148
+ createStylesField({
149
+ layout: {
150
+ type: "radio",
151
+ label: "Layout",
152
+ options: [
153
+ { label: "Single Column", value: "single-col" },
154
+ { label: "Two Columns", value: "two-col" }
155
+ ]
156
+ }
157
+ });
158
+ createStylesDefaults();
159
+ createStylesField({
160
+ gap: {
161
+ type: "select",
162
+ label: "Gap",
163
+ options: [
164
+ { label: "Small", value: "sm" },
165
+ { label: "Medium", value: "md" },
166
+ { label: "Large", value: "lg" }
167
+ ]
168
+ }
169
+ });
170
+ createStylesDefaults();
171
+ createStylesField({
172
+ layout: {
173
+ type: "radio",
174
+ label: "Layout",
175
+ options: [
176
+ { label: "Cards", value: "cards" },
177
+ { label: "Quote", value: "quote" }
178
+ ]
179
+ }
180
+ });
181
+ createStylesDefaults();
182
+ createStylesField({
183
+ layout: {
184
+ type: "select",
185
+ label: "Layout",
186
+ options: [
187
+ { label: "Horizontal", value: "horizontal" },
188
+ { label: "Vertical", value: "vertical" },
189
+ { label: "Numbered", value: "numbered" }
190
+ ]
191
+ }
192
+ });
193
+ createStylesDefaults();
194
+ createStylesField({
195
+ maxWidth: {
196
+ type: "select",
197
+ label: "Max Width",
198
+ options: [
199
+ { label: "Small", value: "sm" },
200
+ { label: "Medium", value: "md" },
201
+ { label: "Large", value: "lg" },
202
+ { label: "Full", value: "full" }
203
+ ]
204
+ }
205
+ });
206
+ createStylesDefaults();
207
+ createStylesField({
208
+ panelStyle: {
209
+ type: "select",
210
+ label: "Panel Style",
211
+ options: [
212
+ { label: "Default", value: "default" },
213
+ { label: "Card", value: "card" },
214
+ { label: "Flat", value: "flat" }
215
+ ]
216
+ }
217
+ });
218
+ createStylesDefaults();
219
+ createStylesField({
220
+ mapHeight: { type: "number", label: "Map Height", min: 200, max: 800 },
221
+ mapFilter: { type: "text", label: "Map Filter (CSS)" },
222
+ mapTintColor: { type: "text", label: "Map Tint Color" }
223
+ });
224
+ createStylesDefaults();
225
+ createStylesField();
226
+ createStylesDefaults();
227
+ createStylesField();
228
+ createStylesDefaults();
229
+ createStylesField();
230
+ createStylesDefaults();
231
+ createStylesField();
232
+ createStylesDefaults();
233
+ createStylesField();
234
+ createStylesDefaults();
235
+ export {
236
+ backgroundColor,
237
+ backgroundImage,
238
+ bannerStylesDefaults,
239
+ bannerStylesField,
240
+ createStylesDefaults,
241
+ createStylesField,
242
+ heroStylesDefaults,
243
+ padding,
244
+ paddingDefaults,
245
+ paddingLevel,
246
+ sectionBaseStyleDefaults,
247
+ sectionBaseStyleFields,
248
+ sectionOverlay,
249
+ sectionStyle
250
+ };
@@ -1,16 +1,14 @@
1
- import { type ComponentType } from 'react';
1
+ import { type ComponentType } from "react";
2
2
  interface EditableConfig {
3
3
  type: string;
4
4
  fields: Record<string, any>;
5
5
  }
6
6
  /**
7
- * HOC: 让任意组件在编辑模式下可点击编辑
7
+ * HOC: wraps any component to be inline-editable in Puck editor mode.
8
8
  *
9
- * 工作原理:
10
- * 1. 通过 props 特征值深搜 appState.data,找到 componentId + propPath
11
- * 2. 编辑模式下渲染原组件 + hover overlay
12
- * 3. 点击打开 Dialog,传递 onSave 回调
13
- * 4. 保存时用 dispatch 更新 Puck data
9
+ * Location strategy:
10
+ * 1. componentId — read from the nearest `[data-puck-component]` ancestor in the DOM.
11
+ * 2. propPath — search only within that single component's props (narrow scope).
14
12
  */
15
13
  export declare function withEditable<P extends Record<string, any>>(Component: ComponentType<P>, config: EditableConfig): (props: P & {
16
14
  onEdit?: (props: P, onSave: (updated: Partial<P>) => void) => void;
@@ -1,46 +1,57 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useRef, useEffect, useMemo, useCallback } from "react";
3
+ import { useRef, useEffect, useCallback } from "react";
4
4
  import { registerOverlayPortal } from "@puckeditor/core";
5
5
  import { usePuckDispatch, usePuckAppState } from "./hooks.js";
6
6
  import { Pencil } from "lucide-react";
7
7
  import { useEditorContext } from "../editor-context.js";
8
8
  import set from "../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/set.js";
9
9
  const BLOCK_LEVEL_TYPES = /* @__PURE__ */ new Set(["image"]);
10
+ function getComponentIdFromDOM(el) {
11
+ if (!el) return null;
12
+ const puckEl = el.closest("[data-puck-component]");
13
+ return (puckEl == null ? void 0 : puckEl.getAttribute("data-puck-component")) ?? null;
14
+ }
10
15
  function withEditable(Component, config) {
11
- return function EditableComponent(props) {
12
- const { isEditor: isEditorMode } = useEditorContext();
16
+ function EditableInner(props) {
13
17
  const dispatch = usePuckDispatch();
14
18
  const appState = usePuckAppState();
15
19
  const wrapperRef = useRef(null);
16
20
  const isBlock = BLOCK_LEVEL_TYPES.has(config.type);
17
21
  useEffect(() => {
18
- if (!isEditorMode || !wrapperRef.current) return;
22
+ if (!wrapperRef.current) return;
19
23
  return registerOverlayPortal(wrapperRef.current, { disableDrag: true });
20
- }, [isEditorMode]);
21
- const location = useMemo(() => {
22
- if (!isEditorMode || !(appState == null ? void 0 : appState.data)) return null;
23
- return findPropsLocation(appState.data, props, config.fields);
24
- }, [isEditorMode, appState == null ? void 0 : appState.data, props]);
24
+ }, []);
25
+ const getLocation = useCallback(() => {
26
+ const componentId = getComponentIdFromDOM(wrapperRef.current);
27
+ if (!componentId || !(appState == null ? void 0 : appState.data)) return null;
28
+ const component = findComponentById(appState.data, componentId);
29
+ if (!component) return null;
30
+ const propPath = findPropPath(component.props, props, config.fields);
31
+ if (propPath === null) return null;
32
+ return { componentId, propPath };
33
+ }, [appState == null ? void 0 : appState.data, props]);
25
34
  const handleSave = useCallback(
26
35
  (updated) => {
36
+ const location = getLocation();
27
37
  if (!location) return;
28
38
  dispatch({
29
39
  type: "setData",
30
40
  data: (prevData) => {
31
41
  const newData = JSON.parse(JSON.stringify(prevData));
32
- const { componentId, propPath } = location;
33
- const component = findComponentById(newData, componentId);
34
- if (!component) return prevData;
42
+ const id = getComponentIdFromDOM(wrapperRef.current);
43
+ console.log(id, "ididid");
44
+ const comp = findComponentById(newData, location.componentId);
45
+ if (!comp) return prevData;
35
46
  for (const [key, value] of Object.entries(updated)) {
36
- const fullPath = propPath ? `${propPath}.${key}` : key;
37
- set(component.props, fullPath, value);
47
+ const fullPath = location.propPath ? `${location.propPath}.${key}` : key;
48
+ set(comp.props, fullPath, value);
38
49
  }
39
50
  return newData;
40
51
  }
41
52
  });
42
53
  },
43
- [location, dispatch]
54
+ [getLocation, dispatch]
44
55
  );
45
56
  const handleEdit = useCallback(
46
57
  (e) => {
@@ -52,84 +63,78 @@ function withEditable(Component, config) {
52
63
  },
53
64
  [props, handleSave]
54
65
  );
66
+ return /* @__PURE__ */ jsxs(
67
+ "span",
68
+ {
69
+ ref: wrapperRef,
70
+ className: isBlock ? "group relative block h-full w-full" : "group relative inline-flex",
71
+ children: [
72
+ /* @__PURE__ */ jsx(Component, { ...props }),
73
+ /* @__PURE__ */ jsx(
74
+ "span",
75
+ {
76
+ onClick: handleEdit,
77
+ className: "absolute inset-0 z-40 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
78
+ children: /* @__PURE__ */ jsx("span", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-black/50 shadow-md backdrop-blur-sm", children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-white" }) })
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ return function EditableComponent(props) {
86
+ const { isEditor: isEditorMode } = useEditorContext();
55
87
  if (!isEditorMode) {
56
88
  return /* @__PURE__ */ jsx(Component, { ...props });
57
89
  }
58
- return /* @__PURE__ */ jsxs("span", { ref: wrapperRef, className: isBlock ? "group relative block h-full w-full" : "group relative inline-flex", children: [
59
- /* @__PURE__ */ jsx(Component, { ...props }),
60
- /* @__PURE__ */ jsx(
61
- "span",
62
- {
63
- onClick: handleEdit,
64
- className: "absolute inset-0 z-40 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
65
- children: /* @__PURE__ */ jsx("span", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-black/50 shadow-md backdrop-blur-sm", children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-white" }) })
66
- }
67
- )
68
- ] });
90
+ return /* @__PURE__ */ jsx(EditableInner, { ...props });
69
91
  };
70
92
  }
71
- function findPropsLocation(data, targetProps, fields) {
72
- if (!data) return null;
73
- const content = Array.isArray(data.content) ? data.content : [];
74
- for (const component of content) {
75
- const result = searchInObject(component.props, targetProps, fields, component.props.id);
76
- if (result) return result;
77
- }
78
- const zones = data.zones && typeof data.zones === "object" ? data.zones : {};
93
+ function findComponentById(data, componentId) {
94
+ const content = Array.isArray(data == null ? void 0 : data.content) ? data.content : [];
95
+ const contentMatch = content.find((c) => {
96
+ var _a;
97
+ return ((_a = c == null ? void 0 : c.props) == null ? void 0 : _a.id) === componentId;
98
+ });
99
+ if (contentMatch) return contentMatch;
100
+ const zones = (data == null ? void 0 : data.zones) && typeof data.zones === "object" ? data.zones : {};
79
101
  for (const zoneKey of Object.keys(zones)) {
80
102
  const zoneComponents = Array.isArray(zones[zoneKey]) ? zones[zoneKey] : [];
81
- for (const component of zoneComponents) {
82
- const result = searchInObject(component.props, targetProps, fields, component.props.id);
83
- if (result) return result;
84
- }
103
+ const zoneMatch = zoneComponents.find(
104
+ (c) => {
105
+ var _a;
106
+ return ((_a = c == null ? void 0 : c.props) == null ? void 0 : _a.id) === componentId;
107
+ }
108
+ );
109
+ if (zoneMatch) return zoneMatch;
85
110
  }
86
111
  return null;
87
112
  }
88
- function searchInObject(obj, targetProps, fields, componentId, currentPath = "") {
113
+ function findPropPath(obj, targetProps, fields, currentPath = "") {
89
114
  if (!obj || typeof obj !== "object") return null;
90
115
  if (isMatchingProps(obj, targetProps, fields)) {
91
- return { componentId, propPath: currentPath };
116
+ return currentPath;
92
117
  }
93
118
  if (Array.isArray(obj)) {
94
119
  for (let i = 0; i < obj.length; i++) {
95
- const result = searchInObject(
120
+ const result = findPropPath(
96
121
  obj[i],
97
122
  targetProps,
98
123
  fields,
99
- componentId,
100
124
  currentPath ? `${currentPath}[${i}]` : `[${i}]`
101
125
  );
102
- if (result) return result;
126
+ if (result !== null) return result;
103
127
  }
104
128
  return null;
105
129
  }
106
130
  for (const key of Object.keys(obj)) {
107
- const result = searchInObject(
131
+ const result = findPropPath(
108
132
  obj[key],
109
133
  targetProps,
110
134
  fields,
111
- componentId,
112
135
  currentPath ? `${currentPath}.${key}` : key
113
136
  );
114
- if (result) return result;
115
- }
116
- return null;
117
- }
118
- function findComponentById(data, componentId) {
119
- const content = Array.isArray(data == null ? void 0 : data.content) ? data.content : [];
120
- const contentMatch = content.find((component) => {
121
- var _a;
122
- return ((_a = component == null ? void 0 : component.props) == null ? void 0 : _a.id) === componentId;
123
- });
124
- if (contentMatch) return contentMatch;
125
- const zones = (data == null ? void 0 : data.zones) && typeof data.zones === "object" ? data.zones : {};
126
- for (const zoneKey of Object.keys(zones)) {
127
- const zoneComponents = Array.isArray(zones[zoneKey]) ? zones[zoneKey] : [];
128
- const zoneMatch = zoneComponents.find((component) => {
129
- var _a;
130
- return ((_a = component == null ? void 0 : component.props) == null ? void 0 : _a.id) === componentId;
131
- });
132
- if (zoneMatch) return zoneMatch;
137
+ if (result !== null) return result;
133
138
  }
134
139
  return null;
135
140
  }
@@ -1,4 +1,4 @@
1
- import { Action } from "./core/types";
1
+ import { Action } from "../core/types";
2
2
  interface ActionFieldProps {
3
3
  name: string;
4
4
  value: Action | undefined;
@@ -1,8 +1,12 @@
1
1
  "use client";
2
2
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
- import { Input } from "../shadcn/input.js";
4
- import { Label } from "../shadcn/label.js";
5
- import { Tabs, TabsList, TabsTrigger } from "../shadcn/tabs.js";
3
+ import { memo, useCallback } from "react";
4
+ import { Input } from "../../shadcn/input.js";
5
+ import { Button } from "../../shadcn/button.js";
6
+ import { Label } from "../../shadcn/label.js";
7
+ import { Tabs, TabsList, TabsTrigger } from "../../shadcn/tabs.js";
8
+ import { LinkIcon, XIcon, ClipboardIcon, GlobeIcon } from "lucide-react";
9
+ import { useEditorContext } from "../editor-context.js";
6
10
  const ACTION_TYPE_OPTIONS = [
7
11
  { label: "Page Link", value: "page" },
8
12
  { label: "External Link", value: "external" },
@@ -12,6 +16,82 @@ const ACTION_TYPE_OPTIONS = [
12
16
  { label: "Download", value: "download" },
13
17
  { label: "None", value: "none" }
14
18
  ];
19
+ const PageUrlField = memo(function PageUrlField2({
20
+ name,
21
+ value,
22
+ onChange
23
+ }) {
24
+ const { sitePages } = useEditorContext();
25
+ const pages = sitePages ?? [];
26
+ const selectedSlug = value.startsWith("/") ? value.slice(1) : null;
27
+ const handlePaste = useCallback(async () => {
28
+ try {
29
+ const text = await navigator.clipboard.readText();
30
+ if (text) onChange(text.trim());
31
+ } catch {
32
+ }
33
+ }, [onChange]);
34
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
35
+ /* @__PURE__ */ jsx(Label, { children: "Page URL" }),
36
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
37
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2 rounded-lg border px-3 py-2", children: [
38
+ /* @__PURE__ */ jsx(LinkIcon, { className: "text-muted-foreground size-4 shrink-0" }),
39
+ /* @__PURE__ */ jsx(
40
+ "input",
41
+ {
42
+ name: `${name}.pageUrl`,
43
+ className: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",
44
+ placeholder: "/about",
45
+ value,
46
+ onChange: (e) => onChange(e.target.value)
47
+ }
48
+ ),
49
+ value && /* @__PURE__ */ jsx(
50
+ "button",
51
+ {
52
+ type: "button",
53
+ className: "text-muted-foreground hover:text-foreground shrink-0",
54
+ onClick: () => onChange(""),
55
+ children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5" })
56
+ }
57
+ )
58
+ ] }),
59
+ /* @__PURE__ */ jsxs(
60
+ Button,
61
+ {
62
+ type: "button",
63
+ variant: "outline",
64
+ size: "sm",
65
+ className: "shrink-0 gap-1.5",
66
+ onClick: handlePaste,
67
+ children: [
68
+ /* @__PURE__ */ jsx(ClipboardIcon, { className: "size-3.5" }),
69
+ "Paste"
70
+ ]
71
+ }
72
+ )
73
+ ] }),
74
+ pages.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
75
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs font-medium", children: "Site pages" }),
76
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: pages.map((page) => {
77
+ const isSelected = selectedSlug === page.slug;
78
+ return /* @__PURE__ */ jsxs(
79
+ "button",
80
+ {
81
+ type: "button",
82
+ className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors ${isSelected ? "border-primary bg-primary text-primary-foreground" : "border-border bg-background text-foreground hover:bg-accent"}`,
83
+ onClick: () => onChange(isSelected ? "" : `${page.slug}`),
84
+ children: [
85
+ /* @__PURE__ */ jsx(GlobeIcon, { className: "size-3" }),
86
+ page.label
87
+ ]
88
+ },
89
+ page.slug
90
+ );
91
+ }) })
92
+ ] })
93
+ ] });
94
+ });
15
95
  function ActionField({ name, value, onChange }) {
16
96
  const current = value ?? { type: "none" };
17
97
  const update = (patch) => {
@@ -37,19 +117,14 @@ function ActionField({ name, value, onChange }) {
37
117
  }
38
118
  )
39
119
  ] }),
40
- current.type === "page" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
41
- /* @__PURE__ */ jsx(Label, { children: "Page URL" }),
42
- /* @__PURE__ */ jsx(
43
- Input,
44
- {
45
- name: `${name}.pageUrl`,
46
- className: "h-8 text-sm",
47
- value: current.pageUrl ?? "",
48
- onChange: (e) => update({ pageUrl: e.target.value }),
49
- placeholder: "/about"
50
- }
51
- )
52
- ] }),
120
+ current.type === "page" && /* @__PURE__ */ jsx(
121
+ PageUrlField,
122
+ {
123
+ name,
124
+ value: current.pageUrl ?? "",
125
+ onChange: (val) => update({ pageUrl: val })
126
+ }
127
+ ),
53
128
  current.type === "external" && /* @__PURE__ */ jsxs(Fragment, { children: [
54
129
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
55
130
  /* @__PURE__ */ jsx(Label, { children: "External URL" }),
@@ -1,3 +1,2 @@
1
1
  import type { AutoFieldProps } from "./types";
2
- /** 按 field.type 分发控件;名为 url 且类型为 text 时固定使用 UrlField(链接 + 站内路由) */
3
2
  export declare const AutoField: import("react").NamedExoticComponent<AutoFieldProps>;