Problem
collectPublicProps is implemented twice with subtly different semantics:
| Location |
Access method |
packages/element/src/define-element.ts:11 |
host[key] (direct property access) |
packages/app/src/authoring.ts:226 |
Reflect.get(host, key) (safer, respects getters) |
Both filter __openElement-prefixed keys. The Reflect.get version is strictly more correct (handles inherited getters without throwing), but the divergence is a maintenance trap.
Fix
Unify to a single implementation exported from @openelement/element internal utils:
// packages/element/src/internal/core/props-utils.ts
export function collectPublicProps(host: object): Record<string, unknown> {
const props: Record<string, unknown> = {};
for (const key of Object.keys(host)) {
if (key.startsWith('__openElement')) continue;
props[key] = Reflect.get(host, key);
}
return props;
}
Both define-element.ts and app/authoring.ts import from this single source.
Acceptance
Problem
collectPublicPropsis implemented twice with subtly different semantics:packages/element/src/define-element.ts:11host[key](direct property access)packages/app/src/authoring.ts:226Reflect.get(host, key)(safer, respects getters)Both filter
__openElement-prefixed keys. TheReflect.getversion is strictly more correct (handles inherited getters without throwing), but the divergence is a maintenance trap.Fix
Unify to a single implementation exported from
@openelement/elementinternal utils:Both
define-element.tsandapp/authoring.tsimport from this single source.Acceptance