@ng-native/components 0.2.0 → 0.4.0

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.
Files changed (67) hide show
  1. package/dist/content-container.d.ts +25 -0
  2. package/dist/content-container.js +35 -0
  3. package/dist/content-container.js.map +1 -0
  4. package/dist/gestures-web.d.ts +12 -0
  5. package/dist/gestures-web.js +32 -0
  6. package/dist/gestures-web.js.map +1 -0
  7. package/dist/gestures.d.ts +0 -1
  8. package/dist/gestures.js +5 -4
  9. package/dist/gestures.js.map +1 -1
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js.map +1 -1
  12. package/dist/keyboard-avoiding-view.d.ts +6 -1
  13. package/dist/keyboard-avoiding-view.js +23 -6
  14. package/dist/keyboard-avoiding-view.js.map +1 -1
  15. package/dist/pressable.d.ts +56 -4
  16. package/dist/pressable.js +80 -7
  17. package/dist/pressable.js.map +1 -1
  18. package/dist/reanimated-web.d.ts +18 -0
  19. package/dist/reanimated-web.js +59 -0
  20. package/dist/reanimated-web.js.map +1 -0
  21. package/dist/reanimated.d.ts +4 -4
  22. package/dist/reanimated.js +3 -3
  23. package/dist/reanimated.js.map +1 -1
  24. package/dist/refresh-control.d.ts +4 -1
  25. package/dist/refresh-control.js +4 -1
  26. package/dist/refresh-control.js.map +1 -1
  27. package/dist/scroll-view.d.ts +17 -1
  28. package/dist/scroll-view.js +59 -6
  29. package/dist/scroll-view.js.map +1 -1
  30. package/dist/section-list.d.ts +14 -2
  31. package/dist/section-list.js +20 -4
  32. package/dist/section-list.js.map +1 -1
  33. package/dist/stand-ins/gesture-handler.d.ts +40 -0
  34. package/dist/stand-ins/gesture-handler.js +43 -0
  35. package/dist/stand-ins/gesture-handler.js.map +1 -0
  36. package/dist/stand-ins/reanimated.d.ts +62 -0
  37. package/dist/stand-ins/reanimated.js +95 -0
  38. package/dist/stand-ins/reanimated.js.map +1 -0
  39. package/dist/stand-ins/worklets.d.ts +11 -0
  40. package/dist/stand-ins/worklets.js +24 -0
  41. package/dist/stand-ins/worklets.js.map +1 -0
  42. package/dist/sticky-headers.d.ts +6 -0
  43. package/dist/sticky-headers.js +7 -2
  44. package/dist/sticky-headers.js.map +1 -1
  45. package/dist/switch.d.ts +11 -1
  46. package/dist/switch.js +16 -3
  47. package/dist/switch.js.map +1 -1
  48. package/dist/text.d.ts +11 -2
  49. package/dist/text.js +15 -1
  50. package/dist/text.js.map +1 -1
  51. package/dist/touchable-opacity.d.ts +2 -1
  52. package/dist/touchable-opacity.js +3 -0
  53. package/dist/touchable-opacity.js.map +1 -1
  54. package/dist/view-base.d.ts +36 -21
  55. package/dist/view-base.js +91 -23
  56. package/dist/view-base.js.map +1 -1
  57. package/dist/virtual-list.d.ts +52 -7
  58. package/dist/virtual-list.js +132 -44
  59. package/dist/virtual-list.js.map +1 -1
  60. package/dist/worklets.d.ts +11 -0
  61. package/dist/worklets.js.map +1 -1
  62. package/dist/written-props.js +1 -0
  63. package/dist/written-props.js.map +1 -1
  64. package/dist/zero-size-warning.d.ts +30 -0
  65. package/dist/zero-size-warning.js +58 -0
  66. package/dist/zero-size-warning.js.map +1 -0
  67. package/package.json +19 -4
@@ -0,0 +1,58 @@
1
+ /**
2
+ * In development, says once when a scrolling element with content stays at zero size along its
3
+ * axis: the usual sign of a component host without `flex: 1`, which renders nothing and says
4
+ * nothing. A second's grace, so a container that is collapsed or animating open is not reported.
5
+ */
6
+ export class ZeroSizeWarning {
7
+ timer;
8
+ warned = false;
9
+ element;
10
+ horizontal;
11
+ /**
12
+ * `element` names the element as written: `<scroll-view class="feed">`. `horizontal` says
13
+ * whether it scrolls along x, so its size is a width.
14
+ */
15
+ constructor(element, horizontal) {
16
+ this.element = element;
17
+ this.horizontal = horizontal;
18
+ }
19
+ /**
20
+ * A layout, or new content: its size along the scroll axis, and whether there is anything to
21
+ * show. Still zero with content keeps the deadline already running rather than starting over.
22
+ */
23
+ laidOut(size, hasContent) {
24
+ if (this.warned)
25
+ return;
26
+ if (size > 0 || !hasContent) {
27
+ clearTimeout(this.timer);
28
+ this.timer = undefined;
29
+ }
30
+ else {
31
+ this.timer ??= setTimeout(() => this.warn(), 1000);
32
+ }
33
+ }
34
+ stop() {
35
+ clearTimeout(this.timer);
36
+ }
37
+ warn() {
38
+ this.warned = true;
39
+ const [size, big] = this.horizontal() ? ['width', 'wide'] : ['height', 'tall'];
40
+ console.warn(`[angular-native] ${this.element()} has content but is laid out at zero ${size}, so it ` +
41
+ `shows nothing. A component's host is a flex item that is as ${big} as its content: give ` +
42
+ `the host, or the element, flex: 1 or a ${size}. See ` +
43
+ `https://ng-native.com/packages/components/layout#a-components-host-is-a-flex-item`);
44
+ }
45
+ }
46
+ /** Whether this is a development build, where the check runs. A release build folds it away. */
47
+ export const checksZeroSize = () => typeof ngDevMode !== 'undefined' && !!ngDevMode;
48
+ /**
49
+ * An element as written in a template, with its classes: `<virtual-list class="feed">`. A node is
50
+ * the engine's on a device, and a DOM element on the web host.
51
+ */
52
+ export function written(node) {
53
+ const { name, localName, classes, classList } = node;
54
+ // An engine node has a `classList` too, for Angular's renderer, but its classes are `classes`.
55
+ const names = [...((classes === undefined ? classList : classes) ?? [])];
56
+ return `<${name ?? localName}${names.length ? ` class="${names.join(' ')}"` : ''}>`;
57
+ }
58
+ //# sourceMappingURL=zero-size-warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero-size-warning.js","sourceRoot":"","sources":["../src/zero-size-warning.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAClB,KAAK,CAA4C;IACjD,MAAM,GAAG,KAAK,CAAC;IAEN,OAAO,CAAe;IACtB,UAAU,CAAgB;IAE3C;;;OAGG;IACH,YAAY,OAAqB,EAAE,UAAyB;QAC1D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,IAAY,EAAE,UAAm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EAAE,CAAC,CAAC,CAAC;IACzE,OAAO,IAAI,IAAI,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;AACtF,CAAC","sourcesContent":["/**\n * In development, says once when a scrolling element with content stays at zero size along its\n * axis: the usual sign of a component host without `flex: 1`, which renders nothing and says\n * nothing. A second's grace, so a container that is collapsed or animating open is not reported.\n */\nexport class ZeroSizeWarning {\n private timer: ReturnType<typeof setTimeout> | undefined;\n private warned = false;\n\n private readonly element: () => string;\n private readonly horizontal: () => boolean;\n\n /**\n * `element` names the element as written: `<scroll-view class=\"feed\">`. `horizontal` says\n * whether it scrolls along x, so its size is a width.\n */\n constructor(element: () => string, horizontal: () => boolean) {\n this.element = element;\n this.horizontal = horizontal;\n }\n\n /**\n * A layout, or new content: its size along the scroll axis, and whether there is anything to\n * show. Still zero with content keeps the deadline already running rather than starting over.\n */\n laidOut(size: number, hasContent: boolean): void {\n if (this.warned) return;\n if (size > 0 || !hasContent) {\n clearTimeout(this.timer);\n this.timer = undefined;\n } else {\n this.timer ??= setTimeout(() => this.warn(), 1000);\n }\n }\n\n stop(): void {\n clearTimeout(this.timer);\n }\n\n private warn(): void {\n this.warned = true;\n const [size, big] = this.horizontal() ? ['width', 'wide'] : ['height', 'tall'];\n console.warn(\n `[angular-native] ${this.element()} has content but is laid out at zero ${size}, so it ` +\n `shows nothing. A component's host is a flex item that is as ${big} as its content: give ` +\n `the host, or the element, flex: 1 or a ${size}. See ` +\n `https://ng-native.com/packages/components/layout#a-components-host-is-a-flex-item`,\n );\n }\n}\n\ndeclare const ngDevMode: unknown;\n\n/** Whether this is a development build, where the check runs. A release build folds it away. */\nexport const checksZeroSize = (): boolean => typeof ngDevMode !== 'undefined' && !!ngDevMode;\n\n/**\n * An element as written in a template, with its classes: `<virtual-list class=\"feed\">`. A node is\n * the engine's on a device, and a DOM element on the web host.\n */\nexport function written(node: unknown): string {\n const { name, localName, classes, classList } = node as {\n name?: string;\n localName?: string;\n classes?: Iterable<string> | null;\n classList?: Iterable<string>;\n };\n // An engine node has a `classList` too, for Angular's renderer, but its classes are `classes`.\n const names = [...((classes === undefined ? classList : classes) ?? [])];\n return `<${name ?? localName}${names.length ? ` class=\"${names.join(' ')}\"` : ''}>`;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/components",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
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",
@@ -27,20 +27,34 @@
27
27
  },
28
28
  "./gestures": {
29
29
  "types": "./dist/gestures.d.ts",
30
+ "browser": "./dist/gestures-web.js",
30
31
  "default": "./dist/gestures.js"
31
32
  },
32
33
  "./reanimated": {
33
34
  "types": "./dist/reanimated.d.ts",
35
+ "browser": "./dist/reanimated-web.js",
34
36
  "default": "./dist/reanimated.js"
35
37
  },
38
+ "./stand-ins/reanimated": {
39
+ "types": "./dist/stand-ins/reanimated.d.ts",
40
+ "default": "./dist/stand-ins/reanimated.js"
41
+ },
42
+ "./stand-ins/worklets": {
43
+ "types": "./dist/stand-ins/worklets.d.ts",
44
+ "default": "./dist/stand-ins/worklets.js"
45
+ },
46
+ "./stand-ins/gesture-handler": {
47
+ "types": "./dist/stand-ins/gesture-handler.d.ts",
48
+ "default": "./dist/stand-ins/gesture-handler.js"
49
+ },
36
50
  "./package.json": "./package.json"
37
51
  },
38
52
  "publishConfig": {
39
53
  "access": "public"
40
54
  },
41
55
  "dependencies": {
42
- "@ng-native/device": "0.2.0",
43
- "@ng-native/fabric": "0.2.0"
56
+ "@ng-native/device": "0.4.0",
57
+ "@ng-native/fabric": "0.4.0"
44
58
  },
45
59
  "peerDependencies": {
46
60
  "@angular/core": "^22.0.0",
@@ -87,7 +101,8 @@
87
101
  "dist"
88
102
  ],
89
103
  "devDependencies": {
90
- "@angular/core": "22.2.0"
104
+ "@angular/core": "22.2.0",
105
+ "@babel/core": "^7.29.7"
91
106
  },
92
107
  "scripts": {
93
108
  "build": "ngc -p tsconfig.build.json",