Problem
Native compilation currently prefers target-specific primitives ahead of some conventional app/plugin component directories. The same component name can therefore select different source files by target, masking portability gaps.
The intended architecture is one STX component model and reusable component source, with platform-specific rendering owned by the host.
Audited at v0.2.546, commit 0013ce66e3.
Evidence
compileScreenSource configures _targetComponentDirs with nativePrimitivesDir(). Its documented precedence is explicit screen components, then native primitives, then conventional app/plugin components.
Tests currently intentionally assert native primitive selection for overlapping names such as Checkbox. Meanwhile, explicitly compiling the shared-library implementations exposed setup failures and wrong control translation.
This does not mean every component is substituted: explicit screen-local components already override primitives.
Requested change
Converge public component behavior and resolution toward shared implementations after their native compatibility is established. Preserve legitimate low-level host primitives and documented overrides. Avoid changing precedence globally before the shared replacements work.
Acceptance
- Define and document resolution precedence and compatibility behavior.
- Tests prove which source file is selected for shared component names on each target.
- A cross-target suite explicitly loads the same shared component files.
- Cover reactive props, emitted events/models, conditional lifecycle, controls, and teardown.
- Existing screen-local overrides remain supported.
- Migrate overlapping names in verified batches without breaking native screens.
Priority
Sixth in the portability audit sequence, gated by the earlier behavior and translation fixes. Build the same-source test coverage alongside those fixes; change resolution only when the affected shared components pass. Existing baseline: 360 native tests and 58 selected browser/component tests passed, despite failures in additional shared-component probes.
Related audit issues
- fix(native): make shared component reactive props and emitted events host-independent: https://github.com/stacksjs/stx/issues/2086
- fix(native): preserve interactive label children and translate input types correctly: https://github.com/stacksjs/stx/issues/2087
- feat(native): make shared Form submission, values, and validation portable: https://github.com/stacksjs/stx/issues/2088
- feat(native): adapt shared overlays, tabs, and tooltips to host capabilities: https://github.com/stacksjs/stx/issues/2089
- feat(native): support shared component design tokens and essential layout utilities: https://github.com/stacksjs/stx/issues/2090