@octane-xplat/nativescript-mason-core 0.0.1 → 1.0.0-beta.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 (187) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +113 -2
  3. package/artifact-inventory.json +746 -0
  4. package/box-shadow.d.ts +10 -0
  5. package/box-shadow.js +48 -0
  6. package/common.d.ts +482 -0
  7. package/common.js +2645 -0
  8. package/css-colors.d.ts +17 -0
  9. package/css-colors.js +54 -0
  10. package/css-filter.d.ts +17 -0
  11. package/css-filter.js +140 -0
  12. package/css-keyframes.d.ts +41 -0
  13. package/css-keyframes.js +437 -0
  14. package/css-math.d.ts +34 -0
  15. package/css-math.js +300 -0
  16. package/css-shorthands.d.ts +65 -0
  17. package/css-shorthands.js +673 -0
  18. package/css-transform.d.ts +6 -0
  19. package/css-transform.js +100 -0
  20. package/diagnostics.d.ts +51 -0
  21. package/diagnostics.js +52 -0
  22. package/display-density.d.ts +9 -0
  23. package/display-density.js +20 -0
  24. package/fonts.d.ts +20 -0
  25. package/fonts.js +88 -0
  26. package/foreign-layout.d.ts +6 -0
  27. package/foreign-layout.js +149 -0
  28. package/gradient-stops.d.ts +25 -0
  29. package/gradient-stops.js +112 -0
  30. package/index.android.d.ts +9 -0
  31. package/index.android.js +8 -0
  32. package/index.d.ts +10 -0
  33. package/index.ios.d.ts +9 -0
  34. package/index.ios.js +8 -0
  35. package/ios-host-README.md +124 -0
  36. package/layout-types.d.ts +192 -0
  37. package/mask.d.ts +54 -0
  38. package/mask.js +26 -0
  39. package/native-types-README.md +51 -0
  40. package/package.json +44 -6
  41. package/panel-helpers.d.ts +3 -0
  42. package/panel-helpers.js +8 -0
  43. package/platforms/android/MasonCore.aar +0 -0
  44. package/platforms/android/include.gradle +6 -0
  45. package/platforms/android/manifest.json +73 -0
  46. package/platforms/ios/FontManager.LICENSE +201 -0
  47. package/platforms/ios/MasonCore.xcframework/Info.plist +43 -0
  48. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/Mason.h +25 -0
  49. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
  50. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/mason_native.h +601 -0
  51. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Info.plist +0 -0
  52. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/MasonCore +0 -0
  53. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  54. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.abi.json +100095 -0
  55. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.private.swiftinterface +3174 -0
  56. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  57. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftinterface +3174 -0
  58. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/module.modulemap +9 -0
  59. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
  60. package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
  61. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/Mason.h +25 -0
  62. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
  63. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/mason_native.h +601 -0
  64. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Info.plist +0 -0
  65. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/MasonCore +0 -0
  66. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  67. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.abi.json +100095 -0
  68. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3174 -0
  69. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  70. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3174 -0
  71. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/module.modulemap +9 -0
  72. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
  73. package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
  74. package/platforms/ios/Package.resolved +24 -0
  75. package/platforms/ios/SDWebImage.LICENSE +20 -0
  76. package/platforms/ios/build.xcconfig +4 -0
  77. package/platforms/ios/device-manifest.json +213 -0
  78. package/platforms/ios/include/FontManager/NSCFontDescriptors.h +36 -0
  79. package/platforms/ios/include/FontManager/NSCFontFace.h +98 -0
  80. package/platforms/ios/include/FontManager/NSCFontFaceSet.h +73 -0
  81. package/platforms/ios/include/FontManager/NSCFontManagerUmbrella.h +7 -0
  82. package/platforms/ios/include/FontManager/NSCFontParser.h +22 -0
  83. package/platforms/ios/include/FontManager/NSCFontRegex.h +4 -0
  84. package/platforms/ios/include/FontManager/NSCFontResolver.h +43 -0
  85. package/platforms/ios/include/FontManager/NSCFontStyle.h +27 -0
  86. package/platforms/ios/include/FontManager/NSCFontTypes.h +41 -0
  87. package/platforms/ios/include/SDWebImage/NSButton+WebCache.h +340 -0
  88. package/platforms/ios/include/SDWebImage/NSData+ImageContentType.h +63 -0
  89. package/platforms/ios/include/SDWebImage/NSImage+Compatibility.h +67 -0
  90. package/platforms/ios/include/SDWebImage/SDAnimatedImage.h +136 -0
  91. package/platforms/ios/include/SDWebImage/SDAnimatedImagePlayer.h +113 -0
  92. package/platforms/ios/include/SDWebImage/SDAnimatedImageRep.h +33 -0
  93. package/platforms/ios/include/SDWebImage/SDAnimatedImageView+WebCache.h +168 -0
  94. package/platforms/ios/include/SDWebImage/SDAnimatedImageView.h +125 -0
  95. package/platforms/ios/include/SDWebImage/SDCallbackQueue.h +59 -0
  96. package/platforms/ios/include/SDWebImage/SDDiskCache.h +146 -0
  97. package/platforms/ios/include/SDWebImage/SDGraphicsImageRenderer.h +84 -0
  98. package/platforms/ios/include/SDWebImage/SDImageAPNGCoder.h +19 -0
  99. package/platforms/ios/include/SDWebImage/SDImageAWebPCoder.h +23 -0
  100. package/platforms/ios/include/SDWebImage/SDImageCache.h +482 -0
  101. package/platforms/ios/include/SDWebImage/SDImageCacheConfig.h +153 -0
  102. package/platforms/ios/include/SDWebImage/SDImageCacheDefine.h +179 -0
  103. package/platforms/ios/include/SDWebImage/SDImageCachesManager.h +81 -0
  104. package/platforms/ios/include/SDWebImage/SDImageCoder.h +347 -0
  105. package/platforms/ios/include/SDWebImage/SDImageCoderHelper.h +251 -0
  106. package/platforms/ios/include/SDWebImage/SDImageCodersManager.h +58 -0
  107. package/platforms/ios/include/SDWebImage/SDImageFrame.h +44 -0
  108. package/platforms/ios/include/SDWebImage/SDImageGIFCoder.h +22 -0
  109. package/platforms/ios/include/SDWebImage/SDImageGraphics.h +28 -0
  110. package/platforms/ios/include/SDWebImage/SDImageHEICCoder.h +25 -0
  111. package/platforms/ios/include/SDWebImage/SDImageIOAnimatedCoder.h +65 -0
  112. package/platforms/ios/include/SDWebImage/SDImageIOCoder.h +30 -0
  113. package/platforms/ios/include/SDWebImage/SDImageLoader.h +146 -0
  114. package/platforms/ios/include/SDWebImage/SDImageLoadersManager.h +40 -0
  115. package/platforms/ios/include/SDWebImage/SDImageTransformer.h +283 -0
  116. package/platforms/ios/include/SDWebImage/SDMemoryCache.h +78 -0
  117. package/platforms/ios/include/SDWebImage/SDWebImage.h +91 -0
  118. package/platforms/ios/include/SDWebImage/SDWebImageCacheKeyFilter.h +35 -0
  119. package/platforms/ios/include/SDWebImage/SDWebImageCacheSerializer.h +39 -0
  120. package/platforms/ios/include/SDWebImage/SDWebImageCompat.h +102 -0
  121. package/platforms/ios/include/SDWebImage/SDWebImageDefine.h +420 -0
  122. package/platforms/ios/include/SDWebImage/SDWebImageDownloader.h +320 -0
  123. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderConfig.h +113 -0
  124. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderDecryptor.h +52 -0
  125. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderOperation.h +191 -0
  126. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderRequestModifier.h +72 -0
  127. package/platforms/ios/include/SDWebImage/SDWebImageDownloaderResponseModifier.h +72 -0
  128. package/platforms/ios/include/SDWebImage/SDWebImageError.h +33 -0
  129. package/platforms/ios/include/SDWebImage/SDWebImageIndicator.h +119 -0
  130. package/platforms/ios/include/SDWebImage/SDWebImageManager.h +290 -0
  131. package/platforms/ios/include/SDWebImage/SDWebImageOperation.h +27 -0
  132. package/platforms/ios/include/SDWebImage/SDWebImageOptionsProcessor.h +78 -0
  133. package/platforms/ios/include/SDWebImage/SDWebImagePrefetcher.h +168 -0
  134. package/platforms/ios/include/SDWebImage/SDWebImageTransition.h +131 -0
  135. package/platforms/ios/include/SDWebImage/UIButton+WebCache.h +402 -0
  136. package/platforms/ios/include/SDWebImage/UIImage+ExtendedCacheData.h +24 -0
  137. package/platforms/ios/include/SDWebImage/UIImage+ForceDecode.h +52 -0
  138. package/platforms/ios/include/SDWebImage/UIImage+GIF.h +26 -0
  139. package/platforms/ios/include/SDWebImage/UIImage+MemoryCacheCost.h +27 -0
  140. package/platforms/ios/include/SDWebImage/UIImage+Metadata.h +104 -0
  141. package/platforms/ios/include/SDWebImage/UIImage+MultiFormat.h +81 -0
  142. package/platforms/ios/include/SDWebImage/UIImage+Transform.h +164 -0
  143. package/platforms/ios/include/SDWebImage/UIImageView+HighlightedWebCache.h +142 -0
  144. package/platforms/ios/include/SDWebImage/UIImageView+WebCache.h +209 -0
  145. package/platforms/ios/include/SDWebImage/UIView+WebCache.h +131 -0
  146. package/platforms/ios/include/SDWebImage/UIView+WebCacheOperation.h +52 -0
  147. package/platforms/ios/include/SDWebImage/UIView+WebCacheState.h +63 -0
  148. package/platforms/ios/include/module.modulemap +2 -0
  149. package/platforms/ios/manifest.json +132 -0
  150. package/platforms/ios/simulator-manifest.json +213 -0
  151. package/plugin-README.md +197 -0
  152. package/properties.d.ts +154 -0
  153. package/properties.js +2454 -0
  154. package/pseudo.d.ts +9 -0
  155. package/pseudo.js +57 -0
  156. package/scroll/index.android.d.ts +15 -0
  157. package/scroll/index.android.js +72 -0
  158. package/scroll/index.d.ts +5 -0
  159. package/scroll/index.ios.d.ts +18 -0
  160. package/scroll/index.ios.js +106 -0
  161. package/style.d.ts +768 -0
  162. package/style.js +7151 -0
  163. package/symbols.d.ts +25 -0
  164. package/symbols.js +41 -0
  165. package/tree/index.android.d.ts +11 -0
  166. package/tree/index.android.js +42 -0
  167. package/tree/index.d.ts +15 -0
  168. package/tree/index.ios.d.ts +26 -0
  169. package/tree/index.ios.js +53 -0
  170. package/typings/android-declarations.d.ts +4 -0
  171. package/typings/android.d.ts +9730 -0
  172. package/typings/manifest.json +45 -0
  173. package/typings/native.d.ts +5 -0
  174. package/typings/objc!FontManager.d.ts +389 -0
  175. package/typings/objc!MasonCore.d.ts +2472 -0
  176. package/typings/objc!SDWebImage.d.ts +3378 -0
  177. package/units.d.ts +29 -0
  178. package/units.js +44 -0
  179. package/utils/index.android.d.ts +211 -0
  180. package/utils/index.android.js +595 -0
  181. package/utils/index.ios.d.ts +222 -0
  182. package/utils/index.ios.js +790 -0
  183. package/view/index.android.d.ts +13 -0
  184. package/view/index.android.js +74 -0
  185. package/view/index.d.ts +2 -0
  186. package/view/index.ios.d.ts +24 -0
  187. package/view/index.ios.js +157 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Resolves CSS colour functions the native parsers don't read.
3
+ *
4
+ * String-valued properties (`box-shadow`, `background`, `border`, `filter`,
5
+ * `text-shadow`, ...) reach Android, iOS and Windows as the CSS text, and
6
+ * their parsers know hex, `rgb()`/`hsl()` and named colours only, so
7
+ * `0 2px 4px color-mix(in oklch, #000 4%, transparent)` would draw opaque
8
+ * black. Each colour function is replaced by its `rgba()` value first.
9
+ *
10
+ * Values that still hold a `var()` are left alone: there's nothing to resolve
11
+ * against yet.
12
+ */
13
+ /**
14
+ * @param toRgba resolves one colour (`oklch(60% 0.2 240)`) to `rgba(...)`, or
15
+ * returns null when it can't.
16
+ */
17
+ export declare function resolveCssColors(value: string, toRgba: (color: string) => string | null): string;
package/css-colors.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Resolves CSS colour functions the native parsers don't read.
3
+ *
4
+ * String-valued properties (`box-shadow`, `background`, `border`, `filter`,
5
+ * `text-shadow`, ...) reach Android, iOS and Windows as the CSS text, and
6
+ * their parsers know hex, `rgb()`/`hsl()` and named colours only, so
7
+ * `0 2px 4px color-mix(in oklch, #000 4%, transparent)` would draw opaque
8
+ * black. Each colour function is replaced by its `rgba()` value first.
9
+ *
10
+ * Values that still hold a `var()` are left alone: there's nothing to resolve
11
+ * against yet.
12
+ */
13
+ const COLOR_FUNCTION = /(?<![\w-])(color-mix|oklch|oklab|lab|lch|hwb|color|rgba?|hsla?)\(/gi;
14
+ // `rgb()`/`hsl()` only need resolving in their space-separated form.
15
+ const LEGACY_FUNCTION = /^(rgba?|hsla?)$/i;
16
+ const VAR = /var\(/i;
17
+ /**
18
+ * @param toRgba resolves one colour (`oklch(60% 0.2 240)`) to `rgba(...)`, or
19
+ * returns null when it can't.
20
+ */
21
+ export function resolveCssColors(value, toRgba) {
22
+ if (!value || !value.includes('(')) {
23
+ return value;
24
+ }
25
+ let out = '';
26
+ let last = 0;
27
+ COLOR_FUNCTION.lastIndex = 0;
28
+ let match;
29
+ while ((match = COLOR_FUNCTION.exec(value))) {
30
+ const open = match.index + match[0].length - 1;
31
+ const close = closingParen(value, open);
32
+ if (close === -1) {
33
+ break;
34
+ }
35
+ const call = value.slice(match.index, close + 1);
36
+ const skip = (LEGACY_FUNCTION.test(match[1]) && call.includes(',')) || VAR.test(call);
37
+ out += value.slice(last, match.index) + ((skip ? null : toRgba(call)) ?? call);
38
+ last = close + 1;
39
+ COLOR_FUNCTION.lastIndex = last;
40
+ }
41
+ return last === 0 ? value : out + value.slice(last);
42
+ }
43
+ function closingParen(value, open) {
44
+ let depth = 0;
45
+ for (let i = open; i < value.length; i++) {
46
+ if (value[i] === '(') {
47
+ depth++;
48
+ }
49
+ else if (value[i] === ')' && --depth === 0) {
50
+ return i;
51
+ }
52
+ }
53
+ return -1;
54
+ }
@@ -0,0 +1,17 @@
1
+ export type ColorMatrix = number[];
2
+ export type FilterStep = {
3
+ kind: 'matrix';
4
+ matrix: ColorMatrix;
5
+ } | {
6
+ kind: 'blur';
7
+ sigma: number;
8
+ } | {
9
+ kind: 'shadow';
10
+ x: number;
11
+ y: number;
12
+ sigma: number;
13
+ color: string | null;
14
+ };
15
+ export declare function composeMatrices(first: ColorMatrix, second: ColorMatrix): ColorMatrix;
16
+ export declare function parseCssFilter(value: string, toDip: (token: string) => number | undefined): FilterStep[];
17
+ export declare function encodeCssFilter(steps: FilterStep[], argbOf: (color: string | null) => number): string;
package/css-filter.js ADDED
@@ -0,0 +1,140 @@
1
+ import { parseBoxShadows } from './box-shadow';
2
+ import { parseAngle } from './css-transform';
3
+ const IDENTITY = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
4
+ function amount(arg, fallback) {
5
+ const t = arg.trim();
6
+ if (!t)
7
+ return fallback;
8
+ const n = parseFloat(t);
9
+ if (!Number.isFinite(n))
10
+ return fallback;
11
+ return t.endsWith('%') ? n / 100 : n;
12
+ }
13
+ const clamp01 = (n) => Math.min(1, Math.max(0, n));
14
+ function rgb(rows) {
15
+ return [...rows[0], 0, 0, ...rows[1], 0, 0, ...rows[2], 0, 0, 0, 0, 0, 1, 0];
16
+ }
17
+ function grayscale(a) {
18
+ const k = 1 - clamp01(a);
19
+ return rgb([
20
+ [0.2126 + 0.7874 * k, 0.7152 - 0.7152 * k, 0.0722 - 0.0722 * k],
21
+ [0.2126 - 0.2126 * k, 0.7152 + 0.2848 * k, 0.0722 - 0.0722 * k],
22
+ [0.2126 - 0.2126 * k, 0.7152 - 0.7152 * k, 0.0722 + 0.9278 * k],
23
+ ]);
24
+ }
25
+ function sepia(a) {
26
+ const k = 1 - clamp01(a);
27
+ return rgb([
28
+ [0.393 + 0.607 * k, 0.769 - 0.769 * k, 0.189 - 0.189 * k],
29
+ [0.349 - 0.349 * k, 0.686 + 0.314 * k, 0.168 - 0.168 * k],
30
+ [0.272 - 0.272 * k, 0.534 - 0.534 * k, 0.131 + 0.869 * k],
31
+ ]);
32
+ }
33
+ function saturate(s) {
34
+ return rgb([
35
+ [0.213 + 0.787 * s, 0.715 - 0.715 * s, 0.072 - 0.072 * s],
36
+ [0.213 - 0.213 * s, 0.715 + 0.285 * s, 0.072 - 0.072 * s],
37
+ [0.213 - 0.213 * s, 0.715 - 0.715 * s, 0.072 + 0.928 * s],
38
+ ]);
39
+ }
40
+ function hueRotate(radians) {
41
+ const c = Math.cos(radians);
42
+ const s = Math.sin(radians);
43
+ return rgb([
44
+ [0.213 + c * 0.787 - s * 0.213, 0.715 - c * 0.715 - s * 0.715, 0.072 - c * 0.072 + s * 0.928],
45
+ [0.213 - c * 0.213 + s * 0.143, 0.715 + c * 0.285 + s * 0.14, 0.072 - c * 0.072 - s * 0.283],
46
+ [0.213 - c * 0.213 - s * 0.787, 0.715 - c * 0.715 + s * 0.715, 0.072 + c * 0.928 + s * 0.072],
47
+ ]);
48
+ }
49
+ function linear(slope, intercept) {
50
+ return [slope, 0, 0, 0, intercept, 0, slope, 0, 0, intercept, 0, 0, slope, 0, intercept, 0, 0, 0, 1, 0];
51
+ }
52
+ function alpha(a) {
53
+ return [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, clamp01(a), 0];
54
+ }
55
+ export function composeMatrices(first, second) {
56
+ const out = new Array(20).fill(0);
57
+ for (let row = 0; row < 4; row++) {
58
+ for (let col = 0; col < 5; col++) {
59
+ let v = col === 4 ? second[row * 5 + 4] : 0;
60
+ for (let k = 0; k < 4; k++)
61
+ v += second[row * 5 + k] * first[k * 5 + col];
62
+ out[row * 5 + col] = v;
63
+ }
64
+ }
65
+ return out;
66
+ }
67
+ const FUNCTION = /([a-z-]+)\s*\(((?:[^()]|\([^()]*\))*)\)/gi;
68
+ export function parseCssFilter(value, toDip) {
69
+ const steps = [];
70
+ const v = (value ?? '').trim();
71
+ if (!v || v === 'none')
72
+ return steps;
73
+ const push = (matrix) => {
74
+ const last = steps[steps.length - 1];
75
+ if (last && last.kind === 'matrix')
76
+ last.matrix = composeMatrices(last.matrix, matrix);
77
+ else
78
+ steps.push({ kind: 'matrix', matrix });
79
+ };
80
+ for (const match of v.matchAll(FUNCTION)) {
81
+ const name = match[1].toLowerCase();
82
+ const arg = match[2];
83
+ switch (name) {
84
+ case 'blur': {
85
+ const t = arg.trim();
86
+ const sigma = t ? (toDip(t) ?? parseFloat(t)) : 0;
87
+ if (Number.isFinite(sigma) && sigma > 0)
88
+ steps.push({ kind: 'blur', sigma });
89
+ break;
90
+ }
91
+ case 'grayscale':
92
+ push(grayscale(amount(arg, 1)));
93
+ break;
94
+ case 'sepia':
95
+ push(sepia(amount(arg, 1)));
96
+ break;
97
+ case 'saturate':
98
+ push(saturate(Math.max(0, amount(arg, 1))));
99
+ break;
100
+ case 'hue-rotate':
101
+ push(hueRotate(arg.trim() ? parseAngle(arg) : 0));
102
+ break;
103
+ case 'invert': {
104
+ const a = clamp01(amount(arg, 1));
105
+ push(linear(1 - 2 * a, a));
106
+ break;
107
+ }
108
+ case 'opacity':
109
+ push(alpha(amount(arg, 1)));
110
+ break;
111
+ case 'brightness':
112
+ push(linear(Math.max(0, amount(arg, 1)), 0));
113
+ break;
114
+ case 'contrast': {
115
+ const c = Math.max(0, amount(arg, 1));
116
+ push(linear(c, 0.5 - 0.5 * c));
117
+ break;
118
+ }
119
+ case 'drop-shadow': {
120
+ const shadow = parseBoxShadows(arg, toDip)[0];
121
+ if (shadow)
122
+ steps.push({ kind: 'shadow', x: shadow.offsetX, y: shadow.offsetY, sigma: shadow.blur / 2, color: shadow.color });
123
+ break;
124
+ }
125
+ }
126
+ }
127
+ return steps.filter((s) => s.kind !== 'matrix' || s.matrix.some((n, i) => Math.abs(n - IDENTITY[i]) > 1e-6));
128
+ }
129
+ export function encodeCssFilter(steps, argbOf) {
130
+ const round = (n) => Math.round(n * 1e6) / 1e6;
131
+ return steps
132
+ .map((s) => {
133
+ if (s.kind === 'matrix')
134
+ return 'm,' + s.matrix.map(round).join(',');
135
+ if (s.kind === 'blur')
136
+ return `b,${round(s.sigma)}`;
137
+ return `d,${round(s.x)},${round(s.y)},${round(s.sigma)},${argbOf(s.color) >>> 0}`;
138
+ })
139
+ .join(';');
140
+ }
@@ -0,0 +1,41 @@
1
+ import type { CssAnimationProperty, Style, View } from '@nativescript/core';
2
+ /**
3
+ * CSS keyframes for properties MasonKit draws itself.
4
+ *
5
+ * Core plays each keyframe interval with its native Animation, which only knows opacity,
6
+ * background-color, transforms, width and height. MasonKit's animatable properties are taken
7
+ * out of core's keyframes and interpolated every frame on the same timeline instead: delay,
8
+ * duration, iterations, each interval's timing function and `animation-fill-mode`.
9
+ */
10
+ type Interpolate = (from: string, to: string, t: number) => string;
11
+ interface Track {
12
+ property: CssAnimationProperty<Style, string>;
13
+ interpolate: Interpolate;
14
+ /** [time in ms from the start of an iteration, value]; time-ordered. */
15
+ stops: [number, string][];
16
+ }
17
+ /** Lets keyframes animate [property] with [interpolate]; [initial] is its CSS initial value. */
18
+ export declare function registerKeyframeProperty(property: CssAnimationProperty<Style, string>, interpolate: Interpolate, initial: string): void;
19
+ /** Interpolates `<position>` lists (`mask-position`, `background-position`). */
20
+ export declare const interpolatePositionList: Interpolate;
21
+ /** Interpolates `<bg-size>` lists (`mask-size`, `background-size`). */
22
+ export declare const interpolateSizeList: Interpolate;
23
+ /** Core's keyframe curve as an easing function; `linear`, `spring` and unknown curves are linear. */
24
+ export declare function easing(curve: any): (t: number) => number;
25
+ /**
26
+ * The value of [track] at [time] ms into an iteration of [total] ms. [curveAt] gives the timing
27
+ * function of the interval starting at a time. A missing first or last keyframe uses [base], the
28
+ * element's own value, as CSS does.
29
+ */
30
+ export declare function sampleTrack(track: Pick<Track, 'interpolate' | 'stops'>, base: string, total: number, time: number, curveAt: (start: number) => (t: number) => number): string;
31
+ /**
32
+ * Windows: View.animate()'s scale, rotate and translate, played per frame on the View properties
33
+ * (core's storyboards target a transform that doesn't show on a Mason view).
34
+ */
35
+ export declare function animateTransforms(view: View, options: any): {
36
+ done: Promise<void>;
37
+ cancel: () => void;
38
+ };
39
+ /** Installs the keyframe hooks once. */
40
+ export declare function installKeyframes(): void;
41
+ export {};