Browse Source

Minor Fluent API changes

Marcin Ziąbek 4 years ago
parent
commit
779245b260

+ 8 - 8
QuestPDF.Examples/ElementExamples.cs

@@ -24,7 +24,7 @@ namespace QuestPDF.Examples
             container
                 .Background("#FFF")
                 .Padding(25)
-                .Section(section =>
+                .Decoration(section =>
                 {
                     section
                         .Header()
@@ -81,12 +81,12 @@ namespace QuestPDF.Examples
                 .Padding(20)
                 .Stack(stack =>
                 {
-                    stack.Element()
+                    stack.Item()
                         .PaddingBottom(10)
                         .AlignCenter()
                         .Text("This Row element is 700pt wide");
 
-                    stack.Element().Row(row =>
+                    stack.Item().Row(row =>
                     {
                         row.ConstantColumn(100)
                             .Background("#DDD")
@@ -119,17 +119,17 @@ namespace QuestPDF.Examples
                     column.Spacing(10);
                     
                     column
-                        .Element()
+                        .Item()
                         .Background("#999")
                         .Height(50);
                     
                     column
-                        .Element()
+                        .Item()
                         .Background("#BBB")
                         .Height(100);
                     
                     column
-                        .Element()
+                        .Item()
                         .Background("#DDD")
                         .Height(150);
                 });
@@ -203,8 +203,8 @@ namespace QuestPDF.Examples
                     
                     layers.PrimaryLayer().Stack(stack =>
                     {
-                        stack.Element().PaddingTop(20).Text("Text 1");
-                        stack.Element().PaddingTop(40).Text("Text 2");
+                        stack.Item().PaddingTop(20).Text("Text 1");
+                        stack.Item().PaddingTop(40).Text("Text 2");
                     });
                     
                     layers.Layer().Canvas((canvas, size) =>

+ 1 - 1
QuestPDF.Examples/FrameExample.cs

@@ -32,7 +32,7 @@ namespace QuestPDF.Examples
                 {
                     for(var i=1; i<=4; i++)
                     {
-                        stack.Element().Row(row =>
+                        stack.Item().Row(row =>
                         {
                             row.RelativeColumn(2).LabelCell().Text(Placeholders.Label());
                             row.RelativeColumn(3).ValueCell().Text(Placeholders.Paragraph());

+ 2 - 2
QuestPDF.Examples/LoremPicsumExample.cs

@@ -41,11 +41,11 @@ namespace QuestPDF.Examples
                     column.Spacing(10);
 
                     column
-                        .Element()
+                        .Item()
                         .Component(new LoremPicsum(true));
                     
                     column
-                        .Element()
+                        .Item()
                         .AlignRight()
                         .Text("From Lorem Picsum");
                 });

+ 5 - 5
QuestPDF.Examples/Padding.cs

@@ -43,7 +43,7 @@ namespace QuestPDF.Examples
                 .Stack(column =>
                 {
                     column
-                        .Element()
+                        .Item()
                         .Height(100)
                         .Background("#FFF")
                         
@@ -55,7 +55,7 @@ namespace QuestPDF.Examples
                         .Background("#444");
                     
                     column
-                        .Element()
+                        .Item()
                         .Height(100)
                         .Background("#DDD")
                         
@@ -67,7 +67,7 @@ namespace QuestPDF.Examples
                         .Background("#222");
                     
                     column
-                        .Element()
+                        .Item()
                         .Height(100)
                         .Background("#BBB")
                         
@@ -86,7 +86,7 @@ namespace QuestPDF.Examples
                 .Stack(column =>
                 {
                     column
-                        .Element()
+                        .Item()
                         .Height(150)
                         .Row(row =>
                         {
@@ -108,7 +108,7 @@ namespace QuestPDF.Examples
                         });
                     
                     column
-                        .Element()
+                        .Item()
                         .Height(150)
                         .Row(row =>
                         {

+ 4 - 4
QuestPDF.ReportSample/Layouts/PhotoTemplate.cs

@@ -20,8 +20,8 @@ namespace QuestPDF.ReportSample.Layouts
                 .Stack(stack =>
                 {
                     stack.Spacing(5);
-                    stack.Element(PhotoWithMaps);
-                    stack.Element(PhotoDetails);
+                    stack.Item(PhotoWithMaps);
+                    stack.Item(PhotoDetails);
                 });
         }
         
@@ -36,8 +36,8 @@ namespace QuestPDF.ReportSample.Layouts
                     {
                         stack.Spacing(7f);
                         
-                        stack.Element().AspectRatio(4 / 3f).Image(Placeholders.Image);
-                        stack.Element().AspectRatio(4 / 3f).Image(Placeholders.Image);
+                        stack.Item().AspectRatio(4 / 3f).Image(Placeholders.Image);
+                        stack.Item().AspectRatio(4 / 3f).Image(Placeholders.Image);
                     });
                 });
         }

+ 4 - 4
QuestPDF.ReportSample/Layouts/SectionTemplate.cs

@@ -17,7 +17,7 @@ namespace QuestPDF.ReportSample.Layouts
         {
             container
                 .EnsureSpace()
-                .Section(section =>
+                .Decoration(section =>
                 {
                     section
                         .Header()
@@ -28,7 +28,7 @@ namespace QuestPDF.ReportSample.Layouts
                     {
                         foreach (var part in Model.Parts)
                         {
-                            stack.Element().Row(row =>
+                            stack.Item().Row(row =>
                             {
                                 row.ConstantColumn(150).LabelCell().Text(part.Label, Typography.Normal);
                                 var frame = row.RelativeColumn().ValueCell();
@@ -59,8 +59,8 @@ namespace QuestPDF.ReportSample.Layouts
             {
                 stack.Spacing(5);
                 
-                stack.Element().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image);
-                stack.Element().Text(model.Location.Format(), Typography.Normal);
+                stack.Item().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image);
+                stack.Item().Text(model.Location.Format(), Typography.Normal);
             });
         }
         

+ 10 - 10
QuestPDF.ReportSample/Layouts/StandardReport.cs

@@ -40,7 +40,7 @@ namespace QuestPDF.ReportSample.Layouts
         {
             container.Stack(stack =>
             {
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.Spacing(50);
                     
@@ -48,9 +48,9 @@ namespace QuestPDF.ReportSample.Layouts
                     row.ConstantColumn(150).ExternalLink("https://www.questpdf.com").Image(Model.LogoData);
                 });
 
-                stack.Element().ShowOnce().PaddingVertical(15).Border(1f).BorderColor(Colors.Grey.Lighten1).ExtendHorizontal();
+                stack.Item().ShowOnce().PaddingVertical(15).Border(1f).BorderColor(Colors.Grey.Lighten1).ExtendHorizontal();
                 
-                stack.Element().ShowOnce().Grid(grid =>
+                stack.Item().ShowOnce().Grid(grid =>
                 {
                     grid.Columns(2);
                     grid.Spacing(5);
@@ -59,8 +59,8 @@ namespace QuestPDF.ReportSample.Layouts
                     {
                         grid.Element().Stack(row =>
                         {   
-                            row.Element().AlignLeft().Text(field.Label, Typography.Normal.SemiBold());
-                            row.Element().Text(field.Value, Typography.Normal);
+                            row.Item().AlignLeft().Text(field.Label, Typography.Normal.SemiBold());
+                            row.Item().Text(field.Value, Typography.Normal);
                         });
                     }
                 });
@@ -73,16 +73,16 @@ namespace QuestPDF.ReportSample.Layouts
             {
                 stack.Spacing(20);
 
-                stack.Element().Component(new TableOfContentsTemplate(Model.Sections));
+                stack.Item().Component(new TableOfContentsTemplate(Model.Sections));
                 
                 foreach (var section in Model.Sections)
-                    stack.Element().Location(section.Title).Component(new SectionTemplate(section));
+                    stack.Item().Location(section.Title).Component(new SectionTemplate(section));
 
-                stack.Element().PageBreak();
-                stack.Element().Location("Photos");
+                stack.Item().PageBreak();
+                stack.Item().Location("Photos");
                 
                 foreach (var photo in Model.Photos)
-                    stack.Element().Component(new PhotoTemplate(photo));
+                    stack.Item().Component(new PhotoTemplate(photo));
             });
         }
     }

+ 3 - 3
QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs

@@ -16,7 +16,7 @@ namespace QuestPDF.ReportSample.Layouts
         public void Compose(IContainer container)
         {
             container
-                .Section(section =>
+                .Decoration(section =>
                 {
                     section
                         .Header()
@@ -28,9 +28,9 @@ namespace QuestPDF.ReportSample.Layouts
                         stack.Spacing(5);
                         
                         for (var i = 0; i < Sections.Count; i++)
-                            stack.Element(c => DrawLink(c, i+1, Sections[i].Title));
+                            stack.Item(c => DrawLink(c, i+1, Sections[i].Title));
 
-                        stack.Element(c => DrawLink(c, Sections.Count+1, "Photos"));
+                        stack.Item(c => DrawLink(c, Sections.Count+1, "Photos"));
                     });
                 });
         }

+ 7 - 7
QuestPDF.UnitTests/DecorationTests.cs

@@ -15,7 +15,7 @@ namespace QuestPDF.UnitTests
         public void Measure_ReturnsWrap_WhenDecorationReturnsWrap()
         {
             TestPlan
-                .For(x => new Decoration
+                .For(x => new SimpleDecoration
                 {
                     Type = DecorationType.Append,
                     DecorationElement = x.CreateChild("decoration"),
@@ -30,7 +30,7 @@ namespace QuestPDF.UnitTests
         public void Measure_ReturnsWrap_WhenDecorationReturnsPartialRender()
         {
             TestPlan
-                .For(x => new Decoration
+                .For(x => new SimpleDecoration
                 {
                     Type = DecorationType.Append,
                     DecorationElement = x.CreateChild("decoration"),
@@ -45,7 +45,7 @@ namespace QuestPDF.UnitTests
         public void Measure_ReturnsWrap_WhenContentReturnsWrap()
         {
             TestPlan
-                .For(x => new Decoration
+                .For(x => new SimpleDecoration
                 {
                     Type = DecorationType.Append,
                     DecorationElement = x.CreateChild("decoration"),
@@ -61,7 +61,7 @@ namespace QuestPDF.UnitTests
         public void Measure_ReturnsPartialRender_WhenContentReturnsPartialRender()
         {
             TestPlan
-                .For(x => new Decoration
+                .For(x => new SimpleDecoration
                 {
                     Type = DecorationType.Append,
                     DecorationElement = x.CreateChild("decoration"),
@@ -77,7 +77,7 @@ namespace QuestPDF.UnitTests
         public void Measure_ReturnsFullRender_WhenContentReturnsFullRender()
         {
             TestPlan
-                .For(x => new Decoration
+                .For(x => new SimpleDecoration
                 {
                     Type = DecorationType.Append,
                     DecorationElement = x.CreateChild("decoration"),
@@ -97,7 +97,7 @@ namespace QuestPDF.UnitTests
         public void Draw_Prepend()
         {
             TestPlan
-                .For(x => new Decoration
+                .For(x => new SimpleDecoration
                 {
                     Type = DecorationType.Prepend,
                     DecorationElement = x.CreateChild("decoration"),
@@ -116,7 +116,7 @@ namespace QuestPDF.UnitTests
         public void Draw_Append()
         {
             TestPlan
-                .For(x => new Decoration
+                .For(x => new SimpleDecoration
                 {
                     Type = DecorationType.Append,
                     DecorationElement = x.CreateChild("decoration"),

+ 9 - 9
QuestPDF.UnitTests/GridTests.cs

@@ -41,21 +41,21 @@ namespace QuestPDF.UnitTests
             
             expected.Stack(stack =>
             {
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(6).Element(childA);
                     row.RelativeColumn(4).Element(childB);
                     row.RelativeColumn(2).Element(new Empty());
                 });
                 
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(4).Element(childC);
                     row.RelativeColumn(2).Element(childD);
                     row.RelativeColumn(6).Element(new Empty());
                 });
                 
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(8).Element(childE);
                     row.RelativeColumn(4).Element(new Empty());
@@ -95,7 +95,7 @@ namespace QuestPDF.UnitTests
             
             expected.Stack(stack =>
             {
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(1).Element(new Empty());
                     row.RelativeColumn(6).Element(childA);
@@ -103,7 +103,7 @@ namespace QuestPDF.UnitTests
                     row.RelativeColumn(1).Element(new Empty());
                 });
                 
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(3).Element(new Empty());
                     row.RelativeColumn(4).Element(childC);
@@ -111,7 +111,7 @@ namespace QuestPDF.UnitTests
                     row.RelativeColumn(3).Element(new Empty());
                 });
                 
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(2).Element(new Empty());
                     row.RelativeColumn(8).Element(childE);
@@ -152,21 +152,21 @@ namespace QuestPDF.UnitTests
             
             expected.Container().Stack(stack =>
             {
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(2).Element(new Empty());
                     row.RelativeColumn(6).Element(childA);
                     row.RelativeColumn(4).Element(childB);
                 });
                 
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(6).Element(new Empty());
                     row.RelativeColumn(4).Element(childC);
                     row.RelativeColumn(2).Element(childD);
                 });
                 
-                stack.Element().Row(row =>
+                stack.Item().Row(row =>
                 {
                     row.RelativeColumn(4).Element(new Empty());
                     row.RelativeColumn(8).Element(childE);

+ 30 - 12
QuestPDF.UnitTests/StackTests.cs

@@ -197,9 +197,9 @@ namespace QuestPDF.UnitTests
                 {
                     stack.Spacing(0);
 
-                    stack.Element(childA);
-                    stack.Element(childB);
-                    stack.Element(childC);
+                    stack.Item().Element(childA);
+                    stack.Item().Element(childB);
+                    stack.Item().Element(childC);
                 });
             
             // assert
@@ -207,9 +207,18 @@ namespace QuestPDF.UnitTests
             {
                 Children = new List<Element>
                 {
-                    childA,
-                    childB,
-                    childC
+                    new Container
+                    {
+                        Child = childA
+                    },
+                    new Container
+                    {
+                        Child = childB
+                    },
+                    new Container
+                    {
+                        Child = childC
+                    }
                 }
             };
             
@@ -232,9 +241,9 @@ namespace QuestPDF.UnitTests
                 {
                     stack.Spacing(100);
 
-                    stack.Element(childA);
-                    stack.Element(childB);
-                    stack.Element(childC);
+                    stack.Item().Element(childA);
+                    stack.Item().Element(childB);
+                    stack.Item().Element(childC);
                 });
             
             // assert
@@ -248,17 +257,26 @@ namespace QuestPDF.UnitTests
                         new Padding
                         {
                             Bottom = 100,
-                            Child = childA
+                            Child = new Container
+                            {
+                                Child = childA
+                            }
                         },
                         new Padding
                         {
                             Bottom = 100,
-                            Child = childB
+                            Child = new Container
+                            {
+                                Child = childB
+                            }
                         },
                         new Padding
                         {
                             Bottom = 100,
-                            Child = childC
+                            Child = new Container
+                            {
+                                Child = childC
+                            }
                         },
                     }
                 }

+ 17 - 52
QuestPDF/Elements/Decoration.cs

@@ -1,62 +1,27 @@
-using System;
-using QuestPDF.Drawing.SpacePlan;
+using QuestPDF.Fluent;
 using QuestPDF.Infrastructure;
 
 namespace QuestPDF.Elements
 {
-    internal enum DecorationType
+    internal class Decoration : IComponent
     {
-        Prepend,
-        Append
-    }
-    
-    internal class Decoration : Element
-    {
-        public Element DecorationElement { get; set; } = new Empty();
-        public Element ContentElement { get; set; } = new Empty();
-        public DecorationType Type { get; set; } 
-
-        internal override ISpacePlan Measure(Size availableSpace)
-        {
-            var decorationMeasure = DecorationElement?.Measure(availableSpace);
-            
-            if (decorationMeasure is Wrap || decorationMeasure is PartialRender)
-                return new Wrap();
-
-            var decorationSize = decorationMeasure as Size ?? Size.Zero;
-            var contentMeasure = ContentElement?.Measure(new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height)) ?? new FullRender(Size.Zero);
-            
-            if (contentMeasure is Wrap)
-                return new Wrap();
+        public Element Header { get; set; } = new Empty();
+        public Element Content { get; set; } = new Empty();
+        public Element Footer { get; set; } = new Empty();
 
-            var contentSize = contentMeasure as Size ?? Size.Zero;
-            var resultSize = new Size(availableSpace.Width, decorationSize.Height + contentSize.Height);
-            
-            if (contentSize is PartialRender)
-                return new PartialRender(resultSize);
-            
-            if (contentSize is FullRender)
-                return new FullRender(resultSize);
-            
-            throw new NotSupportedException();
-        }
-
-        internal override void Draw(ICanvas canvas, Size availableSpace)
+        public void Compose(IContainer container)
         {
-            var decorationSize = DecorationElement?.Measure(availableSpace) as Size ?? Size.Zero;
-            var contentSize = new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height);
-
-            var translateHeight = Type == DecorationType.Prepend ? decorationSize.Height : contentSize.Height;
-            Action drawDecoration = () => DecorationElement?.Draw(canvas, new Size(availableSpace.Width, decorationSize.Height));
-            Action drawContent = () => ContentElement?.Draw(canvas, new Size (availableSpace.Width, contentSize.Height));
-
-            var first = Type == DecorationType.Prepend ? drawDecoration : drawContent;
-            var second = Type == DecorationType.Prepend ? drawContent : drawDecoration;
-
-            first();
-            canvas.Translate(new Position(0, translateHeight));
-            second();
-            canvas.Translate(new Position(0, -translateHeight));
+            container.Element(new SimpleDecoration
+            {
+                Type = DecorationType.Prepend,
+                DecorationElement = Header,
+                ContentElement = new SimpleDecoration
+                {
+                    Type = DecorationType.Append,
+                    ContentElement = Content,
+                    DecorationElement = Footer
+                }
+            });
         }
     }
 }

+ 1 - 1
QuestPDF/Elements/Grid.cs

@@ -33,7 +33,7 @@ namespace QuestPDF.Elements
                 stack.Spacing(HorizontalSpacing);
                 
                 while (ChildrenQueue.Any())
-                    stack.Element().Row(BuildRow);
+                    stack.Item().Row(BuildRow);
             });
         }
         

+ 1 - 1
QuestPDF/Elements/Page.cs

@@ -11,7 +11,7 @@ namespace QuestPDF.Elements
 
         public void Compose(IContainer container)
         {
-            container.Section(section =>
+            container.Decoration(section =>
             {
                 section.Header().Element(Header);
                 section.Content().Extend().Element(Content);

+ 0 - 27
QuestPDF/Elements/Section.cs

@@ -1,27 +0,0 @@
-using QuestPDF.Fluent;
-using QuestPDF.Infrastructure;
-
-namespace QuestPDF.Elements
-{
-    internal class Section : IComponent
-    {
-        public Element Header { get; set; } = new Empty();
-        public Element Content { get; set; } = new Empty();
-        public Element Footer { get; set; } = new Empty();
-
-        public void Compose(IContainer container)
-        {
-            container.Element(new Decoration
-            {
-                Type = DecorationType.Prepend,
-                DecorationElement = Header,
-                ContentElement = new Decoration
-                {
-                    Type = DecorationType.Append,
-                    ContentElement = Content,
-                    DecorationElement = Footer
-                }
-            });
-        }
-    }
-}

+ 62 - 0
QuestPDF/Elements/SimpleDecoration.cs

@@ -0,0 +1,62 @@
+using System;
+using QuestPDF.Drawing.SpacePlan;
+using QuestPDF.Infrastructure;
+
+namespace QuestPDF.Elements
+{
+    internal enum DecorationType
+    {
+        Prepend,
+        Append
+    }
+    
+    internal class SimpleDecoration : Element
+    {
+        public Element DecorationElement { get; set; } = new Empty();
+        public Element ContentElement { get; set; } = new Empty();
+        public DecorationType Type { get; set; } 
+
+        internal override ISpacePlan Measure(Size availableSpace)
+        {
+            var decorationMeasure = DecorationElement?.Measure(availableSpace);
+            
+            if (decorationMeasure is Wrap || decorationMeasure is PartialRender)
+                return new Wrap();
+
+            var decorationSize = decorationMeasure as Size ?? Size.Zero;
+            var contentMeasure = ContentElement?.Measure(new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height)) ?? new FullRender(Size.Zero);
+            
+            if (contentMeasure is Wrap)
+                return new Wrap();
+
+            var contentSize = contentMeasure as Size ?? Size.Zero;
+            var resultSize = new Size(availableSpace.Width, decorationSize.Height + contentSize.Height);
+            
+            if (contentSize is PartialRender)
+                return new PartialRender(resultSize);
+            
+            if (contentSize is FullRender)
+                return new FullRender(resultSize);
+            
+            throw new NotSupportedException();
+        }
+
+        internal override void Draw(ICanvas canvas, Size availableSpace)
+        {
+            var decorationSize = DecorationElement?.Measure(availableSpace) as Size ?? Size.Zero;
+            var contentSize = new Size(availableSpace.Width, availableSpace.Height - decorationSize.Height);
+
+            var translateHeight = Type == DecorationType.Prepend ? decorationSize.Height : contentSize.Height;
+            Action drawDecoration = () => DecorationElement?.Draw(canvas, new Size(availableSpace.Width, decorationSize.Height));
+            Action drawContent = () => ContentElement?.Draw(canvas, new Size (availableSpace.Width, contentSize.Height));
+
+            var first = Type == DecorationType.Prepend ? drawDecoration : drawContent;
+            var second = Type == DecorationType.Prepend ? drawContent : drawDecoration;
+
+            first();
+            canvas.Translate(new Position(0, translateHeight));
+            second();
+            canvas.Translate(new Position(0, -translateHeight));
+        }
+    }
+}

+ 8 - 8
QuestPDF/Fluent/SectionExtensions.cs

@@ -4,14 +4,14 @@ using QuestPDF.Infrastructure;
 
 namespace QuestPDF.Fluent
 {
-    public class SectionDescriptor
+    public class DecorationDescriptor
     {
-        internal Section Section { get; } = new Section();
+        internal Decoration Decoration { get; } = new Decoration();
         
         public IContainer Header()
         {
             var container = new Container();
-            Section.Header = container;
+            Decoration.Header = container;
             return container;
         }
         
@@ -23,7 +23,7 @@ namespace QuestPDF.Fluent
         public IContainer Content()
         {
             var container = new Container();
-            Section.Content = container;
+            Decoration.Content = container;
             return container;
         }
         
@@ -35,7 +35,7 @@ namespace QuestPDF.Fluent
         public IContainer Footer()
         {
             var container = new Container();
-            Section.Footer = container;
+            Decoration.Footer = container;
             return container;
         }
         
@@ -47,12 +47,12 @@ namespace QuestPDF.Fluent
     
     public static class SectionExtensions
     {
-        public static void Section(this IContainer element, Action<SectionDescriptor> handler)
+        public static void Decoration(this IContainer element, Action<DecorationDescriptor> handler)
         {
-            var descriptor = new SectionDescriptor();
+            var descriptor = new DecorationDescriptor();
             handler(descriptor);
             
-            element.Component(descriptor.Section);
+            element.Component(descriptor.Decoration);
         }
     }
 }

+ 8 - 13
QuestPDF/Fluent/StackExtensions.cs

@@ -8,7 +8,7 @@ namespace QuestPDF.Fluent
 {
     public class StackDescriptor
     {
-        private List<Element> Elements { get; } = new List<Element>();
+        private List<Element> Items { get; } = new List<Element>();
         private float StackSpacing { get; set; } = 0;
         
         public void Spacing(float value)
@@ -16,35 +16,30 @@ namespace QuestPDF.Fluent
             StackSpacing = value;
         }
         
-        public IContainer Element()
+        public IContainer Item()
         {
             var container = new Container();
-            Elements.Add(container);
+            Items.Add(container);
             return container;
         }
         
-        public void Element(Action<IContainer> handler)
+        public void Item(Action<IContainer> handler)
         {
-            handler?.Invoke(Element());
+            handler?.Invoke(Item());
         }
         
-        public void Element(IElement element)
-        {
-            Elements.Add(element as Element);
-        }
-
         internal Element CreateStack()
         {
-            if (Elements.Count == 0)
+            if (Items.Count == 0)
                 return new Empty();
             
             if (StackSpacing <= Size.Epsilon)
                 return new Stack
                 {
-                    Children = Elements
+                    Children = Items
                 };
             
-            var children = Elements
+            var children = Items
                 .Select(x => new Padding
                 {
                     Bottom = StackSpacing,