[POS] Add s-pos-list and the posListTemplate compiler (2026-10) - #4690
Draft
ajanth-u wants to merge 1 commit into
Draft
[POS] Add s-pos-list and the posListTemplate compiler (2026-10)#4690ajanth-u wants to merge 1 commit into
ajanth-u wants to merge 1 commit into
Conversation
`<s-pos-list>` renders a virtualized list whose rows are plain data
(`rows`) and whose markup comes from item templates (`itemTemplates`)
compiled in the extension bundle by the `posListTemplate` tagged template.
POS hydrates one template copy per mounted row, so lists of thousands of
rows stay responsive and no extension code runs while scrolling.
Templates are static `<s-pos-list-item templateId="…" type="button|text">`
roots. Inside them `{{path}}` interpolates a row field as text,
`bind:prop="path"` passes a row field to a component prop with its own
type, and `{{#if path}}…{{/if}}` renders its content when the field is
truthy. Event handlers, interpolated values, nested `#if`, `#each`, text
directly under the root, and any other `{{…}}` expression are rejected at
compile time with a `posListTemplate:` prefixed error.
The component types are generated from POS Mobile's `meta.ts` and merged
into `components.d.ts`; `POSList` joins `StandardComponents`; the POS docs
data for 2026-10 is regenerated. `htm` (already a transitive dependency of
several surfaces) becomes a direct dependency for the parser.
Assisted-By: devx/058a962b-6514-4c8e-a49e-37b8e478fe36
Collaborator
Author
|
/snapit |
Contributor
|
🫰✨ Thanks @ajanth-u! Your snapshots have been published to npm. Test the snapshots by updating your "@shopify/ui-extensions": "0.0.0-snapshot-20260912150820",
"@shopify/ui-extensions-tester": "0.0.0-snapshot-20260912150820" |
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.
What
Adds
<s-pos-list>for POS API version 2026-10 and theposListTemplatetagged template that compiles its row markup. This is the templated candidate for GSD #51755; the legacy-parity alternative is #4661 (unmodified, held as contingency). Exactly one of the two should merge.Companion PRs: World #2061117 (ui-api-design contract), #2061112 → #2061124 → #2061132 (pos-mobile host stack), Shopify/pos-e2e-ui-extension (sandbox screen, follows), World shopify-dev docs (follows).
Design
rowsis plain data ({id, templateFor, ...fields}) anditemTemplatesis a compiled AST produced once in the extension bundle byposListTemplate:POS hydrates one template copy per FlashList-mounted row, so no extension code runs while scrolling and no functions cross the bridge (no Shopify/extensibility change needed).
Grammar:
{{path}}in text;{{path}}inside an attribute (always a string);bind:prop="path"(the only typed binding);{{#if path}}…{{/if}}(no nesting, no else). Rejected at compile time withposListTemplate:-prefixed errors:on*attributes,${}interpolation of any kind,#each/other expressions, nested/unbalanced#if,#ifinside an attribute, text directly under<s-pos-list-item>, non-item roots, nesteds-pos-list-item/s-pos-list, missing/duplicatetemplateId, unknowntype, any other root attribute.Changes
src/surfaces/point-of-sale/pos-list-template.ts— the compiler (htm-based;htmbecomes a direct dependency).src/surfaces/point-of-sale.ts— exportsposListTemplateplusPOSListTemplateTag,POSListTemplates,POSListItemTemplate,POSListTemplateNode,POSListTemplateProp,POSListTemplateSegment,POSListRow,POSListRowClickEvent.components/POSList.d.ts(generated from pos-mobilemeta.tsviapnpm build-extension-components:publish 2026-10) and the POSList blocks merged intocomponents.d.ts. Only POSList additions are included; the pre-existing drift between the generator output and this repo'scomponents.d.ts/components-shared.d.tsis left alone.components/targets/StandardComponents.ts—| 'POSList'.components/POSList/examples/{default,incremental-loading}.jsx.docs/.../2026-10/{generated_docs_data_v2.json,targets.json}regenerated withbuild-docs.mjs 2026-10..changeset/pos-list-template-component.md(minor).Verification
yarn build,yarn type-checkgreen;build/esm/surfaces/point-of-sale.mjsexportsposListTemplate.loom test packages/ui-extensions/src/surfaces/point-of-sale/tests/pos-list-template— 16 tests: exact AST output for text placeholders,{{#if}}blocks,bind:, attribute segments, valueless attributes,type="text"; and every rejection above with its literal message.