Phase 5.7 - Add phase 5.7 widgets and examples - #2
Merged
Conversation
- Added `widgets-phase-5.7.mjs` showcasing new widgets including shapes, annotations, and layout features. - Implemented `Directionality` and `GridPaper` widgets in `src/widgets` for text directionality and grid layouts. - Created tests for new widgets and features in `widgets_phase_5_7.test.mjs` to ensure functionality and correctness.
There was a problem hiding this comment.
Pull request overview
This PR completes “phase 5.7” of the port by adding the remaining retained widget surface (pagination utilities, list composition, directionality/context scoping, grid paper, shapes, outlines, and geometric annotations), along with corresponding examples/tests and documentation/version updates.
Changes:
- Adds new widgets and context plumbing:
NewPage,ListView,GridPaper,Directionality,InheritedWidget,DelayedWidget,Inseparable,Watermark,Footer, shape widgets, outline + geometric annotations. - Extends PDF annotation serialization to include square/circle/polygon/polyline/ink annotation subtypes.
- Adds phase 5.7 examples/tests and updates attribution banners + docs + package version.
Reviewed changes
Copilot reviewed 154 out of 171 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| AI_USAGE.md | Documents new 5.7 examples/widgets |
| README.md | Updates project status + highlights + links |
| docs/ARCHITECTURE.md | Updates architecture docs for inherited map + widgets |
| docs/PORTING-STATUS.md | Updates porting status to 5.7 |
| docs/ROADMAP.md | Marks phase 5.7 complete + details |
| examples/README.md | Documents new phase/production examples |
| examples/generation-results.json | Updates generated timestamp |
| examples/production-pagination.mjs | Adds production pagination regression example |
| examples/run-phase-examples.mjs | Adds phase 5.7 example runner entry |
| examples/run-production-pagination.mjs | Adds runner for production pagination example |
| examples/widgets-phase-5.7.mjs | Adds phase 5.7 widget showcase example |
| package-lock.json | Bumps lockfile version field to 0.1.2 |
| package.json | Bumps version + adds example script |
| rollup.config.mjs | Exports banner + updates attribution URLs |
| src/barcode/barcode.ts | Attribution header URL update |
| src/barcode/barcode_1d.ts | Attribution header URL update |
| src/barcode/barcode_2d.ts | Attribution header URL update |
| src/barcode/barcode_exception.ts | Attribution header URL update |
| src/barcode/barcode_factory.ts | Attribution header URL update |
| src/barcode/barcode_hm.ts | Attribution header URL update |
| src/barcode/barcode_maps.ts | Attribution header URL update |
| src/barcode/barcode_operations.ts | Attribution header URL update |
| src/barcode/code128.ts | Attribution header URL update |
| src/barcode/code39.ts | Attribution header URL update |
| src/barcode/code93.ts | Attribution header URL update |
| src/barcode/codabar.ts | Attribution header URL update |
| src/barcode/ean.ts | Attribution header URL update |
| src/barcode/ean13.ts | Attribution header URL update |
| src/barcode/ean2.ts | Attribution header URL update |
| src/barcode/ean5.ts | Attribution header URL update |
| src/barcode/ean8.ts | Attribution header URL update |
| src/barcode/isbn.ts | Attribution header URL update |
| src/barcode/itf.ts | Attribution header URL update |
| src/barcode/itf14.ts | Attribution header URL update |
| src/barcode/itf16.ts | Attribution header URL update |
| src/barcode/pdf417.ts | Attribution header URL update |
| src/barcode/pdf417_codewords.ts | Attribution header URL update |
| src/barcode/postnet.ts | Attribution header URL update |
| src/barcode/qrcode.ts | Attribution header URL update |
| src/barcode/rm4scc.ts | Attribution header URL update |
| src/barcode/telepen.ts | Attribution header URL update |
| src/barcode/upca.ts | Attribution header URL update |
| src/barcode/upce.ts | Attribution header URL update |
| src/base/assert.ts | Attribution header URL update |
| src/base/utf8.ts | Attribution header URL update |
| src/index.ts | Exports new 5.7 widgets/types |
| src/pdf/color.ts | Attribution header URL update |
| src/pdf/document.ts | Attribution header URL update |
| src/pdf/format/array.ts | Attribution header URL update |
| src/pdf/format/base.ts | Attribution header URL update |
| src/pdf/format/bool.ts | Attribution header URL update |
| src/pdf/format/dict.ts | Attribution header URL update |
| src/pdf/format/dict_stream.ts | Attribution header URL update |
| src/pdf/format/indirect.ts | Attribution header URL update |
| src/pdf/format/name.ts | Attribution header URL update |
| src/pdf/format/null_value.ts | Attribution header URL update |
| src/pdf/format/num.ts | Attribution header URL update |
| src/pdf/format/object_base.ts | Attribution header URL update |
| src/pdf/format/stream.ts | Attribution header URL update |
| src/pdf/format/string.ts | Attribution header URL update |
| src/pdf/format/xref.ts | Attribution header URL update |
| src/pdf/font/font.ts | Attribution header URL update |
| src/pdf/font/font_metrics.ts | Attribution header URL update |
| src/pdf/font/ttf_parser.ts | Attribution header URL update |
| src/pdf/font/ttf_writer.ts | Attribution header URL update |
| src/pdf/font/type1_fonts.ts | Attribution header URL update |
| src/pdf/graphic_state.ts | Attribution header URL update |
| src/pdf/graphics.ts | Adds addAnnotation(...) API |
| src/pdf/image/jpeg.ts | Attribution header URL update |
| src/pdf/image/png.ts | Attribution header URL update |
| src/pdf/matrix.ts | Attribution header URL update |
| src/pdf/obj/annotation.ts | Adds geometric annotation serialization |
| src/pdf/obj/catalog.ts | Attribution header URL update |
| src/pdf/obj/function.ts | Attribution header URL update |
| src/pdf/obj/graphic_stream.ts | Attribution header URL update |
| src/pdf/obj/image.ts | Attribution header URL update |
| src/pdf/obj/info.ts | Attribution header URL update |
| src/pdf/obj/metadata.ts | Attribution header URL update |
| src/pdf/obj/names.ts | Attribution header URL update |
| src/pdf/obj/object.ts | Attribution header URL update |
| src/pdf/obj/object_stream.ts | Attribution header URL update |
| src/pdf/obj/outline.ts | Attribution header URL update |
| src/pdf/obj/page.ts | Attribution header URL update |
| src/pdf/obj/page_label.ts | Attribution header URL update |
| src/pdf/obj/page_list.ts | Attribution header URL update |
| src/pdf/obj/pattern.ts | Attribution header URL update |
| src/pdf/obj/shading.ts | Attribution header URL update |
| src/pdf/obj/ttf_font.ts | Attribution header URL update |
| src/pdf/obj/unicode_cmap.ts | Attribution header URL update |
| src/pdf/obj/xobject.ts | Attribution header URL update |
| src/pdf/page_format.ts | Attribution header URL update |
| src/pdf/rect.ts | Attribution header URL update |
| src/svg/brush.ts | Attribution header URL update |
| src/svg/clip_path.ts | Attribution header URL update |
| src/svg/color.ts | Attribution header URL update |
| src/svg/colors.ts | Attribution header URL update |
| src/svg/gradient.ts | Attribution header URL update |
| src/svg/group.ts | Attribution header URL update |
| src/svg/operation.ts | Attribution header URL update |
| src/svg/painter.ts | Attribution header URL update |
| src/svg/parser.ts | Attribution header URL update |
| src/svg/path.ts | Attribution header URL update |
| src/svg/symbol.ts | Attribution header URL update |
| src/svg/transform.ts | Attribution header URL update |
| src/svg/use.ts | Attribution header URL update |
| src/svg/xml.ts | Attribution header URL update |
| src/widgets/annotations.ts | Adds geometric annotation widgets + Outline |
| src/widgets/basic.ts | Attribution header URL update |
| src/widgets/barcode.ts | Attribution header URL update |
| src/widgets/border_radius.ts | Attribution header URL update |
| src/widgets/box_border.ts | Attribution header URL update |
| src/widgets/chart/bar_chart.ts | Attribution header URL update |
| src/widgets/chart/chart.ts | Attribution header URL update |
| src/widgets/chart/grid_axis.ts | Attribution header URL update |
| src/widgets/chart/grid_cartesian.ts | Attribution header URL update |
| src/widgets/chart/grid_radial.ts | Attribution header URL update |
| src/widgets/chart/legend.ts | Attribution header URL update |
| src/widgets/chart/line_chart.ts | Attribution header URL update |
| src/widgets/chart/pie_chart.ts | Attribution header URL update |
| src/widgets/chart/point_chart.ts | Attribution header URL update |
| src/widgets/clip.ts | Attribution header URL update |
| src/widgets/container.ts | Attribution header URL update |
| src/widgets/content.ts | Adds Watermark + Footer widgets |
| src/widgets/decoration.ts | Attribution header URL update |
| src/widgets/directionality.ts | Adds Directionality widget |
| src/widgets/document.ts | Adds optional outline anchor override |
| src/widgets/flex.ts | Adds ListView widget |
| src/widgets/font.ts | Attribution header URL update |
| src/widgets/forms.ts | Attribution header URL update |
| src/widgets/geometry.ts | Attribution header URL update |
| src/widgets/grid_paper.ts | Adds GridPaper widget + presets |
| src/widgets/grid_view.ts | Attribution header URL update |
| src/widgets/icon.ts | Attribution header URL update |
| src/widgets/image.ts | Adds SVG path-data Shape widget |
| src/widgets/image_provider.ts | Attribution header URL update |
| src/widgets/multi_page.ts | Adds NewPage widget + handling |
| src/widgets/page.ts | Attribution header URL update |
| src/widgets/page_theme.ts | Attribution header URL update |
| src/widgets/partitions.ts | Attribution header URL update |
| src/widgets/placeholders.ts | Attribution header URL update |
| src/widgets/progress.ts | Attribution header URL update |
| src/widgets/shape.ts | Adds shape widgets (Circle, Rectangle, Polygon, InkList) |
| src/widgets/stack.ts | Attribution header URL update |
| src/widgets/svg.ts | Attribution header URL update |
| src/widgets/table.ts | Attribution header URL update |
| src/widgets/table_helper.ts | Attribution header URL update |
| src/widgets/text.ts | Adds directionality-aware layout defaults |
| src/widgets/text_style.ts | Attribution header URL update |
| src/widgets/theme.ts | Attribution header URL update |
| src/widgets/wrap.ts | Attribution header URL update |
| src/widgets/widget.ts | Adds Inherited, InheritedWidget, DelayedWidget, Inseparable, context fields |
| test/dist.test.mjs | Uses exported Rollup banner + improves // detection |
| test/widgets_phase_5_7.test.mjs | Adds focused tests for new 5.7 widgets |
| tools/check-source.mjs | Updates required header lines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+232
to
+238
| if (this.points.length < 3) return; | ||
| context.canvas.saveContext(); | ||
| const first = this.points[0]!; | ||
| context.canvas.moveTo(box.x + first.x, context.canvas.toPdfY(box.y + first.y)); | ||
| for (const point of this.points) { | ||
| context.canvas.lineTo(box.x + point.x, context.canvas.toPdfY(box.y + point.y)); | ||
| } |
Comment on lines
+257
to
+262
| constructor({ points, strokeColor = null, strokeWidth = 1 }: InkListOptions) { | ||
| super(); | ||
| this.points = points; | ||
| this.strokeColor = strokeColor; | ||
| this.strokeWidth = Number(strokeWidth); | ||
| } |
Comment on lines
+115
to
+120
| this.horizontalOffset = Math.trunc(horizontalOffset); | ||
| this.verticalOffset = Math.trunc(verticalOffset); | ||
| this.border = border; | ||
| this.scale = Number(scale); | ||
| this.opacity = Number(opacity); | ||
| this.child = child; |
Comment on lines
+52
to
+55
| constructor({ freeSpace = null }: NewPageOptions = {}) { | ||
| super(); | ||
| this.freeSpace = freeSpace === null ? null : Number(freeSpace); | ||
| } |
Comment on lines
+208
to
+214
| this.color = color === null ? null : normalizeColor(color); | ||
| this.interiorColor = interiorColor === null ? null : normalizeColor(interiorColor); | ||
| this.borderWidth = Number(border?.width ?? 1); | ||
| this.author = author; | ||
| this.date = date; | ||
| this.subject = subject; | ||
| this.content = content; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
widgets-phase-5.7.mjsshowcasing new widgets including shapes, annotations, and layout features.DirectionalityandGridPaperwidgets insrc/widgetsfor text directionality and grid layouts.widgets_phase_5_7.test.mjsto ensure functionality and correctness.