@getcortexlabs/mavis 0.1.0-alpha.7 → 0.1.0-alpha.9
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.
- package/README.md +7 -5
- package/dist/date-format.android.d.ts +5 -0
- package/dist/date-format.android.d.ts.map +1 -0
- package/dist/date-format.android.js +39 -0
- package/dist/date-format.android.js.map +1 -0
- package/dist/date-format.d.ts +3 -0
- package/dist/date-format.d.ts.map +1 -0
- package/dist/date-format.ios.d.ts +5 -0
- package/dist/date-format.ios.d.ts.map +1 -0
- package/dist/date-format.ios.js +29 -0
- package/dist/date-format.ios.js.map +1 -0
- package/dist/date-format.js +2 -0
- package/dist/date-format.js.map +1 -0
- package/dist/native/collection-motion.d.ts +5 -0
- package/dist/native/collection-motion.d.ts.map +1 -0
- package/dist/native/collection-motion.js +157 -0
- package/dist/native/collection-motion.js.map +1 -0
- package/dist/native/date-format.android.d.ts +5 -0
- package/dist/native/date-format.android.d.ts.map +1 -0
- package/dist/native/date-format.android.js +39 -0
- package/dist/native/date-format.android.js.map +1 -0
- package/dist/native/date-format.d.ts +6 -0
- package/dist/native/date-format.d.ts.map +1 -0
- package/dist/native/date-format.ios.d.ts +5 -0
- package/dist/native/date-format.ios.d.ts.map +1 -0
- package/dist/native/date-format.ios.js +29 -0
- package/dist/native/date-format.ios.js.map +1 -0
- package/dist/native/date-format.js +8 -0
- package/dist/native/date-format.js.map +1 -0
- package/dist/native/image-effects.d.ts +11 -0
- package/dist/native/image-effects.d.ts.map +1 -0
- package/dist/native/image-effects.js +61 -0
- package/dist/native/image-effects.js.map +1 -0
- package/dist/native/motion-region.d.ts.map +1 -1
- package/dist/native/motion-region.js +7 -2
- package/dist/native/motion-region.js.map +1 -1
- package/dist/native/motion-surface.d.ts +2 -2
- package/dist/native/motion-surface.d.ts.map +1 -1
- package/dist/native/motion-surface.js +44 -1
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/platform-motion.d.ts +5 -0
- package/dist/native/platform-motion.d.ts.map +1 -0
- package/dist/native/platform-motion.js +90 -0
- package/dist/native/platform-motion.js.map +1 -0
- package/dist/native/surface-effects.d.ts +4 -0
- package/dist/native/surface-effects.d.ts.map +1 -0
- package/dist/native/surface-effects.js +31 -0
- package/dist/native/surface-effects.js.map +1 -0
- package/dist/native/visual-effects.d.ts +5 -0
- package/dist/native/visual-effects.d.ts.map +1 -0
- package/dist/native/visual-effects.js +126 -0
- package/dist/native/visual-effects.js.map +1 -0
- package/dist/vue/components/DateCalendar.d.ts +1 -1
- package/dist/vue/components/LoadingDecoration.d.ts +116 -0
- package/dist/vue/components/LoadingDecoration.d.ts.map +1 -0
- package/dist/vue/components/LoadingDecoration.js +34 -0
- package/dist/vue/components/LoadingDecoration.js.map +1 -0
- package/dist/vue/components/MAlert.d.ts +1 -1
- package/dist/vue/components/MAvatar.d.ts +1 -1
- package/dist/vue/components/MButton.d.ts +32 -10
- package/dist/vue/components/MButton.d.ts.map +1 -1
- package/dist/vue/components/MButton.js +33 -5
- package/dist/vue/components/MButton.js.map +1 -1
- package/dist/vue/components/MCard.d.ts +4 -4
- package/dist/vue/components/MCard.d.ts.map +1 -1
- package/dist/vue/components/MCard.js +4 -3
- package/dist/vue/components/MCard.js.map +1 -1
- package/dist/vue/components/MChip.d.ts +1 -1
- package/dist/vue/components/MCombobox.d.ts +2 -2
- package/dist/vue/components/MDatePicker.d.ts +56 -8
- package/dist/vue/components/MDatePicker.d.ts.map +1 -1
- package/dist/vue/components/MDatePicker.js +4 -14
- package/dist/vue/components/MDatePicker.js.map +1 -1
- package/dist/vue/components/MDialog.d.ts +3 -0
- package/dist/vue/components/MDialog.d.ts.map +1 -1
- package/dist/vue/components/MEmptyState.d.ts +1 -1
- package/dist/vue/components/MGrid.d.ts +165 -0
- package/dist/vue/components/MGrid.d.ts.map +1 -0
- package/dist/vue/components/MGrid.js +52 -0
- package/dist/vue/components/MGrid.js.map +1 -0
- package/dist/vue/components/MIcon.d.ts +18 -0
- package/dist/vue/components/MIcon.d.ts.map +1 -1
- package/dist/vue/components/MIcon.js +13 -2
- package/dist/vue/components/MIcon.js.map +1 -1
- package/dist/vue/components/MImage.d.ts +57 -1
- package/dist/vue/components/MImage.d.ts.map +1 -1
- package/dist/vue/components/MImage.js +58 -3
- package/dist/vue/components/MImage.js.map +1 -1
- package/dist/vue/components/MInput.d.ts +6 -6
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MInput.js +15 -0
- package/dist/vue/components/MInput.js.map +1 -1
- package/dist/vue/components/MLink.d.ts +2 -2
- package/dist/vue/components/MLink.d.ts.map +1 -1
- package/dist/vue/components/MLink.js +6 -11
- package/dist/vue/components/MLink.js.map +1 -1
- package/dist/vue/components/MListItem.d.ts +1 -1
- package/dist/vue/components/MReveal.d.ts +9 -9
- package/dist/vue/components/MScreen.d.ts +11 -1
- package/dist/vue/components/MScreen.d.ts.map +1 -1
- package/dist/vue/components/MScreen.js +26 -4
- package/dist/vue/components/MScreen.js.map +1 -1
- package/dist/vue/components/MSelect.d.ts +1 -1
- package/dist/vue/components/MSheet.d.ts +13 -4
- package/dist/vue/components/MSheet.d.ts.map +1 -1
- package/dist/vue/components/MSkeleton.d.ts +12 -1
- package/dist/vue/components/MSkeleton.d.ts.map +1 -1
- package/dist/vue/components/MSkeleton.js +5 -3
- package/dist/vue/components/MSkeleton.js.map +1 -1
- package/dist/vue/components/MStack.d.ts +9 -9
- package/dist/vue/components/MText.d.ts +11 -0
- package/dist/vue/components/MText.d.ts.map +1 -1
- package/dist/vue/components/MText.js +3 -1
- package/dist/vue/components/MText.js.map +1 -1
- package/dist/vue/components/configurator.d.ts +3 -3
- package/dist/vue/components/layout.d.ts +30 -19
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +3 -1
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/index.d.ts +11 -11
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +12 -12
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/services.d.ts +16 -0
- package/dist/vue/services.d.ts.map +1 -0
- package/dist/vue/services.js +18 -0
- package/dist/vue/services.js.map +1 -0
- package/dist/vue/use-motion-surface.d.ts +1 -1
- package/dist/vue/use-motion-surface.d.ts.map +1 -1
- package/dist/vue/use-motion-surface.js +31 -2
- package/dist/vue/use-motion-surface.js.map +1 -1
- package/package.json +15 -4
- package/src/date-format.ts +2 -0
- package/src/native/collection-motion.ts +166 -0
- package/src/native/date-format.android.ts +72 -0
- package/src/native/date-format.ios.ts +54 -0
- package/src/native/date-format.ts +17 -0
- package/src/native/image-effects.ts +71 -0
- package/src/native/motion-region.ts +7 -2
- package/src/native/motion-surface.ts +51 -2
- package/src/native/platform-motion.ts +103 -0
- package/src/native/surface-effects.ts +33 -0
- package/src/native/visual-effects.ts +147 -0
- package/src/vue/components/LoadingDecoration.ts +38 -0
- package/src/vue/components/MButton.ts +37 -4
- package/src/vue/components/MCard.ts +4 -2
- package/src/vue/components/MDatePicker.ts +3 -11
- package/src/vue/components/MGrid.ts +86 -0
- package/src/vue/components/MIcon.ts +14 -2
- package/src/vue/components/MImage.ts +66 -2
- package/src/vue/components/MInput.ts +14 -3
- package/src/vue/components/MLink.ts +12 -9
- package/src/vue/components/MScreen.ts +31 -3
- package/src/vue/components/MSkeleton.ts +5 -3
- package/src/vue/components/MText.ts +7 -0
- package/src/vue/components/layout.ts +3 -0
- package/src/vue/index.ts +63 -69
- package/src/vue/services.ts +32 -0
- package/src/vue/use-motion-surface.ts +32 -1
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# Mavis UI for NativeScript
|
|
2
2
|
|
|
3
|
-
NativeScript components and themes for Mavis UI `0.1.0-alpha.
|
|
3
|
+
NativeScript components and themes for Mavis UI `0.1.0-alpha.9`, starting with Vue. Experimental prerelease for testing in real apps; the API can change between alpha versions. Licensed under MIT.
|
|
4
4
|
|
|
5
5
|
In an existing NativeScript-Vue application:
|
|
6
6
|
|
|
7
|
+
Alpha.9 includes `createMavisServices` from `@getcortexlabs/mavis/vue/services` for local component imports and the adaptive `MGrid`. See the [modular installation guide](https://mavis-ui.getcortexlabs.com/guide/modular).
|
|
8
|
+
|
|
7
9
|
```sh
|
|
8
|
-
npm install @getcortexlabs/mavis@0.1.0-alpha.
|
|
10
|
+
npm install @getcortexlabs/mavis@0.1.0-alpha.9 @rafaelaugusto/jolt@0.1.0-rc.10
|
|
9
11
|
```
|
|
10
12
|
|
|
11
13
|
```ts
|
|
@@ -28,9 +30,9 @@ The plugin registers the layout, typography, form, selection, feedback and overl
|
|
|
28
30
|
- `platforms/android/java/`: the native flex measurement adapter, compiled by NativeScript.
|
|
29
31
|
- `src/vue/`: Vue components, reactive theme context, and optional global registration.
|
|
30
32
|
|
|
31
|
-
The root entry exports themes and their types. The `/vue` entry exports components, `createMavis`, and `useMavisTheme`. `createMavis({ theme, darkTheme })` follows the device appearance and `setAppearance` overrides it. NativeScript Core 9.1.3+, Jolt 0.1.0-rc.
|
|
33
|
+
The root entry exports themes and their types. The `/vue` entry exports components, `createMavis`, and `useMavisTheme`. `createMavis({ theme, darkTheme })` follows the device appearance and `setAppearance` overrides it. NativeScript Core 9.1.3+, Jolt 0.1.0-rc.10+, and NativeScript-Vue 3.1.3+ are the source development baseline. The consuming Vue app installs all three; Vue is optional on the package metadata so importing theme values does not require a Vue renderer.
|
|
32
34
|
|
|
33
|
-
Tested package-consumer baseline: NativeScript Core 9.1.3, NativeScript-Vue 3.1.3, Jolt 0.1.0-rc.
|
|
35
|
+
Tested package-consumer baseline: NativeScript Core 9.1.3, NativeScript-Vue 3.1.3, Jolt 0.1.0-rc.10, Android runtime 9.1.1 and iOS runtime 9.1.0. See [Getting started](https://mavis-ui.getcortexlabs.com/guide/foundation) for setup.
|
|
34
36
|
|
|
35
37
|
Changes to the Android adapter require a native build. If an existing checkout reports a missing `com.mavis.ui.FlexLayout` after upgrading, run `ns clean` in the app directory and rebuild to regenerate native metadata.
|
|
36
38
|
|
|
@@ -38,4 +40,4 @@ Other NativeScript frameworks come after the Vue implementation. No adapters for
|
|
|
38
40
|
|
|
39
41
|
Deep native layouts can be expensive ([#56](https://github.com/getcortexlabs/mavis-ui/issues/56)); VoiceOver can skip a newly inserted offscreen status ([#54](https://github.com/getcortexlabs/mavis-ui/issues/54)). Physical Android and full keyboard coverage remain pending. Read the [release notes](https://github.com/getcortexlabs/mavis-ui/blob/main/CHANGELOG.md) before adopting the alpha.
|
|
40
42
|
|
|
41
|
-
Alpha.
|
|
43
|
+
Alpha.8 requires Jolt **0.1.0-rc.10** for the experimental visual effects, retained collections, platform motion and sensor integrations. Keep the Mavis packages at the same version. Rebuild native applications after upgrading Jolt.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DateTimeValue, type DateTimeFormatOptions } from '@getcortexlabs/mavis-core';
|
|
2
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core';
|
|
3
|
+
export declare function formatDateTime(value: DateTimeValue, options: DateTimeFormatOptions): string;
|
|
4
|
+
export declare function dateTimeToCivilDate(value: DateTimeValue, options: Pick<DateTimeFormatOptions, 'timeZone'>): `${number}-${number}-${number}`;
|
|
5
|
+
//# sourceMappingURL=date-format.android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.android.d.ts","sourceRoot":"","sources":["../src/date-format.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAsCpG,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAc3F;AACD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,mCASjD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { civilDate, dateTimeMilliseconds, resolveDateTimeOptions, } from '@getcortexlabs/mavis-core';
|
|
2
|
+
function zone(name) {
|
|
3
|
+
// TimeZone.getTimeZone silently returns GMT for unknown identifiers. Reject that fallback.
|
|
4
|
+
const known = Array.from(java.util.TimeZone.getAvailableIDs());
|
|
5
|
+
if (!known.includes(name))
|
|
6
|
+
throw new RangeError(`Unknown timeZone: ${name}`);
|
|
7
|
+
return java.util.TimeZone.getTimeZone(name);
|
|
8
|
+
}
|
|
9
|
+
function configureCalendar(formatter, timeZone, locale) {
|
|
10
|
+
const value = zone(timeZone);
|
|
11
|
+
const calendar = new java.util.GregorianCalendar(value, locale);
|
|
12
|
+
calendar.setGregorianChange(new java.util.Date(-8640000000000000));
|
|
13
|
+
formatter.setCalendar(calendar);
|
|
14
|
+
}
|
|
15
|
+
export function formatDateTime(value, options) {
|
|
16
|
+
const milliseconds = dateTimeMilliseconds(value);
|
|
17
|
+
const config = resolveDateTimeOptions(options);
|
|
18
|
+
const locale = java.util.Locale.forLanguageTag(config.locale);
|
|
19
|
+
const styles = { full: 0, long: 1, medium: 2, short: 3 };
|
|
20
|
+
const factory = java.text.DateFormat;
|
|
21
|
+
const result = config.dateStyle && config.timeStyle
|
|
22
|
+
? factory.getDateTimeInstance(styles[config.dateStyle], styles[config.timeStyle], locale)
|
|
23
|
+
: config.dateStyle
|
|
24
|
+
? factory.getDateInstance(styles[config.dateStyle], locale)
|
|
25
|
+
: factory.getTimeInstance(styles[config.timeStyle], locale);
|
|
26
|
+
configureCalendar(result, config.timeZone, locale);
|
|
27
|
+
return String(result.format(new java.util.Date(milliseconds)));
|
|
28
|
+
}
|
|
29
|
+
export function dateTimeToCivilDate(value, options) {
|
|
30
|
+
const milliseconds = dateTimeMilliseconds(value);
|
|
31
|
+
const { timeZone } = resolveDateTimeOptions(options);
|
|
32
|
+
const result = new java.text.SimpleDateFormat('G yyyy-MM-dd', java.util.Locale.US);
|
|
33
|
+
configureCalendar(result, timeZone, java.util.Locale.US);
|
|
34
|
+
const text = String(result.format(new java.util.Date(milliseconds)));
|
|
35
|
+
if (!text.startsWith('AD '))
|
|
36
|
+
throw new RangeError('Civil dates support years 0001–9999.');
|
|
37
|
+
return civilDate(text.slice(3));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=date-format.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.android.js","sourceRoot":"","sources":["../src/date-format.android.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,2BAA2B,CAAA;AA2BlC,SAAS,IAAI,CAAC,IAAY;IACxB,2FAA2F;IAC3F,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAA;IAC9D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAA;IAC5E,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;AAC7C,CAAC;AACD,SAAS,iBAAiB,CAAC,SAAoB,EAAE,QAAgB,EAAE,MAAe;IAChF,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC5B,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAC/D,QAAQ,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAClE,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;AACjC,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,KAAo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AAC,OAAO,CAAC,CAAA;IACpD,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAClF,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IACpE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,sCAAsC,CAAC,CAAA;IACzF,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.d.ts","sourceRoot":"","sources":["../src/date-format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1E,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DateTimeValue, type DateTimeFormatOptions } from '@getcortexlabs/mavis-core';
|
|
2
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core';
|
|
3
|
+
export declare function formatDateTime(value: DateTimeValue, options: DateTimeFormatOptions): string;
|
|
4
|
+
export declare function dateTimeToCivilDate(value: DateTimeValue, options: Pick<DateTimeFormatOptions, 'timeZone'>): `${number}-${number}-${number}`;
|
|
5
|
+
//# sourceMappingURL=date-format.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.ios.d.ts","sourceRoot":"","sources":["../src/date-format.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AA+BpG,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAG3F;AACD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,mCASjD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { civilDate, dateTimeMilliseconds, resolveDateTimeOptions, } from '@getcortexlabs/mavis-core';
|
|
2
|
+
function formatter(options) {
|
|
3
|
+
const config = resolveDateTimeOptions(options);
|
|
4
|
+
const zone = NSTimeZone.timeZoneWithName(config.timeZone);
|
|
5
|
+
if (!zone)
|
|
6
|
+
throw new RangeError(`Unknown timeZone: ${config.timeZone}`);
|
|
7
|
+
const result = NSDateFormatter.new();
|
|
8
|
+
result.locale = NSLocale.alloc().initWithLocaleIdentifier(config.locale);
|
|
9
|
+
result.calendar = NSCalendar.calendarWithIdentifier('gregorian');
|
|
10
|
+
result.gregorianStartDate = NSDate.dateWithTimeIntervalSince1970(-8640000000000);
|
|
11
|
+
result.timeZone = zone;
|
|
12
|
+
const styles = { short: 1, medium: 2, long: 3, full: 4 };
|
|
13
|
+
result.dateStyle = config.dateStyle ? styles[config.dateStyle] : 0;
|
|
14
|
+
result.timeStyle = config.timeStyle ? styles[config.timeStyle] : 0;
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
export function formatDateTime(value, options) {
|
|
18
|
+
const instant = NSDate.dateWithTimeIntervalSince1970(dateTimeMilliseconds(value) / 1000);
|
|
19
|
+
return formatter(options).stringFromDate(instant);
|
|
20
|
+
}
|
|
21
|
+
export function dateTimeToCivilDate(value, options) {
|
|
22
|
+
const result = formatter({ ...options, locale: 'en-US-POSIX', dateStyle: 'short' });
|
|
23
|
+
result.dateFormat = 'G yyyy-MM-dd';
|
|
24
|
+
const text = result.stringFromDate(NSDate.dateWithTimeIntervalSince1970(dateTimeMilliseconds(value) / 1000));
|
|
25
|
+
if (!text.startsWith('AD '))
|
|
26
|
+
throw new RangeError('Civil dates support years 0001–9999.');
|
|
27
|
+
return civilDate(text.slice(3));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=date-format.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.ios.js","sourceRoot":"","sources":["../src/date-format.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,2BAA2B,CAAA;AAkBlC,SAAS,SAAS,CAAC,OAA8B;IAC/C,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,IAAI,GAAG,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACzD,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,UAAU,CAAC,qBAAqB,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvE,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,CAAA;IACpC,MAAM,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACxE,MAAM,CAAC,QAAQ,GAAG,UAAU,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;IAChE,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC,aAAa,CAAC,CAAA;IAChF,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA;IACtB,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,CAAC,EAA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ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type View } from '@nativescript/core';
|
|
2
|
+
import { type MotionScope } from '@rafaelaugusto/jolt';
|
|
3
|
+
import { type MotionRegionAdapter, type MotionSurfaceAdapter } from '@getcortexlabs/mavis-core/experimental';
|
|
4
|
+
export declare function nativeCollectionMotion(target: View, resolve: (surface: MotionSurfaceAdapter) => View, scope: MotionScope): Pick<MotionRegionAdapter, 'scrollHeader' | 'reorder'>;
|
|
5
|
+
//# sourceMappingURL=collection-motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-motion.d.ts","sourceRoot":"","sources":["../../src/native/collection-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEpE,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,wCAAwC,CAAA;AAoB/C,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,EAChD,KAAK,EAAE,WAAW,GACjB,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,SAAS,CAAC,CAsIvD"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { LayoutBase, isIOS } from '@nativescript/core';
|
|
2
|
+
import { scrollHeader } from '@rafaelaugusto/jolt';
|
|
3
|
+
import { reorder } from '@rafaelaugusto/jolt/reorder';
|
|
4
|
+
import { mapMotionItems, } from '@getcortexlabs/mavis-core/experimental';
|
|
5
|
+
import { nativeScrollElement } from './scroll-motion.js';
|
|
6
|
+
const headerInsets = new WeakMap();
|
|
7
|
+
function retainHeaderLayout(header) {
|
|
8
|
+
if (!isIOS)
|
|
9
|
+
return () => { };
|
|
10
|
+
const state = headerInsets.get(header) ?? { previous: header.iosIgnoreSafeArea, owners: 0 };
|
|
11
|
+
state.owners++;
|
|
12
|
+
headerInsets.set(header, state);
|
|
13
|
+
header.iosIgnoreSafeArea = true;
|
|
14
|
+
let released = false;
|
|
15
|
+
return () => {
|
|
16
|
+
if (released)
|
|
17
|
+
return;
|
|
18
|
+
released = true;
|
|
19
|
+
if (--state.owners)
|
|
20
|
+
return;
|
|
21
|
+
headerInsets.delete(header);
|
|
22
|
+
if (header.iosIgnoreSafeArea === true)
|
|
23
|
+
header.iosIgnoreSafeArea = state.previous;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function nativeCollectionMotion(target, resolve, scope) {
|
|
27
|
+
return {
|
|
28
|
+
scrollHeader(source, options) {
|
|
29
|
+
const { header, artwork, title, toolbar, toolbarTitle, section, items, expanded, minimum, ...rest } = options;
|
|
30
|
+
const headerView = resolve(header);
|
|
31
|
+
if (!(headerView instanceof LayoutBase))
|
|
32
|
+
throw new TypeError('Use a layout surface for the header.');
|
|
33
|
+
const artworkView = resolve(artwork);
|
|
34
|
+
// The moving header already sits inside MScreen's safe area. Reapplying
|
|
35
|
+
// UIKit's changing insets to its children would shift them during reflow.
|
|
36
|
+
const restoreHeader = retainHeaderLayout(headerView);
|
|
37
|
+
let headerControl;
|
|
38
|
+
try {
|
|
39
|
+
headerControl = scrollHeader(nativeScrollElement(source), {
|
|
40
|
+
...rest,
|
|
41
|
+
header: headerView,
|
|
42
|
+
artwork: artworkView,
|
|
43
|
+
title: resolve(title),
|
|
44
|
+
toolbar: resolve(toolbar),
|
|
45
|
+
toolbarTitle: resolve(toolbarTitle),
|
|
46
|
+
section: resolve(section),
|
|
47
|
+
expandedHeight: expanded,
|
|
48
|
+
minimumHeight: minimum,
|
|
49
|
+
items: () => mapMotionItems(items(), resolve),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
restoreHeader();
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
const control = headerControl;
|
|
57
|
+
let released = false;
|
|
58
|
+
const lifetime = scope.add({
|
|
59
|
+
dispose() {
|
|
60
|
+
if (released)
|
|
61
|
+
return;
|
|
62
|
+
released = true;
|
|
63
|
+
try {
|
|
64
|
+
control.dispose();
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
restoreHeader();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
get ready() {
|
|
73
|
+
return control.ready;
|
|
74
|
+
},
|
|
75
|
+
get state() {
|
|
76
|
+
return {
|
|
77
|
+
offset: control.state.offset,
|
|
78
|
+
refreshing: control.state.refresh === 'refreshing',
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
refresh: () => control.refresh(),
|
|
82
|
+
cancelRefresh: () => control.cancelRefresh(),
|
|
83
|
+
remeasure: () => control.remeasure(),
|
|
84
|
+
preserveAnchor: (change) => control.preserveAnchor(change),
|
|
85
|
+
scrollToItem(key, animated = true) {
|
|
86
|
+
const index = items().findIndex((item) => item.key === key);
|
|
87
|
+
if (index < 0)
|
|
88
|
+
return false;
|
|
89
|
+
control.scrollToItem(index, animated);
|
|
90
|
+
return true;
|
|
91
|
+
},
|
|
92
|
+
scrollToTop: (animated = true) => control.scrollToTop(animated),
|
|
93
|
+
pause: () => control.pause(),
|
|
94
|
+
play: () => control.play(),
|
|
95
|
+
dispose: () => lifetime.dispose(),
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
reorder(options) {
|
|
99
|
+
const { container, items, scroll, accessibility, ...rest } = options;
|
|
100
|
+
const layout = resolve(container);
|
|
101
|
+
if (!(layout instanceof LayoutBase))
|
|
102
|
+
throw new TypeError('Use a layout motion surface for retained rows.');
|
|
103
|
+
let control;
|
|
104
|
+
let disposed = false, paused = false, queued = false;
|
|
105
|
+
const attach = () => {
|
|
106
|
+
if (disposed || control)
|
|
107
|
+
return;
|
|
108
|
+
layout.off('layoutChanged', laidOut);
|
|
109
|
+
control = reorder(layout, {
|
|
110
|
+
...rest,
|
|
111
|
+
scroll: nativeScrollElement(scroll),
|
|
112
|
+
items: () => mapMotionItems(items(), resolve),
|
|
113
|
+
accessibility: { moveUp: accessibility?.moveUp, moveDown: accessibility?.moveDown },
|
|
114
|
+
});
|
|
115
|
+
if (paused)
|
|
116
|
+
control.pause();
|
|
117
|
+
};
|
|
118
|
+
// `loaded` precedes native layout. Wait for that lifecycle boundary once;
|
|
119
|
+
// Jolt owns subsequent geometry updates, gestures and animation scheduling.
|
|
120
|
+
const laidOut = () => {
|
|
121
|
+
if (queued)
|
|
122
|
+
return;
|
|
123
|
+
queued = true;
|
|
124
|
+
void Promise.resolve().then(attach);
|
|
125
|
+
};
|
|
126
|
+
if (layout.isLayoutValid && layout.getActualSize().height > 0)
|
|
127
|
+
attach();
|
|
128
|
+
else
|
|
129
|
+
layout.on('layoutChanged', laidOut);
|
|
130
|
+
return scope.add({
|
|
131
|
+
get activeKey() {
|
|
132
|
+
return control?.activeKey;
|
|
133
|
+
},
|
|
134
|
+
move: (key, before) => control?.move(key, before) ?? false,
|
|
135
|
+
moveUp: (key) => control?.moveUp(key) ?? false,
|
|
136
|
+
moveDown: (key) => control?.moveDown(key) ?? false,
|
|
137
|
+
refresh: () => control?.refresh(),
|
|
138
|
+
cancel: () => control?.cancel(),
|
|
139
|
+
pause() {
|
|
140
|
+
paused = true;
|
|
141
|
+
control?.pause();
|
|
142
|
+
},
|
|
143
|
+
play() {
|
|
144
|
+
paused = false;
|
|
145
|
+
control?.play();
|
|
146
|
+
},
|
|
147
|
+
dispose() {
|
|
148
|
+
disposed = true;
|
|
149
|
+
layout.off('layoutChanged', laidOut);
|
|
150
|
+
control?.dispose();
|
|
151
|
+
control = undefined;
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=collection-motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-motion.js","sourceRoot":"","sources":["../../src/native/collection-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,OAAO,EAAgB,MAAM,6BAA6B,CAAA;AACnE,OAAO,EACL,cAAc,GAGf,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExD,MAAM,YAAY,GAAG,IAAI,OAAO,EAAqD,CAAA;AACrF,SAAS,kBAAkB,CAAC,MAAkB;IAC5C,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;IAC3B,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC,EAAE,CAAA;IAC3F,KAAK,CAAC,MAAM,EAAE,CAAA;IACd,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAA;IAC/B,IAAI,QAAQ,GAAG,KAAK,CAAA;IACpB,OAAO,GAAG,EAAE;QACV,IAAI,QAAQ;YAAE,OAAM;QACpB,QAAQ,GAAG,IAAI,CAAA;QACf,IAAI,EAAE,KAAK,CAAC,MAAM;YAAE,OAAM;QAC1B,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC3B,IAAI,MAAM,CAAC,iBAAiB,KAAK,IAAI;YAAE,MAAM,CAAC,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAA;IAClF,CAAC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,MAAY,EACZ,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
|
|
1
|
+
import { type DateTimeValue, type DateTimeFormatOptions } from '@getcortexlabs/mavis-core';
|
|
2
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core';
|
|
3
|
+
export declare function formatDateTime(value: DateTimeValue, options: DateTimeFormatOptions): string;
|
|
4
|
+
export declare function dateTimeToCivilDate(value: DateTimeValue, options: Pick<DateTimeFormatOptions, 'timeZone'>): `${number}-${number}-${number}`;
|
|
5
|
+
//# sourceMappingURL=date-format.android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.android.d.ts","sourceRoot":"","sources":["../../src/native/date-format.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAsCpG,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAc3F;AACD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,mCASjD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { civilDate, dateTimeMilliseconds, resolveDateTimeOptions, } from '@getcortexlabs/mavis-core';
|
|
2
|
+
function zone(name) {
|
|
3
|
+
// TimeZone.getTimeZone silently returns GMT for unknown identifiers. Reject that fallback.
|
|
4
|
+
const known = Array.from(java.util.TimeZone.getAvailableIDs());
|
|
5
|
+
if (!known.includes(name))
|
|
6
|
+
throw new RangeError(`Unknown timeZone: ${name}`);
|
|
7
|
+
return java.util.TimeZone.getTimeZone(name);
|
|
8
|
+
}
|
|
9
|
+
function configureCalendar(formatter, timeZone, locale) {
|
|
10
|
+
const value = zone(timeZone);
|
|
11
|
+
const calendar = new java.util.GregorianCalendar(value, locale);
|
|
12
|
+
calendar.setGregorianChange(new java.util.Date(-8640000000000000));
|
|
13
|
+
formatter.setCalendar(calendar);
|
|
14
|
+
}
|
|
15
|
+
export function formatDateTime(value, options) {
|
|
16
|
+
const milliseconds = dateTimeMilliseconds(value);
|
|
17
|
+
const config = resolveDateTimeOptions(options);
|
|
18
|
+
const locale = java.util.Locale.forLanguageTag(config.locale);
|
|
19
|
+
const styles = { full: 0, long: 1, medium: 2, short: 3 };
|
|
20
|
+
const factory = java.text.DateFormat;
|
|
21
|
+
const result = config.dateStyle && config.timeStyle
|
|
22
|
+
? factory.getDateTimeInstance(styles[config.dateStyle], styles[config.timeStyle], locale)
|
|
23
|
+
: config.dateStyle
|
|
24
|
+
? factory.getDateInstance(styles[config.dateStyle], locale)
|
|
25
|
+
: factory.getTimeInstance(styles[config.timeStyle], locale);
|
|
26
|
+
configureCalendar(result, config.timeZone, locale);
|
|
27
|
+
return String(result.format(new java.util.Date(milliseconds)));
|
|
28
|
+
}
|
|
29
|
+
export function dateTimeToCivilDate(value, options) {
|
|
30
|
+
const milliseconds = dateTimeMilliseconds(value);
|
|
31
|
+
const { timeZone } = resolveDateTimeOptions(options);
|
|
32
|
+
const result = new java.text.SimpleDateFormat('G yyyy-MM-dd', java.util.Locale.US);
|
|
33
|
+
configureCalendar(result, timeZone, java.util.Locale.US);
|
|
34
|
+
const text = String(result.format(new java.util.Date(milliseconds)));
|
|
35
|
+
if (!text.startsWith('AD '))
|
|
36
|
+
throw new RangeError('Civil dates support years 0001–9999.');
|
|
37
|
+
return civilDate(text.slice(3));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=date-format.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.android.js","sourceRoot":"","sources":["../../src/native/date-format.android.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,2BAA2B,CAAA;AA2BlC,SAA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,IAAI,UAAU,CAAC,sCAAsC,CAAC,CAAA;IACzF,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DateTimeValue, DateTimeFormatOptions, CivilDate } from '@getcortexlabs/mavis-core';
|
|
2
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core';
|
|
3
|
+
/** NativeScript resolves the .ios/.android implementation in a device bundle. */
|
|
4
|
+
export declare function formatDateTime(_value: DateTimeValue, _options: DateTimeFormatOptions): string;
|
|
5
|
+
export declare function dateTimeToCivilDate(_value: DateTimeValue, _options: Pick<DateTimeFormatOptions, 'timeZone'>): CivilDate;
|
|
6
|
+
//# sourceMappingURL=date-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.d.ts","sourceRoot":"","sources":["../../src/native/date-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAChG,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpG,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,GAAG,MAAM,CAI7F;AACD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,GAChD,SAAS,CAIX"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DateTimeValue, type DateTimeFormatOptions } from '@getcortexlabs/mavis-core';
|
|
2
|
+
export type { DateTimeValue, DateTimeFormatOptions, DateTimeStyle } from '@getcortexlabs/mavis-core';
|
|
3
|
+
export declare function formatDateTime(value: DateTimeValue, options: DateTimeFormatOptions): string;
|
|
4
|
+
export declare function dateTimeToCivilDate(value: DateTimeValue, options: Pick<DateTimeFormatOptions, 'timeZone'>): `${number}-${number}-${number}`;
|
|
5
|
+
//# sourceMappingURL=date-format.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.ios.d.ts","sourceRoot":"","sources":["../../src/native/date-format.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AA+BpG,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAG3F;AACD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,mCASjD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { civilDate, dateTimeMilliseconds, resolveDateTimeOptions, } from '@getcortexlabs/mavis-core';
|
|
2
|
+
function formatter(options) {
|
|
3
|
+
const config = resolveDateTimeOptions(options);
|
|
4
|
+
const zone = NSTimeZone.timeZoneWithName(config.timeZone);
|
|
5
|
+
if (!zone)
|
|
6
|
+
throw new RangeError(`Unknown timeZone: ${config.timeZone}`);
|
|
7
|
+
const result = NSDateFormatter.new();
|
|
8
|
+
result.locale = NSLocale.alloc().initWithLocaleIdentifier(config.locale);
|
|
9
|
+
result.calendar = NSCalendar.calendarWithIdentifier('gregorian');
|
|
10
|
+
result.gregorianStartDate = NSDate.dateWithTimeIntervalSince1970(-8640000000000);
|
|
11
|
+
result.timeZone = zone;
|
|
12
|
+
const styles = { short: 1, medium: 2, long: 3, full: 4 };
|
|
13
|
+
result.dateStyle = config.dateStyle ? styles[config.dateStyle] : 0;
|
|
14
|
+
result.timeStyle = config.timeStyle ? styles[config.timeStyle] : 0;
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
export function formatDateTime(value, options) {
|
|
18
|
+
const instant = NSDate.dateWithTimeIntervalSince1970(dateTimeMilliseconds(value) / 1000);
|
|
19
|
+
return formatter(options).stringFromDate(instant);
|
|
20
|
+
}
|
|
21
|
+
export function dateTimeToCivilDate(value, options) {
|
|
22
|
+
const result = formatter({ ...options, locale: 'en-US-POSIX', dateStyle: 'short' });
|
|
23
|
+
result.dateFormat = 'G yyyy-MM-dd';
|
|
24
|
+
const text = result.stringFromDate(NSDate.dateWithTimeIntervalSince1970(dateTimeMilliseconds(value) / 1000));
|
|
25
|
+
if (!text.startsWith('AD '))
|
|
26
|
+
throw new RangeError('Civil dates support years 0001–9999.');
|
|
27
|
+
return civilDate(text.slice(3));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=date-format.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.ios.js","sourceRoot":"","sources":["../../src/native/date-format.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,2BAA2B,CAAA;AAkBlC,SAAS,SAAS,CAAC,OAA8B;IAC/C,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,IAAI,GAAG,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACzD,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,UAAU,CAAC,qBAAqB,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvE,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,CAAA;IACpC,MAAM,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACxE,MAAM,CAAC,QAAQ,GAAG,UAAU,CAAC,sBAAsB,C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,UAAU,CAAC,sCAAsC,CAAC,CAAA;IACzF,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** NativeScript resolves the .ios/.android implementation in a device bundle. */
|
|
2
|
+
export function formatDateTime(_value, _options) {
|
|
3
|
+
throw new Error('Native date formatting requires an iOS or Android runtime. Use the Web formatter on the server.');
|
|
4
|
+
}
|
|
5
|
+
export function dateTimeToCivilDate(_value, _options) {
|
|
6
|
+
throw new Error('Native date formatting requires an iOS or Android runtime. Use the Web formatter on the server.');
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=date-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-format.js","sourceRoot":"","sources":["../../src/native/date-format.ts"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,MAAqB,EAAE,QAA+B;IACnF,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAA;AACH,CAAC;AACD,MAAM,UAAU,mBAAmB,CACjC,MAAqB,EACrB,QAAiD;IAEjD,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Image, type View } from '@nativescript/core';
|
|
2
|
+
import type { MotionImageEffectName, MotionImageEffectOptions, MotionPlayback } from '@getcortexlabs/mavis-core/experimental';
|
|
3
|
+
type Presentation = {
|
|
4
|
+
current(): boolean;
|
|
5
|
+
commit(src: string, image: Image['imageSource']): Promise<boolean>;
|
|
6
|
+
};
|
|
7
|
+
export declare function registerMotionImage(target: Image, presentation: Presentation): () => void;
|
|
8
|
+
export declare function loadedMotionImage(target: View): Image;
|
|
9
|
+
export declare function nativeImageEffect(target: View, name: MotionImageEffectName, options?: MotionImageEffectOptions, live?: () => boolean): Promise<MotionPlayback>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=image-effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-effects.d.ts","sourceRoot":"","sources":["../../src/native/image-effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACf,MAAM,wCAAwC,CAAA;AAG/C,KAAK,YAAY,GAAG;IAClB,OAAO,IAAI,OAAO,CAAA;IAClB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACnE,CAAA;AAGD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,cAK5E;AACD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,IAAI,GAAG,KAAK,CAIrD;AACD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,IAAI,EACZ,IAAI,EAAE,qBAAqB,EAC3B,OAAO,GAAE,wBAA6B,EACtC,IAAI,GAAE,MAAM,OAAoB,2BAwCjC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Image } from '@nativescript/core';
|
|
2
|
+
import { imageEffect } from '@rafaelaugusto/jolt';
|
|
3
|
+
import { loadAvatarImage } from './avatar-image.js';
|
|
4
|
+
const images = new WeakMap();
|
|
5
|
+
const preparations = new WeakMap();
|
|
6
|
+
export function registerMotionImage(target, presentation) {
|
|
7
|
+
images.set(target, presentation);
|
|
8
|
+
return () => {
|
|
9
|
+
if (images.get(target) === presentation)
|
|
10
|
+
images.delete(target);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function loadedMotionImage(target) {
|
|
14
|
+
if (!(target instanceof Image) || !images.has(target) || !target.imageSource)
|
|
15
|
+
throw new TypeError('Use the ready motionSurface of MImage for pixel effects.');
|
|
16
|
+
return target;
|
|
17
|
+
}
|
|
18
|
+
export async function nativeImageEffect(target, name, options = {}, live = () => true) {
|
|
19
|
+
const image = loadedMotionImage(target), presentation = images.get(image);
|
|
20
|
+
const { to, ...rest } = options;
|
|
21
|
+
if (to !== undefined && (name !== 'dissolve' || !to.trim()))
|
|
22
|
+
throw new TypeError('Only dissolve accepts a nonempty destination source.');
|
|
23
|
+
const preparation = {};
|
|
24
|
+
preparations.set(image, preparation);
|
|
25
|
+
const destination = to === undefined ? undefined : await loadAvatarImage(to);
|
|
26
|
+
if (to !== undefined && !destination)
|
|
27
|
+
throw new Error('Destination image could not be decoded.');
|
|
28
|
+
if (!live() ||
|
|
29
|
+
preparations.get(image) !== preparation ||
|
|
30
|
+
!presentation.current() ||
|
|
31
|
+
images.get(image) !== presentation ||
|
|
32
|
+
!image.isLoaded)
|
|
33
|
+
throw new Error('Image presentation changed while preparing the effect.');
|
|
34
|
+
const previous = image.imageSource;
|
|
35
|
+
const raw = imageEffect(image, name, { ...rest, ...(destination ? { to: destination } : {}) });
|
|
36
|
+
const finished = raw.finished.then(async (success) => {
|
|
37
|
+
if (!success || !to || raw.progress !== 1)
|
|
38
|
+
return success;
|
|
39
|
+
if (!presentation.current() || images.get(image) !== presentation)
|
|
40
|
+
return false;
|
|
41
|
+
if (!live()) {
|
|
42
|
+
if (image.imageSource === destination)
|
|
43
|
+
image.imageSource = previous;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return presentation.commit(to, destination);
|
|
47
|
+
});
|
|
48
|
+
return new Proxy(raw, {
|
|
49
|
+
get(target, key) {
|
|
50
|
+
// Native animations are thenable; returning one from an async factory would await completion.
|
|
51
|
+
if (key === 'then')
|
|
52
|
+
return undefined;
|
|
53
|
+
if (key === 'finished')
|
|
54
|
+
return finished;
|
|
55
|
+
const value = Reflect.get(target, key, target);
|
|
56
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
57
|
+
},
|
|
58
|
+
set: (target, key, value) => Reflect.set(target, key, value, target),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=image-effects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-effects.js","sourceRoot":"","sources":["../../src/native/image-effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAMjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAMnD,MAAM,MAAM,GAAG,IAAI,OAAO,EAAuB,CAAA;AACjD,MAAM,YAAY,GAAG,IAAI,OAAO,EAAiB,CAAA;AACjD,MAAM,UAAU,mBAAmB,CAAC,MAAa,EAAE,YAA0B;IAC3E,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,OAAO,GAAG,EAAE;QACV,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,YAAY;YAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAChE,CAAC,CAAA;AACH,CAAC;AACD,MAAM,UAAU,iBAAiB,CAAC,MAAY;IAC5C,IAAI,CAAC,CAAC,MAAM,YAAY,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW;QAC1E,MAAM,IAAI,SAAS,CAAC,0DAA0D,CAAC,CAAA;IACjF,OAAO,MAAM,CAAA;AACf,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAY,EACZ,IAA2B,EAC3B,UAAoC,EAAE,EACtC,OAAsB,GAAG,EAAE,CAAC,IAAI;IAEhC,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC,EACrC,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAE,CAAA;IACnC,MAAM,EAAE,EAAE,EAAE,G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version":3,"file":"motion-region.d.ts","sourceRoot":"","sources":["../../src/native/motion-region.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAGvE,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,wCAAwC,CAAA;AAO/C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,QAI5E;AACD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,IAAI,QAEhF;AAyJD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,cAwG7E"}
|
|
@@ -3,6 +3,8 @@ import { animate, motionScope, reducedMotion, onReducedMotion } from '@rafaelaug
|
|
|
3
3
|
import { sharedLayout } from '@rafaelaugusto/jolt/shared-layout';
|
|
4
4
|
import { bindMotionRegion, } from '@getcortexlabs/mavis-core/experimental';
|
|
5
5
|
import { nativeScrollElement } from './scroll-motion.js';
|
|
6
|
+
import { nativeCollectionMotion } from './collection-motion.js';
|
|
7
|
+
import { nativePlatformMotion } from './platform-motion.js';
|
|
6
8
|
const targets = new WeakMap();
|
|
7
9
|
const regions = new WeakMap();
|
|
8
10
|
export function assertNativeRegion(adapter, target) {
|
|
@@ -84,8 +86,9 @@ function viewportEnter(container, surfaces, options) {
|
|
|
84
86
|
stop(state);
|
|
85
87
|
if (visible && !state.visible && !state.animation) {
|
|
86
88
|
const animation = animate(state.target, options.frames ?? { opacity: [0, 1], y: [20, 0] }, {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
...(options.transition?.type === 'gravity'
|
|
90
|
+
? options.transition
|
|
91
|
+
: { duration: 450, ...options.transition }),
|
|
89
92
|
delay: (options.transition?.delay ?? 0) + state.index * (options.stagger ?? 70),
|
|
90
93
|
});
|
|
91
94
|
state.animation = animation;
|
|
@@ -165,6 +168,8 @@ export function attachNativeMotionRegion(reference, target) {
|
|
|
165
168
|
? step
|
|
166
169
|
: [resolveChild(step[0]), step[1], step[2]]);
|
|
167
170
|
const adapter = {
|
|
171
|
+
...nativePlatformMotion(target, resolveChild, scope),
|
|
172
|
+
...nativeCollectionMotion(target, resolveChild, scope),
|
|
168
173
|
sequence: (items) => scope.sequence(steps(items)),
|
|
169
174
|
timeline: (items) => scope.timeline(steps(items)),
|
|
170
175
|
states(targets, definitions, options) {
|