Skip to content

feat(filaments): add label printing support for filaments#91

Draft
akira69 wants to merge 16 commits into
Fire-Devils:develfrom
akira69:feat/filament-print-page
Draft

feat(filaments): add label printing support for filaments#91
akira69 wants to merge 16 commits into
Fire-Devils:develfrom
akira69:feat/filament-print-page

Conversation

@akira69

@akira69 akira69 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds filament label printing alongside the existing spool label workflow.

Compared to devel, this PR adds single and batch filament print pages, reuses and hardens shared label rendering/export helpers, and keeps the standard print UI intentionally compact while giving Label Designer access to the full token set.

Dependency / Merge Order

#93 and #94 are now merged into devel, and this branch has been rebased onto that updated base.

The follow-up label-paper sheet printing PR #95 is expected to stack after this PR.

What Changed

  • Added /filaments/{id}/print and /filaments/print?ids=... with standard print settings and Label Designer tabs.
  • Added filament detail/list entry points: single Print Label and bulk Print Labels.
  • Split reusable label helpers for standard labels, designer rendering, export, QR handling, and print-page data mapping.
  • Consolidated repeated standard Print Settings markup into StandardLabelSettingsPanel, with source comments noting the reduced standard UI is intentional.
  • Consolidated duplicate batch print-page CSS into BatchLabelPrintStyles.
  • Reused duplicate embedded label images in PDF export where possible to reduce file size while keeping 600 DPI captures.
  • Expanded Label Designer tokens: filament pages expose filament fields; spool pages expose spool fields plus filament fields.
  • Added entity-specific designer preset/settings storage for spool vs filament labels, including cross-type read-only preset loading.
  • Preserved a reduced standard Print Settings interface by design; advanced Label Designer remains the full-field interface.
  • Added the standard-label Color Hex checkbox.
  • Seeded spool/filament designer defaults and kept legacy template aliases renderable without advertising them as new defaults.

Validation

  • npm run lint passes with existing warnings.
  • npm run check passes with existing project hints.
  • npm run build passes.
  • Local testing covered filament/spool print pages, tab switching, seeded designer defaults, token rendering, standard color-hex toggle, QR/export plumbing, and the running app on 127.0.0.1:4322.

@akira69 akira69 marked this pull request as draft June 11, 2026 02:34
@akira69 akira69 changed the base branch from main to devel June 11, 2026 02:57
@akira69 akira69 force-pushed the feat/filament-print-page branch from e2de21a to 9a489fb Compare June 11, 2026 04:38
@akira69 akira69 changed the title feat(filaments): add single and batch label print pages feat(filaments): add label printing support for filaments Jun 11, 2026
@akira69

akira69 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Representative screenshots, export proofs, and test checklist

Screenshots from local E2E validation on the built instance at http://127.0.0.1:4322/.

Manufacturer/logo data was prepared through the app's FilamentDB prepare flow; Bambu Lab resolved locally as manufacturer ID 1, and both /api/v1/manufacturers/1/logo and /api/v1/manufacturers/1/label-logo returned image/png.

Export capture paths are verified at print-grade 600 DPI (600 / 96 CSS pixel ratio). The PNG proofs below are 1182x709 px for the rendered 50x30 mm designer label.

Filament Label Designer default

Filament Label Designer default

Filament standard print settings with Color Hex

Filament standard print settings with Color Hex

Spool Label Designer default

Spool Label Designer default

Spool standard print settings with Color Hex

Spool standard print settings with Color Hex

Export proofs

Filament rendered label PNG proof:

Filament export PNG proof

Filament rendered label PDF proof:

filament-export-proof.pdf

Spool rendered label PNG proof:

Spool export PNG proof

Spool rendered label PDF proof:

spool-export-proof.pdf

Test checklist

  • Used the built instance on 127.0.0.1:4322.
  • Synced/prepared manufacturer logo data through the FilamentDB prepare path.
  • Verified local manufacturer logo and label-logo endpoints return image/png.
  • Verified spool standard Print Settings stays intentionally reduced and includes the Color Hex checkbox.
  • Verified spool Label Designer default renders with synced manufacturer branding.
  • Verified spool Label Designer exposes spool tokens plus filament tokens.
  • Verified filament standard Print Settings stays intentionally reduced and includes the Color Hex checkbox.
  • Verified filament Label Designer default renders with synced manufacturer branding and keeps the token picker scoped to filament data.
  • Verified all label export capture paths use the shared 600 DPI export ratio.
  • Verified designer QR codes and standard-label QR codes are generated at print DPI before export.
  • Captured high-resolution rendered label PNG proofs for filament and spool.
  • Captured rendered label PDF proofs for filament and spool.
  • Ran npm run lint with 0 errors and existing warnings only.
  • Ran npm run check with 0 errors and existing warnings/hints only.
  • Ran npm run build successfully.

akira69 added 14 commits June 19, 2026 19:27
… designer

- Add filaments/[id]/print.astro: single-filament label print page
  mirroring spools/[id]/print.astro with filament-specific defaults
  (height=25mm, qrSize=15mm), storage keys, and API mapping
- Add filaments/print.astro: batch filament label print page
  mirroring spools/print.astro with filament API + filament extra fields
- Add Print Label button to filaments/[id]/index.astro (builds URL params
  from filament API data + stores extra fields in sessionStorage)
- Add Print Labels bulk action to filaments/index.astro (bulk-action-bar)
- Add i18n keys: filaments.backToFilament, filaments.showFilamentId,
  filaments.printLabel, filaments.bulkLabel (en + de)
Add optional qrUrl field to StandardLabelData so filament print pages
can specify the correct entity URL for QR codes.
… fields on print pages

- Detail page writes standard fields (extruder_temp, bed_temp, diameter,
  density, weight, finish, price) plus system custom fields to
  filaman-filament-label-extra-fields sessionStorage before navigating
  to the print page, so no extra API fetch is needed

- Single print page fallback (direct navigation): now also shows standard
  filament fields as selectable checkboxes alongside system custom fields;
  parallelizes the two API fetches; no longer early-returns when there are
  no system custom fields

- Batch print page: always shows standard filament fields as selectable
  extra fields (Extruder Temp, Bed Temp, Diameter, Density, Weight,
  Finish, Price) in addition to system-defined custom fields
…designer

Add optional presetsKey to LabelDesignerEditorOptions so each entity type
can use its own preset store. Filament print pages now use
'filaman-filament-label-presets-v1'; spool pages continue using the
default 'filaman-label-presets-v1'. Presets named 'Default' are seeded
separately in each store.
…erEditor

Remove the optional default. Every caller must now explicitly declare
which preset namespace it owns:
  spools/[id]/print     → filaman-spool-label-presets-v1
  spools/print          → filaman-spool-label-presets-v1
  filaments/[id]/print  → filaman-filament-label-presets-v1
  filaments/print       → filaman-filament-label-presets-v1

This makes future entity types impossible to accidentally share presets.
On first use of a spool print page after upgrade, presets stored under
'filaman-label-presets-v1' (the old shared key) are moved to
'filaman-spool-label-presets-v1' and the old key is deleted.

Migration only runs when the effective key is the spool key and the
destination is empty, so it is idempotent and only fires once.
- Entity-locked QR URLs in designer: spool pages encode /spools/{id},
  filament pages encode /filaments/{id}
- Cross-type preset sharing with <optgroup> divider; filament pages show
  spool presets section and vice versa; cross-type presets are read-only
- Entity-specific labels throughout the designer UI: token group header,
  empty extra-fields state, QR pill label, section titles
- Non-system filament custom fields now included in print page sessionStorage
- Filament label defaults match spool defaults (height 40mm, QR 18mm)
- Token area Extra Fields group label uses entity-specific i18n key
- LabelDesignerSettings.info gains marginMm field (default 0)
- Margin is applied as marginTop on the main info/QR row, providing
  vertical spacing between the title blocks and the info area
- Range+number input added to LabelDesignerEditor.astro below the
  text-size row, matching the existing title gap control style
- Editor wired in FIELD_IDS, SLIDER_PAIRS, read/apply/reset/localize
- Preset save/load and reset-section button all handle the new field
Old localStorage (v<2) had height=25mm and QR=15mm from early development.
Adds SETTINGS_VERSION=2; on load, any saved settings without _v>=2 are
discarded so the correct defaults (60x40mm, QR=18mm) take effect.
…overage

- Split DESIGNER_TOKENS into FILAMENT_TOKENS (all pages) + SPOOL_TOKENS (spool
  pages only), adding 5 new filament fields and 13 spool model fields
- Add entityType option to LabelDesignerEditorOptions; spool pages show a
  dedicated 'Spool' token group (lot_number, external_id, rfid_uid, location,
  status, purchase_date, purchase_price, remaining/initial/empty weights,
  stocked_in_at, last_used_at); filament pages omit it
- Extend SpoolData interface and DesignerFlatLabelData with all new fields
- Wire spool model fields through buildSpoolDataFromFlatLabel and
  buildSpoolDataFromApiSpool so tokens resolve correctly at render time
- spool/[id]/index.astro: include all spool model fields in printUrl params
  and efForPrint (so they appear as standard-label checkboxes too)
- spool/[id]/print.astro, filament/[id]/print.astro: read new URL params
- filament pages: add subtype, manufacturer_color_name, default_spool_weight_g,
  spool_outer_diameter_mm, spool_width_mm, spool_material to URL params
- spools/print.astro (batch): add Spool Fields checkbox section for model-level
  fields in the standard label sidebar
- Fix pre-existing TS error: info preset default was missing marginMm
@akira69 akira69 force-pushed the feat/filament-print-page branch from 36ec9a5 to f3506e6 Compare June 19, 2026 23:30
@akira69 akira69 force-pushed the feat/filament-print-page branch from f3506e6 to 5683585 Compare June 19, 2026 23:48
@akira69 akira69 force-pushed the feat/filament-print-page branch from 5683585 to 4a4cacc Compare June 20, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant