@use-voltra/ios 2.0.0-rc.4 → 2.1.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.
- package/build/commonjs/index.js +13 -0
- package/build/commonjs/index.js.map +1 -1
- package/build/module/index.js +1 -0
- package/build/module/index.js.map +1 -1
- package/build/typescript/commonjs/index.d.ts +2 -0
- package/build/typescript/commonjs/index.d.ts.map +1 -1
- package/build/typescript/commonjs/jsx/props/Image.d.ts +2 -0
- package/build/typescript/commonjs/jsx/props/Image.d.ts.map +1 -1
- package/build/typescript/module/index.d.ts +2 -0
- package/build/typescript/module/index.d.ts.map +1 -1
- package/build/typescript/module/jsx/props/Image.d.ts +2 -0
- package/build/typescript/module/jsx/props/Image.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/index.ts +36 -0
- package/src/jsx/AreaMark.tsx +14 -0
- package/src/jsx/BarMark.tsx +17 -0
- package/src/jsx/Button.tsx +5 -0
- package/src/jsx/Chart.tsx +153 -0
- package/src/jsx/CircularProgressView.tsx +5 -0
- package/src/jsx/Divider.tsx +5 -0
- package/src/jsx/Gauge.tsx +5 -0
- package/src/jsx/GlassContainer.tsx +5 -0
- package/src/jsx/GroupBox.tsx +5 -0
- package/src/jsx/HStack.tsx +5 -0
- package/src/jsx/Image.tsx +22 -0
- package/src/jsx/Label.tsx +8 -0
- package/src/jsx/LineMark.tsx +16 -0
- package/src/jsx/LinearGradient.tsx +108 -0
- package/src/jsx/LinearProgressView.tsx +5 -0
- package/src/jsx/Link.tsx +5 -0
- package/src/jsx/Mask.tsx +5 -0
- package/src/jsx/PointMark.tsx +15 -0
- package/src/jsx/RuleMark.tsx +14 -0
- package/src/jsx/SectorMark.tsx +16 -0
- package/src/jsx/Spacer.tsx +5 -0
- package/src/jsx/Symbol.tsx +5 -0
- package/src/jsx/Text.tsx +10 -0
- package/src/jsx/Timer.tsx +8 -0
- package/src/jsx/Toggle.tsx +5 -0
- package/src/jsx/VStack.tsx +5 -0
- package/src/jsx/View.tsx +5 -0
- package/src/jsx/ZStack.tsx +5 -0
- package/src/jsx/baseProps.tsx +9 -0
- package/src/jsx/chart-types.ts +2 -0
- package/src/jsx/createVoltraComponent.ts +2 -0
- package/src/jsx/font.ts +45 -0
- package/src/jsx/index.ts +2 -0
- package/src/jsx/primitives.ts +29 -0
- package/src/jsx/props/.generated +15 -0
- package/src/jsx/props/Button.ts +10 -0
- package/src/jsx/props/Chart.ts +22 -0
- package/src/jsx/props/CircularProgressView.ts +30 -0
- package/src/jsx/props/Divider.ts +7 -0
- package/src/jsx/props/Gauge.ts +36 -0
- package/src/jsx/props/GlassContainer.ts +10 -0
- package/src/jsx/props/GroupBox.ts +12 -0
- package/src/jsx/props/HStack.ts +14 -0
- package/src/jsx/props/Image.ts +18 -0
- package/src/jsx/props/Label.ts +12 -0
- package/src/jsx/props/LinearGradient.ts +18 -0
- package/src/jsx/props/LinearProgressView.ts +34 -0
- package/src/jsx/props/Link.ts +10 -0
- package/src/jsx/props/Mask.ts +12 -0
- package/src/jsx/props/Spacer.ts +10 -0
- package/src/jsx/props/Symbol.ts +34 -0
- package/src/jsx/props/Text.ts +12 -0
- package/src/jsx/props/Timer.ts +22 -0
- package/src/jsx/props/Toggle.ts +10 -0
- package/src/jsx/props/VStack.ts +14 -0
- package/src/jsx/props/View.ts +7 -0
- package/src/jsx/props/ZStack.ts +10 -0
- package/src/live-activity/renderer.ts +85 -0
- package/src/live-activity/types.ts +72 -0
- package/src/payload/component-ids.ts +87 -0
- package/src/payload/short-names.ts +1 -0
- package/src/payload.ts +1 -0
- package/src/renderer/index.ts +6 -0
- package/src/renderer/renderer.ts +25 -0
- package/src/server.ts +36 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/types.ts +78 -0
- package/src/types.ts +42 -0
- package/src/widgets/renderer.ts +26 -0
- package/src/widgets/types.ts +49 -0
package/build/commonjs/index.js
CHANGED
|
@@ -28,6 +28,18 @@ Object.defineProperty(exports, "getComponentName", {
|
|
|
28
28
|
return _componentIds.getComponentName;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
Object.defineProperty(exports, "isAndroidEnv", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _core.isAndroidEnv;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "isIosEnv", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _core.isIosEnv;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
31
43
|
Object.defineProperty(exports, "renderLiveActivityToJson", {
|
|
32
44
|
enumerable: true,
|
|
33
45
|
get: function () {
|
|
@@ -64,5 +76,6 @@ var _componentIds = require("./payload/component-ids.js");
|
|
|
64
76
|
var _renderer = require("./live-activity/renderer.js");
|
|
65
77
|
var _index = require("./renderer/index.js");
|
|
66
78
|
var _renderer2 = require("./widgets/renderer.js");
|
|
79
|
+
var _core = require("@use-voltra/core");
|
|
67
80
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
68
81
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Voltra","_interopRequireWildcard","require","exports","_componentIds","_renderer","_index","_renderer2","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Voltra","_interopRequireWildcard","require","exports","_componentIds","_renderer","_index","_renderer2","_core","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA6CC,OAAA,CAAAH,MAAA,GAAAA,MAAA;AAG7C,IAAAI,aAAA,GAAAF,OAAA;AAMA,IAAAG,SAAA,GAAAH,OAAA;AAOA,IAAAI,MAAA,GAAAJ,OAAA;AAgBA,IAAAK,UAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AAAyD,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA","ignoreList":[]}
|
package/build/module/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export { getComponentId, getComponentName, COMPONENT_ID_TO_NAME, COMPONENT_NAME_
|
|
|
6
6
|
export { renderLiveActivityToJson, renderLiveActivityToString } from './live-activity/renderer.js';
|
|
7
7
|
export { renderVoltraVariantToJson } from './renderer/index.js';
|
|
8
8
|
export { renderWidgetToJson, renderWidgetToString } from './widgets/renderer.js';
|
|
9
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core';
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Voltra","getComponentId","getComponentName","COMPONENT_ID_TO_NAME","COMPONENT_NAME_TO_ID","renderLiveActivityToJson","renderLiveActivityToString","renderVoltraVariantToJson","renderWidgetToJson","renderWidgetToString"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,KAAKA,MAAM,MAAM,qBAAqB;AAE7C,SAASA,MAAM;AACf,SACEC,cAAc,EACdC,gBAAgB,EAChBC,oBAAoB,EACpBC,oBAAoB,QACf,4BAA4B;AACnC,SAASC,wBAAwB,EAAEC,0BAA0B,QAAQ,6BAA6B;AAOlG,SAASC,yBAAyB,QAAQ,qBAAqB;AAgB/D,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Voltra","getComponentId","getComponentName","COMPONENT_ID_TO_NAME","COMPONENT_NAME_TO_ID","renderLiveActivityToJson","renderLiveActivityToString","renderVoltraVariantToJson","renderWidgetToJson","renderWidgetToString","isAndroidEnv","isIosEnv"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,KAAKA,MAAM,MAAM,qBAAqB;AAE7C,SAASA,MAAM;AACf,SACEC,cAAc,EACdC,gBAAgB,EAChBC,oBAAoB,EACpBC,oBAAoB,QACf,4BAA4B;AACnC,SAASC,wBAAwB,EAAEC,0BAA0B,QAAQ,6BAA6B;AAOlG,SAASC,yBAAyB,QAAQ,qBAAqB;AAgB/D,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,uBAAuB;AAEhF,SAASC,YAAY,EAAEC,QAAQ,QAAQ,kBAAkB","ignoreList":[]}
|
|
@@ -8,4 +8,6 @@ export type { VoltraStyleProp, VoltraTextStyle, VoltraTextStyleProp, VoltraViewS
|
|
|
8
8
|
export type { EventSubscription, PreloadImageFailure, PreloadImageOptions, PreloadImageSvgOptions, PreloadImageUrlOptions, PreloadImagesResult, UpdateWidgetOptions, VoltraElementJson, VoltraElementRef, VoltraNodeJson, VoltraPropValue, WidgetServerCredentials, } from './types.js';
|
|
9
9
|
export { renderWidgetToJson, renderWidgetToString } from './widgets/renderer.js';
|
|
10
10
|
export type { ScheduledWidgetEntry, WidgetFamily, WidgetInfo, WidgetVariants } from './widgets/types.js';
|
|
11
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core';
|
|
12
|
+
export type { WidgetBuildEnvironment, WidgetEnvironment } from '@use-voltra/core';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAClG,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC/G,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAChF,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAClG,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC/G,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAChF,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxG,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -5,6 +5,8 @@ export type ImageProps = VoltraBaseProps & {
|
|
|
5
5
|
source?: Record<string, any>;
|
|
6
6
|
/** How the image should be resized to fit its container */
|
|
7
7
|
resizeMode?: 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';
|
|
8
|
+
/** iOS 18+ Home Screen widgets only. Controls how the image is rendered when the widget is in an accented (tinted) or vibrant rendering mode. Use 'fullColor' to opt the image out of the system's desaturation so it keeps its original colors on top of the tinted backdrop. No-op outside of accented/vibrant rendering modes. */
|
|
9
|
+
accentedRenderingMode?: 'fullColor' | 'accented' | 'accentedDesaturated' | 'desaturated';
|
|
8
10
|
/** Custom fallback content rendered when the image is missing */
|
|
9
11
|
fallback?: ReactNode;
|
|
10
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../../src/jsx/props/Image.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACzC,2HAA2H;IAC3H,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAClE,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../../src/jsx/props/Image.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACzC,2HAA2H;IAC3H,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAClE,qUAAqU;IACrU,qBAAqB,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,qBAAqB,GAAG,aAAa,CAAA;IACxF,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
|
@@ -8,4 +8,6 @@ export type { VoltraStyleProp, VoltraTextStyle, VoltraTextStyleProp, VoltraViewS
|
|
|
8
8
|
export type { EventSubscription, PreloadImageFailure, PreloadImageOptions, PreloadImageSvgOptions, PreloadImageUrlOptions, PreloadImagesResult, UpdateWidgetOptions, VoltraElementJson, VoltraElementRef, VoltraNodeJson, VoltraPropValue, WidgetServerCredentials, } from './types.js';
|
|
9
9
|
export { renderWidgetToJson, renderWidgetToString } from './widgets/renderer.js';
|
|
10
10
|
export type { ScheduledWidgetEntry, WidgetFamily, WidgetInfo, WidgetVariants } from './widgets/types.js';
|
|
11
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core';
|
|
12
|
+
export type { WidgetBuildEnvironment, WidgetEnvironment } from '@use-voltra/core';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAClG,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC/G,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAChF,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAClG,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC/G,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAChF,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxG,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -5,6 +5,8 @@ export type ImageProps = VoltraBaseProps & {
|
|
|
5
5
|
source?: Record<string, any>;
|
|
6
6
|
/** How the image should be resized to fit its container */
|
|
7
7
|
resizeMode?: 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';
|
|
8
|
+
/** iOS 18+ Home Screen widgets only. Controls how the image is rendered when the widget is in an accented (tinted) or vibrant rendering mode. Use 'fullColor' to opt the image out of the system's desaturation so it keeps its original colors on top of the tinted backdrop. No-op outside of accented/vibrant rendering modes. */
|
|
9
|
+
accentedRenderingMode?: 'fullColor' | 'accented' | 'accentedDesaturated' | 'desaturated';
|
|
8
10
|
/** Custom fallback content rendered when the image is missing */
|
|
9
11
|
fallback?: ReactNode;
|
|
10
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../../src/jsx/props/Image.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACzC,2HAA2H;IAC3H,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAClE,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../../src/jsx/props/Image.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACzC,2HAA2H;IAC3H,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAClE,qUAAqU;IACrU,qBAAqB,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,qBAAqB,GAAG,aAAa,CAAA;IACxF,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@use-voltra/ios",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Voltra for iOS",
|
|
5
5
|
"main": "build/commonjs/index.js",
|
|
6
6
|
"module": "build/module/index.js",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"build",
|
|
37
|
+
"src",
|
|
37
38
|
"README.md"
|
|
38
39
|
],
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@use-voltra/core": "^2.
|
|
41
|
+
"@use-voltra/core": "^2.1.0"
|
|
41
42
|
},
|
|
42
43
|
"keywords": [
|
|
43
44
|
"react-native",
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as Voltra from './jsx/primitives.js'
|
|
2
|
+
|
|
3
|
+
export { Voltra }
|
|
4
|
+
export {
|
|
5
|
+
getComponentId,
|
|
6
|
+
getComponentName,
|
|
7
|
+
COMPONENT_ID_TO_NAME,
|
|
8
|
+
COMPONENT_NAME_TO_ID,
|
|
9
|
+
} from './payload/component-ids.js'
|
|
10
|
+
export { renderLiveActivityToJson, renderLiveActivityToString } from './live-activity/renderer.js'
|
|
11
|
+
export type {
|
|
12
|
+
DismissalPolicy,
|
|
13
|
+
LiveActivityJson,
|
|
14
|
+
LiveActivityVariants,
|
|
15
|
+
LiveActivityVariantsJson,
|
|
16
|
+
} from './live-activity/types.js'
|
|
17
|
+
export { renderVoltraVariantToJson } from './renderer/index.js'
|
|
18
|
+
export type { VoltraStyleProp, VoltraTextStyle, VoltraTextStyleProp, VoltraViewStyle } from './styles/index.js'
|
|
19
|
+
export type {
|
|
20
|
+
EventSubscription,
|
|
21
|
+
PreloadImageFailure,
|
|
22
|
+
PreloadImageOptions,
|
|
23
|
+
PreloadImageSvgOptions,
|
|
24
|
+
PreloadImageUrlOptions,
|
|
25
|
+
PreloadImagesResult,
|
|
26
|
+
UpdateWidgetOptions,
|
|
27
|
+
VoltraElementJson,
|
|
28
|
+
VoltraElementRef,
|
|
29
|
+
VoltraNodeJson,
|
|
30
|
+
VoltraPropValue,
|
|
31
|
+
WidgetServerCredentials,
|
|
32
|
+
} from './types.js'
|
|
33
|
+
export { renderWidgetToJson, renderWidgetToString } from './widgets/renderer.js'
|
|
34
|
+
export type { ScheduledWidgetEntry, WidgetFamily, WidgetInfo, WidgetVariants } from './widgets/types.js'
|
|
35
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core'
|
|
36
|
+
export type { WidgetBuildEnvironment, WidgetEnvironment } from '@use-voltra/core'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
4
|
+
import type { ChartDataPoint } from './chart-types.js'
|
|
5
|
+
|
|
6
|
+
export type AreaMarkProps = {
|
|
7
|
+
data: ChartDataPoint[]
|
|
8
|
+
color?: string
|
|
9
|
+
interpolation?: 'linear' | 'monotone' | 'stepStart' | 'stepEnd' | 'stepCenter' | 'cardinal' | 'catmullRom'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const AreaMark = (props: AreaMarkProps) => createElement('VoltraAreaMark', props as any)
|
|
13
|
+
AreaMark.displayName = 'AreaMark'
|
|
14
|
+
AreaMark[VOLTRA_MARK_TAG] = 'area' as const
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { ChartDataPoint } from './chart-types.js'
|
|
4
|
+
|
|
5
|
+
export const VOLTRA_MARK_TAG = Symbol.for('VOLTRA_MARK_TAG')
|
|
6
|
+
|
|
7
|
+
export type BarMarkProps = {
|
|
8
|
+
data: ChartDataPoint[]
|
|
9
|
+
color?: string
|
|
10
|
+
stacking?: 'grouped'
|
|
11
|
+
cornerRadius?: number
|
|
12
|
+
width?: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const BarMark = (props: BarMarkProps) => createElement('VoltraBarMark', props as any)
|
|
16
|
+
BarMark.displayName = 'BarMark'
|
|
17
|
+
BarMark[VOLTRA_MARK_TAG] = 'bar' as const
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import type { AreaMarkProps } from './AreaMark.js'
|
|
4
|
+
import type { BarMarkProps } from './BarMark.js'
|
|
5
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
6
|
+
import type { ChartDataPoint, SectorDataPoint } from './chart-types.js'
|
|
7
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
8
|
+
import type { LineMarkProps } from './LineMark.js'
|
|
9
|
+
import type { PointMarkProps } from './PointMark.js'
|
|
10
|
+
import type { ChartProps as GeneratedChartProps } from './props/Chart.js'
|
|
11
|
+
import type { RuleMarkProps } from './RuleMark.js'
|
|
12
|
+
import type { SectorMarkProps } from './SectorMark.js'
|
|
13
|
+
|
|
14
|
+
// ---- user-facing prop types ----
|
|
15
|
+
|
|
16
|
+
type AxisGridStyle = {
|
|
17
|
+
visible?: boolean
|
|
18
|
+
color?: string
|
|
19
|
+
lineWidth?: number
|
|
20
|
+
dash?: number[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ChartProps = Omit<
|
|
24
|
+
GeneratedChartProps,
|
|
25
|
+
'marks' | 'foregroundStyleScale' | 'xAxisGridStyle' | 'yAxisGridStyle' | 'style'
|
|
26
|
+
> & {
|
|
27
|
+
children?: React.ReactNode
|
|
28
|
+
foregroundStyleScale?: Record<string, string>
|
|
29
|
+
xAxisGridStyle?: AxisGridStyle
|
|
30
|
+
yAxisGridStyle?: AxisGridStyle
|
|
31
|
+
style?: GeneratedChartProps['style'] & { color?: string }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ---- wire encoding helpers ----
|
|
35
|
+
|
|
36
|
+
type CompactDataPoint = [string | number, number] | [string | number, number, string]
|
|
37
|
+
type CompactSectorPoint = [number, string]
|
|
38
|
+
type MarkWire = [string, CompactDataPoint[] | CompactSectorPoint[] | null, Record<string, unknown>]
|
|
39
|
+
|
|
40
|
+
const encodeDataPoints = (data: ChartDataPoint[]): CompactDataPoint[] =>
|
|
41
|
+
data.map((pt) => (pt.series != null ? [pt.x, pt.y, pt.series] : [pt.x, pt.y]))
|
|
42
|
+
|
|
43
|
+
const encodeSectorPoints = (data: SectorDataPoint[]): CompactSectorPoint[] => data.map((pt) => [pt.value, pt.category])
|
|
44
|
+
|
|
45
|
+
const encodeAxisGridStyle = (style: AxisGridStyle): Record<string, unknown> => {
|
|
46
|
+
const encoded: Record<string, unknown> = {}
|
|
47
|
+
if (style.visible != null) encoded.v = style.visible
|
|
48
|
+
if (style.color != null) encoded.c = style.color
|
|
49
|
+
if (style.lineWidth != null) encoded.lw = style.lineWidth
|
|
50
|
+
if (style.dash != null) encoded.d = style.dash
|
|
51
|
+
return encoded
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const encodeBarMark = (props: BarMarkProps): MarkWire => {
|
|
55
|
+
const p: Record<string, unknown> = {}
|
|
56
|
+
if (props.color != null) p.c = props.color
|
|
57
|
+
if (props.stacking === 'grouped') p.stk = props.stacking
|
|
58
|
+
if (props.cornerRadius != null) p.cr = props.cornerRadius
|
|
59
|
+
if (props.width != null) p.w = props.width
|
|
60
|
+
return ['bar', encodeDataPoints(props.data), p]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const encodeLineMark = (props: LineMarkProps): MarkWire => {
|
|
64
|
+
const p: Record<string, unknown> = {}
|
|
65
|
+
if (props.color != null) p.c = props.color
|
|
66
|
+
if (props.interpolation != null) p.itp = props.interpolation
|
|
67
|
+
if (props.lineWidth != null) p.lw = props.lineWidth
|
|
68
|
+
if (props.symbol != null) p.sym = props.symbol
|
|
69
|
+
return ['line', encodeDataPoints(props.data), p]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const encodeAreaMark = (props: AreaMarkProps): MarkWire => {
|
|
73
|
+
const p: Record<string, unknown> = {}
|
|
74
|
+
if (props.color != null) p.c = props.color
|
|
75
|
+
if (props.interpolation != null) p.itp = props.interpolation
|
|
76
|
+
return ['area', encodeDataPoints(props.data), p]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const encodePointMark = (props: PointMarkProps): MarkWire => {
|
|
80
|
+
const p: Record<string, unknown> = {}
|
|
81
|
+
if (props.color != null) p.c = props.color
|
|
82
|
+
if (props.symbol != null) p.sym = props.symbol
|
|
83
|
+
if (props.symbolSize != null) p.syms = props.symbolSize
|
|
84
|
+
return ['point', encodeDataPoints(props.data), p]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const encodeRuleMark = (props: RuleMarkProps): MarkWire => {
|
|
88
|
+
const p: Record<string, unknown> = {}
|
|
89
|
+
if (props.color != null) p.c = props.color
|
|
90
|
+
if (props.lineWidth != null) p.lw = props.lineWidth
|
|
91
|
+
if (props.xValue != null) p.xv = props.xValue
|
|
92
|
+
if (props.yValue != null) p.yv = props.yValue
|
|
93
|
+
return ['rule', null, p]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const encodeSectorMark = (props: SectorMarkProps): MarkWire => {
|
|
97
|
+
const p: Record<string, unknown> = {}
|
|
98
|
+
if (props.color != null) p.c = props.color
|
|
99
|
+
if (props.innerRadius != null) p.ir = props.innerRadius
|
|
100
|
+
if (props.outerRadius != null) p.or = props.outerRadius
|
|
101
|
+
if (props.angularInset != null) p.agin = props.angularInset
|
|
102
|
+
return ['sector', encodeSectorPoints(props.data), p]
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const ENCODERS: Record<string, (props: any) => MarkWire> = {
|
|
106
|
+
bar: encodeBarMark,
|
|
107
|
+
line: encodeLineMark,
|
|
108
|
+
area: encodeAreaMark,
|
|
109
|
+
point: encodePointMark,
|
|
110
|
+
rule: encodeRuleMark,
|
|
111
|
+
sector: encodeSectorMark,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ---- component ----
|
|
115
|
+
|
|
116
|
+
export const Chart = createVoltraComponent<ChartProps>('Chart', {
|
|
117
|
+
toJSON: (props) => {
|
|
118
|
+
const {
|
|
119
|
+
children,
|
|
120
|
+
foregroundStyleScale,
|
|
121
|
+
xAxisGridStyle,
|
|
122
|
+
yAxisGridStyle,
|
|
123
|
+
chartScrollableAxes: _chartScrollableAxes,
|
|
124
|
+
...rest
|
|
125
|
+
} = props as ChartProps & { chartScrollableAxes?: unknown }
|
|
126
|
+
|
|
127
|
+
// Flatten mark children into a compact JSON string
|
|
128
|
+
const marks: MarkWire[] = []
|
|
129
|
+
|
|
130
|
+
React.Children.forEach(children, (child) => {
|
|
131
|
+
if (!React.isValidElement(child)) return
|
|
132
|
+
const type = child.type as any
|
|
133
|
+
const markType: string | undefined = type[VOLTRA_MARK_TAG]
|
|
134
|
+
if (!markType) return
|
|
135
|
+
const encoder = ENCODERS[markType]
|
|
136
|
+
if (encoder) marks.push(encoder(child.props as any))
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
const result: Record<string, unknown> = { ...rest }
|
|
140
|
+
if (marks.length > 0) result.marks = JSON.stringify(marks)
|
|
141
|
+
if (foregroundStyleScale != null) {
|
|
142
|
+
result.foregroundStyleScale = JSON.stringify(Object.entries(foregroundStyleScale))
|
|
143
|
+
}
|
|
144
|
+
if (xAxisGridStyle != null) {
|
|
145
|
+
result.xAxisGridStyle = JSON.stringify(encodeAxisGridStyle(xAxisGridStyle))
|
|
146
|
+
}
|
|
147
|
+
if (yAxisGridStyle != null) {
|
|
148
|
+
result.yAxisGridStyle = JSON.stringify(encodeAxisGridStyle(yAxisGridStyle))
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return result
|
|
152
|
+
},
|
|
153
|
+
})
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { CircularProgressViewProps } from './props/CircularProgressView.js'
|
|
3
|
+
|
|
4
|
+
export type { CircularProgressViewProps }
|
|
5
|
+
export const CircularProgressView = createVoltraComponent<CircularProgressViewProps>('CircularProgressView')
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { ImageProps as SwiftImageProps } from './props/Image.js'
|
|
3
|
+
|
|
4
|
+
export type ImageAssetSource = { assetName: string }
|
|
5
|
+
export type ImageBase64Source = { base64: string }
|
|
6
|
+
export type ImageSource = ImageAssetSource | ImageBase64Source
|
|
7
|
+
|
|
8
|
+
export type ImageProps = Omit<SwiftImageProps, 'source'> & {
|
|
9
|
+
source?: ImageSource
|
|
10
|
+
resizeMode?: 'cover' | 'contain' | 'stretch' | 'repeat' | 'center'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Image = createVoltraComponent<ImageProps>('Image', {
|
|
14
|
+
toJSON: (props) => {
|
|
15
|
+
const { source, ...rest } = props
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
...rest,
|
|
19
|
+
...(source ? { source: JSON.stringify(source) } : {}),
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VoltraTextStyleProp } from '../styles/types.js'
|
|
2
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
3
|
+
import type { LabelProps as SwiftLabelProps } from './props/Label.js'
|
|
4
|
+
|
|
5
|
+
export type LabelProps = Omit<SwiftLabelProps, 'style'> & {
|
|
6
|
+
style?: VoltraTextStyleProp
|
|
7
|
+
}
|
|
8
|
+
export const Label = createVoltraComponent<LabelProps>('Label')
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
4
|
+
import type { ChartDataPoint } from './chart-types.js'
|
|
5
|
+
|
|
6
|
+
export type LineMarkProps = {
|
|
7
|
+
data: ChartDataPoint[]
|
|
8
|
+
color?: string
|
|
9
|
+
interpolation?: 'linear' | 'monotone' | 'stepStart' | 'stepEnd' | 'stepCenter' | 'cardinal' | 'catmullRom'
|
|
10
|
+
lineWidth?: number
|
|
11
|
+
symbol?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const LineMark = (props: LineMarkProps) => createElement('VoltraLineMark', props as any)
|
|
15
|
+
LineMark.displayName = 'LineMark'
|
|
16
|
+
LineMark[VOLTRA_MARK_TAG] = 'line' as const
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { LinearGradientProps as SwiftLinearGradientProps } from './props/LinearGradient.js'
|
|
3
|
+
|
|
4
|
+
// Helper function to convert point to string
|
|
5
|
+
const convertPointToString = (point: LinearGradientProps['start'] | LinearGradientProps['end']): string | null => {
|
|
6
|
+
if (!point) return null
|
|
7
|
+
if (typeof point === 'string') return point
|
|
8
|
+
if (Array.isArray(point) && point.length === 2) {
|
|
9
|
+
const [x, y] = point
|
|
10
|
+
if (typeof x === 'number' && typeof y === 'number') {
|
|
11
|
+
// Convert coordinate to closest predefined point
|
|
12
|
+
if (x === 0 && y === 0) return 'topLeading'
|
|
13
|
+
if (x === 0.5 && y === 0) return 'top'
|
|
14
|
+
if (x === 1 && y === 0) return 'topTrailing'
|
|
15
|
+
if (x === 0 && y === 0.5) return 'leading'
|
|
16
|
+
if (x === 0.5 && y === 0.5) return 'center'
|
|
17
|
+
if (x === 1 && y === 0.5) return 'trailing'
|
|
18
|
+
if (x === 0 && y === 1) return 'bottomLeading'
|
|
19
|
+
if (x === 0.5 && y === 1) return 'bottom'
|
|
20
|
+
if (x === 1 && y === 1) return 'bottomTrailing'
|
|
21
|
+
// For custom coordinates, encode as "x,y"
|
|
22
|
+
return `${x},${y}`
|
|
23
|
+
}
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
26
|
+
if (typeof point === 'object' && point.x != null && point.y != null) {
|
|
27
|
+
const x = typeof point.x === 'number' ? point.x : Number(point.x)
|
|
28
|
+
const y = typeof point.y === 'number' ? point.y : Number(point.y)
|
|
29
|
+
if (!Number.isNaN(x) && !Number.isNaN(y)) {
|
|
30
|
+
// Convert coordinate to closest predefined point
|
|
31
|
+
if (x === 0 && y === 0) return 'topLeading'
|
|
32
|
+
if (x === 0.5 && y === 0) return 'top'
|
|
33
|
+
if (x === 1 && y === 0) return 'topTrailing'
|
|
34
|
+
if (x === 0 && y === 0.5) return 'leading'
|
|
35
|
+
if (x === 0.5 && y === 0.5) return 'center'
|
|
36
|
+
if (x === 1 && y === 0.5) return 'trailing'
|
|
37
|
+
if (x === 0 && y === 1) return 'bottomLeading'
|
|
38
|
+
if (x === 0.5 && y === 1) return 'bottom'
|
|
39
|
+
if (x === 1 && y === 1) return 'bottomTrailing'
|
|
40
|
+
// For custom coordinates, encode as "x,y"
|
|
41
|
+
return `${x},${y}`
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type LinearGradientProps = Omit<SwiftLinearGradientProps, 'colors' | 'locations' | 'start' | 'end'> & {
|
|
48
|
+
// Array of colors that represent stops in the gradient (at least 2 required)
|
|
49
|
+
colors: readonly [string, string, ...string[]]
|
|
50
|
+
// Optional array of numbers (0-1) indicating color-stop locations
|
|
51
|
+
locations?: readonly number[] | null
|
|
52
|
+
// Start point of the gradient as {x, y} coordinates (0-1) or predefined string
|
|
53
|
+
start?:
|
|
54
|
+
| { x: number; y: number }
|
|
55
|
+
| [number, number]
|
|
56
|
+
| 'top'
|
|
57
|
+
| 'bottom'
|
|
58
|
+
| 'leading'
|
|
59
|
+
| 'trailing'
|
|
60
|
+
| 'topLeading'
|
|
61
|
+
| 'topTrailing'
|
|
62
|
+
| 'bottomLeading'
|
|
63
|
+
| 'bottomTrailing'
|
|
64
|
+
| 'center'
|
|
65
|
+
| null
|
|
66
|
+
// End point of the gradient as {x, y} coordinates (0-1) or predefined string
|
|
67
|
+
end?:
|
|
68
|
+
| { x: number; y: number }
|
|
69
|
+
| [number, number]
|
|
70
|
+
| 'top'
|
|
71
|
+
| 'bottom'
|
|
72
|
+
| 'leading'
|
|
73
|
+
| 'trailing'
|
|
74
|
+
| 'topLeading'
|
|
75
|
+
| 'topTrailing'
|
|
76
|
+
| 'bottomLeading'
|
|
77
|
+
| 'bottomTrailing'
|
|
78
|
+
| 'center'
|
|
79
|
+
| null
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const LinearGradient = createVoltraComponent<LinearGradientProps>('LinearGradient', {
|
|
83
|
+
toJSON: ({ colors, locations, start, end, ...otherProps }) => {
|
|
84
|
+
const updatedProps: SwiftLinearGradientProps = { ...otherProps }
|
|
85
|
+
|
|
86
|
+
// Handle colors array (required in Expo API)
|
|
87
|
+
if (Array.isArray(colors)) {
|
|
88
|
+
updatedProps.colors = colors.join('|')
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Handle locations array (Expo API)
|
|
92
|
+
if (Array.isArray(locations)) {
|
|
93
|
+
// Convert locations to stops format for iOS compatibility
|
|
94
|
+
const stops = colors.map((color: any, index: number) => `${String(color)}@${locations[index]}`)
|
|
95
|
+
updatedProps.stops = stops.join('|')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Handle start point (Expo API)
|
|
99
|
+
const startPoint = convertPointToString(start)
|
|
100
|
+
if (startPoint) updatedProps.startPoint = startPoint
|
|
101
|
+
|
|
102
|
+
// Handle end point (Expo API)
|
|
103
|
+
const endPoint = convertPointToString(end)
|
|
104
|
+
if (endPoint) updatedProps.endPoint = endPoint
|
|
105
|
+
|
|
106
|
+
return updatedProps
|
|
107
|
+
},
|
|
108
|
+
})
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { LinearProgressViewProps } from './props/LinearProgressView.js'
|
|
3
|
+
|
|
4
|
+
export type { LinearProgressViewProps }
|
|
5
|
+
export const LinearProgressView = createVoltraComponent<LinearProgressViewProps>('LinearProgressView')
|
package/src/jsx/Link.tsx
ADDED
package/src/jsx/Mask.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
4
|
+
import type { ChartDataPoint } from './chart-types.js'
|
|
5
|
+
|
|
6
|
+
export type PointMarkProps = {
|
|
7
|
+
data: ChartDataPoint[]
|
|
8
|
+
color?: string
|
|
9
|
+
symbol?: string
|
|
10
|
+
symbolSize?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PointMark = (props: PointMarkProps) => createElement('VoltraPointMark', props as any)
|
|
14
|
+
PointMark.displayName = 'PointMark'
|
|
15
|
+
PointMark[VOLTRA_MARK_TAG] = 'point' as const
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
4
|
+
|
|
5
|
+
export type RuleMarkProps = {
|
|
6
|
+
xValue?: string | number
|
|
7
|
+
yValue?: number
|
|
8
|
+
color?: string
|
|
9
|
+
lineWidth?: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const RuleMark = (props: RuleMarkProps) => createElement('VoltraRuleMark', props as any)
|
|
13
|
+
RuleMark.displayName = 'RuleMark'
|
|
14
|
+
RuleMark[VOLTRA_MARK_TAG] = 'rule' as const
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
4
|
+
import type { SectorDataPoint } from './chart-types.js'
|
|
5
|
+
|
|
6
|
+
export type SectorMarkProps = {
|
|
7
|
+
data: SectorDataPoint[]
|
|
8
|
+
color?: string
|
|
9
|
+
innerRadius?: number
|
|
10
|
+
outerRadius?: number
|
|
11
|
+
angularInset?: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SectorMark = (props: SectorMarkProps) => createElement('VoltraSectorMark', props as any)
|
|
15
|
+
SectorMark.displayName = 'SectorMark'
|
|
16
|
+
SectorMark[VOLTRA_MARK_TAG] = 'sector' as const
|