portakal_core 1.2.1
portakal_core: ^1.2.1 copied to clipboard
Universal printer language SDK — Pure-Dart protocol engine for TSC, ZPL, EPL, ESC/POS, CPCL, DPL, IPL, SBPL, Star PRNT.
1.2.1 #
Documentation & Attribution #
- Added credit and acknowledgments to productdevbook/portakal for the foundational TypeScript printer SDK architecture.
- Refined package documentation and cross-references.
1.2.0 #
Portakal 1.2 introduces Hybrid Layout DX: sequential document-style authoring, semantic horizontal rows, tables, dividers, stream receipt formatting, and type-safe barcode configuration while preserving full backward compatibility with exact-canvas coordinate layout.
Added #
- Sequential Document Authoring: Added top-level
sequentialLabel(config, {margin, lineAdvance})entry point for document-style vertical layout with automatic vertical progression. - Semantic Rows: Added
row(left, right)for familiar 3:1 left/right pairs androwCells([LabelCell, ...])for custom fixed and flex horizontal composition. - Structured Tables: Added
builder.table(columns: [...])returningLabelTablefor repeated row generation sharing the parent builder's sequential document state. - Semantic Dividers & Spacing: Added
divider({thickness, advance, margin})emittingDividerElementandspace(amount)advancing vertical state without emitting an AST node. - Universal AST Elements: Added
RowElement,RowCellElement,DividerElement,LabelCell,LabelColumn,LabelTextAlign, andLabelTextStyle. - Stream Row Formatter: Added
StreamRowFormatterloweringRowElementandDividerElementinto formatted monospaced character lines for ESC/POS and Star PRNT with unstyled padding separation. - Stream Compiler Override: Added optional
charsPerLineparameter tocompileToESCPOS,compileToESCPOSBytes,compileToStarPRNT, andcompileToStarPRNTBytes. - Type-Safe Barcodes: Added
enum BarcodeSymbology { code128, code39 }andBarcodeOptions.typed(...)factory constructor lowering directly into canonical string identifiers. - PreviewScene Lowering: Added full visual SVG layout for
RowElementand vector lines forDividerElement. - AST-Based API Snapshot Tool: Upgraded
tool/generate_api_snapshot.dartto a structural Dart AST analyzer capturing complete signatures, parameter types, default values, and export filters.
Improved #
- Developer Experience: Drastically reduced manual Y coordinate bookkeeping in receipt, ticket, and invoice layouts.
- Example Gallery: Migrated restaurant receipts, kitchen tickets, queue slips, and commercial invoices to sequential document authoring and type-safe barcodes.
Fixed #
- IPL Code 128 Lowering: Corrected Intermec IPL barcode lowering where Code 128 previously emitted format selector
c0(Code 39). Now emits authenticc6for Code 128 andc0for Code 39. UpdatedIplBarcodeType.code128from0to6.
Compatibility #
- 100% Source-Compatible:
label(config)retains existing exact-canvas API and legacy coordinate semantics without sequential advancement. - No Unintended Legacy Byte Regressions: All 8 other protocol compilers and exact-coordinate layouts produce byte-for-byte identical streams.
- Non-Breaking Barcode API:
const BarcodeOptions(type: String, ...)remains non-deprecated and fully functional as an escape hatch for custom or printer-specific symbologies (e.g.type: 'EAN13'). - Exact Coordinate Escape Hatch: Inside a
sequentialLabel, providingxoryon an element places it at exact coordinates without advancing sequential document state. - Intentional IPL Byte Change: IPL Code 128 output changes from
c0(incorrect Code 39 selector) toc6(authentic Code 128 selector) to fix symbology encoding on Intermec hardware.
Known Limitations #
- Visual Alignment Across Hardware: Alignment fidelity varies across target printer firmware. PreviewScene and ZPL support native bounded alignment; ESC/POS and Star PRNT use space-padded character grids; other label protocols anchor at cell start coordinates.
- Stream Unicode Glyphs: Monospaced stream character-grid allocation does not guarantee visual glyph width for complex scripts (Khmer, CJK, emoji) where printer firmware font shaping governs physical output.
- Typed Barcode Scope:
BarcodeSymbologyis intentionally constrained tocode128andcode39where authentic semantic identity is guaranteed across all 9 supported compilers.
1.1.0 #
Added #
- Preview-Before-Print Architecture: Added
compileResolved(ResolvedLabel job)across all 9 protocol facades (tsc,zpl,epl,escpos,cpcl,dpl,ipl,sbpl,starprnt) enabling applications to resolve once, review the preview, and compile the exact same resolved job for printing. - Canonical Preview Intermediate Model (
PreviewScene): Platform-agnostic geometric scene representation shared between pure Dart SVG rendering (renderPreviewScene) and Flutter UI widgets. - Standards-Conforming 1D Barcode Preview: Deterministic visual pattern rendering for Code 128 (Set B), Code 39, EAN-13, EAN-8, and UPC-A barcodes with quiet zones and human-readable text.
- Standards-Conforming 2D QR Code Preview: Deterministic QR Code matrix generation supporting Versions 1–10 in Byte (UTF-8) mode with configurable ECC levels (L, M, Q, H), ISO/IEC 18004 4-module quiet zones, and automatic version selection.
- Run-Length Bitmap Span Optimization (
PreviewBitmapSpan): Lossless horizontal black-pixel run compression for 1-bit monochrome graphics rendering. - Canvas Clipping & Transform Support: Logical bounding box clipping, multiline
<tspan>text layout, and unconstrainedxScale/yScaleorigin scaling.
Changed #
- Refactored
renderPreviewto construct and evaluate canonicalPreviewSceneintermediate models. - Enhanced
PreviewScenewith structural value equality (operator ==andhashCode) for repaint skipping.
1.0.0 #
Stable production release of the Portakal Core SDK.
Added #
- Standardized canonical byte-native
.compile()API returning authoritativeUint8Listacross all 9 protocol facades (tsc,zpl,epl,escpos,cpcl,dpl,ipl,sbpl,star). - Added
LabelBuilder.print([int copies = 1])with eager positive integer validation. - Added typed
LabelBuilder.rawBytes(Uint8List)andLabelBuilder.rawAscii(String)with ASCII code point validation and defensive copying. - Added
UnsupportedFeaturePolicy(throwError,ignore) for compiler-level unsupported feature governance. - Added structured error hierarchy with
PortakalError,UnsupportedFeatureError,EncodingError,UnsupportedCharacterException,InvalidConfigError, andCompilationError. - Added canonical
ReceiptColumntable column definition. - Added 9 protocol-native fluent builders with non-destructive
.toBytes()snapshots and.reset(). - Added pure Dart SVG preview engine (
renderPreview).
Changed #
- Standardized all protocol serializers and command writers on direct byte construction.
- Decoupled
portakal_coreinto an independent pure-Dart package with zero Flutter/UI dependencies. - Updated Dart SDK minimum environment constraint to
^3.6.0.
Deprecated #
- Deprecated
typedef Column = ReceiptColumnin favor ofReceiptColumn(removal in 2.0). - Deprecated
compileBytesmethod on language facades in favor of canonical.compile()(removal in 2.0). - Deprecated legacy String serializers
compileToTSC,compileToZPL,compileToEPL,compileToCPCL,compileToDPL,compileToIPL, andcompileToSBPL(removal in 2.0). - Deprecated untyped
RawElement({required Object content})andlabel.raw(Object)in favor ofrawBytes/rawAscii(removal in 2.0). - Deprecated legacy
encodeTextForPrinterhelper in favor ofgetEncoder(PrinterCodePage)(removal in 2.0).
Hardware Validation #
- Physical hardware validation on
Printer001-328F: ESC/POS verified subset (PASS), TSC/TSPL2 verified subset (PASS), ZPL II emulation (N/S-DEVICE). - Byte-level golden SHA-256 validation suite for all 9 protocol compilers.
1.0.0-rc.1 #
- Release candidate for 1.0.0 contract freeze and external pub.dev validation.
0.3.0 #
- Initial standalone release of
portakal_coreas a pure Dart package extracted fromportakal_flutter. - Zero Flutter/UI dependencies.
- 9 protocol-native builders (TSC, ESC/POS, ZPL, EPL, CPCL, DPL, IPL, SBPL, Star PRNT).
- Universal AST builder, 9 protocol compilers, 9 parsers.
- Character encoding subsystem for CP437, CP858, CP850, CP1252, CP866, CP857.
- Bitmap and dithering engine.
- Printer profiles database and query functions.
- Pure Dart SVG preview generator (
renderPreview).