@ng-native/components 0.22.0 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
+ /** `null` is unset too, as `undefined` is, where `booleanAttribute` makes it false. */
1
2
  export declare function optionalBoolean(value: unknown): boolean | undefined;
3
+ /** `null` is unset too, as the usual way to bind no number, where `numberAttribute` makes it NaN. */
2
4
  export declare function optionalNumber(value: unknown): number | undefined;
3
5
  /**
4
6
  * The transform for a number input with a default: `[delayLongPress]="undefined"` is the default,
@@ -4,15 +4,17 @@
4
4
  * Angular's own `booleanAttribute` turns an absent input into `false`, which is right for a DOM
5
5
  * attribute and wrong for a native prop: `accessible` unset means "the platform decides", and
6
6
  * sending `false` for every boolean a view never mentioned would put a dozen props on every
7
- * node. These keep `undefined` as undefined and otherwise behave as Angular's do, so `<view
7
+ * node. These keep `undefined` and `null` unset and otherwise behave as Angular's do, so `<view
8
8
  * collapsable="false">` and `<view [collapsable]="false">` both mean false.
9
9
  */
10
10
  import { booleanAttribute, numberAttribute } from '@angular/core';
11
+ /** `null` is unset too, as `undefined` is, where `booleanAttribute` makes it false. */
11
12
  export function optionalBoolean(value) {
12
- return value === undefined ? undefined : booleanAttribute(value);
13
+ return value == null ? undefined : booleanAttribute(value);
13
14
  }
15
+ /** `null` is unset too, as the usual way to bind no number, where `numberAttribute` makes it NaN. */
14
16
  export function optionalNumber(value) {
15
- return value === undefined ? undefined : numberAttribute(value);
17
+ return value == null ? undefined : numberAttribute(value);
16
18
  }
17
19
  /**
18
20
  * The transform for a number input with a default: `[delayLongPress]="undefined"` is the default,
@@ -1 +1 @@
1
- {"version":3,"file":"transforms.js","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAElE,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB;IACvC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * Input transforms for props that native reads as \"set\" or \"not set\".\n *\n * Angular's own `booleanAttribute` turns an absent input into `false`, which is right for a DOM\n * attribute and wrong for a native prop: `accessible` unset means \"the platform decides\", and\n * sending `false` for every boolean a view never mentioned would put a dozen props on every\n * node. These keep `undefined` as undefined and otherwise behave as Angular's do, so `<view\n * collapsable=\"false\">` and `<view [collapsable]=\"false\">` both mean false.\n */\nimport { booleanAttribute, numberAttribute } from '@angular/core';\n\nexport function optionalBoolean(value: unknown): boolean | undefined {\n return value === undefined ? undefined : booleanAttribute(value);\n}\n\nexport function optionalNumber(value: unknown): number | undefined {\n return value === undefined ? undefined : numberAttribute(value);\n}\n\n/**\n * The transform for a number input with a default: `[delayLongPress]=\"undefined\"` is the default,\n * as a prop left out is, where `numberAttribute` alone makes it `NaN`. So is anything else that\n * is not a number.\n */\nexport function numberOr(fallback: number): (value: unknown) => number {\n return (value) => numberAttribute(value, fallback);\n}\n"]}
1
+ {"version":3,"file":"transforms.js","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAElE,uFAAuF;AACvF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB;IACvC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * Input transforms for props that native reads as \"set\" or \"not set\".\n *\n * Angular's own `booleanAttribute` turns an absent input into `false`, which is right for a DOM\n * attribute and wrong for a native prop: `accessible` unset means \"the platform decides\", and\n * sending `false` for every boolean a view never mentioned would put a dozen props on every\n * node. These keep `undefined` and `null` unset and otherwise behave as Angular's do, so `<view\n * collapsable=\"false\">` and `<view [collapsable]=\"false\">` both mean false.\n */\nimport { booleanAttribute, numberAttribute } from '@angular/core';\n\n/** `null` is unset too, as `undefined` is, where `booleanAttribute` makes it false. */\nexport function optionalBoolean(value: unknown): boolean | undefined {\n return value == null ? undefined : booleanAttribute(value);\n}\n\n/** `null` is unset too, as the usual way to bind no number, where `numberAttribute` makes it NaN. */\nexport function optionalNumber(value: unknown): number | undefined {\n return value == null ? undefined : numberAttribute(value);\n}\n\n/**\n * The transform for a number input with a default: `[delayLongPress]=\"undefined\"` is the default,\n * as a prop left out is, where `numberAttribute` alone makes it `NaN`. So is anything else that\n * is not a number.\n */\nexport function numberOr(fallback: number): (value: unknown) => number {\n return (value) => numberAttribute(value, fallback);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/components",
3
- "version": "0.22.0",
3
+ "version": "0.22.2",
4
4
  "description": "Angular Native's core components: view, text, image, pressable, scroll-view, virtual-list, text-input and the rest of React Native's set.",
5
5
  "keywords": [
6
6
  "angular",
@@ -61,8 +61,8 @@
61
61
  "access": "public"
62
62
  },
63
63
  "dependencies": {
64
- "@ng-native/device": "0.22.0",
65
- "@ng-native/fabric": "0.22.0"
64
+ "@ng-native/device": "0.22.2",
65
+ "@ng-native/fabric": "0.22.2"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@angular/core": "^22.0.0",