|
5 | 5 | * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT |
6 | 6 | */ |
7 | 7 |
|
8 | | -import { |
9 | | - AriaAttrNameToPropNameMap, |
10 | | - create, |
11 | | - entries, |
12 | | - htmlPropertyToAttribute, |
13 | | - isAriaAttribute, |
14 | | - isNull, |
15 | | - keys, |
16 | | - REFLECTIVE_GLOBAL_PROPERTY_SET, |
17 | | - toString, |
18 | | -} from '@lwc/shared'; |
| 8 | +import { AriaAttrNameToPropNameMap, entries, isNull, toString } from '@lwc/shared'; |
19 | 9 |
|
20 | 10 | import type { LightningElement } from './lightning-element'; |
21 | 11 |
|
22 | | -/** |
23 | | - * Filters out the following types of properties that should not be set. |
24 | | - * - Properties that are not public. |
25 | | - * - Properties that are not global. |
26 | | - * - Properties that are global but are internally overridden. |
27 | | - */ |
28 | | -export function filterProperties( |
29 | | - props: Record<string, unknown>, |
30 | | - publicFields: Set<string>, |
31 | | - privateFields: Set<string> |
32 | | -): Record<string, unknown> { |
33 | | - const propsToAssign = create(null); |
34 | | - for (const propName of keys(props)) { |
35 | | - const attrName = htmlPropertyToAttribute(propName); |
36 | | - if ( |
37 | | - publicFields.has(propName) || |
38 | | - ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) && |
39 | | - !privateFields.has(propName)) |
40 | | - ) { |
41 | | - propsToAssign[propName] = props[propName]; |
42 | | - } |
43 | | - } |
44 | | - return propsToAssign; |
45 | | -} |
46 | | - |
47 | 12 | /** |
48 | 13 | * Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`. |
49 | 14 | */ |
|
0 commit comments