@use-voltra/android 2.0.0 → 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 +20 -0
- package/build/commonjs/index.js.map +1 -1
- package/build/module/index.js +6 -0
- package/build/module/index.js.map +1 -1
- package/build/typescript/commonjs/index.d.ts +3 -0
- package/build/typescript/commonjs/index.d.ts.map +1 -1
- package/build/typescript/module/index.d.ts +3 -0
- package/build/typescript/module/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/dynamic-colors.ts +33 -0
- package/src/index.ts +99 -0
- package/src/internal.ts +2 -0
- package/src/jsx/AreaMark.tsx +16 -0
- package/src/jsx/BarMark.tsx +18 -0
- package/src/jsx/Box.tsx +5 -0
- package/src/jsx/Button.tsx +5 -0
- package/src/jsx/Chart.tsx +123 -0
- package/src/jsx/CheckBox.tsx +5 -0
- package/src/jsx/CircleIconButton.tsx +14 -0
- package/src/jsx/CircularProgressIndicator.tsx +7 -0
- package/src/jsx/Column.tsx +5 -0
- package/src/jsx/FilledButton.tsx +14 -0
- package/src/jsx/Image.tsx +21 -0
- package/src/jsx/LazyColumn.tsx +5 -0
- package/src/jsx/LazyVerticalGrid.tsx +45 -0
- package/src/jsx/LineMark.tsx +17 -0
- package/src/jsx/LinearProgressIndicator.tsx +7 -0
- package/src/jsx/OutlineButton.tsx +14 -0
- package/src/jsx/PointMark.tsx +16 -0
- package/src/jsx/RadioButton.tsx +5 -0
- package/src/jsx/Row.tsx +5 -0
- package/src/jsx/RuleMark.tsx +15 -0
- package/src/jsx/Scaffold.tsx +5 -0
- package/src/jsx/SectorMark.tsx +17 -0
- package/src/jsx/Spacer.tsx +5 -0
- package/src/jsx/SquareIconButton.tsx +14 -0
- package/src/jsx/Switch.tsx +5 -0
- package/src/jsx/Text.tsx +10 -0
- package/src/jsx/TitleBar.tsx +18 -0
- package/src/jsx/baseProps.tsx +13 -0
- package/src/jsx/chart-types.ts +2 -0
- package/src/jsx/createVoltraComponent.ts +2 -0
- package/src/jsx/index.ts +1 -0
- package/src/jsx/primitives.ts +28 -0
- package/src/jsx/props/.generated +15 -0
- package/src/jsx/props/AndroidBox.ts +19 -0
- package/src/jsx/props/AndroidButton.ts +10 -0
- package/src/jsx/props/AndroidChart.ts +20 -0
- package/src/jsx/props/AndroidCheckBox.ts +20 -0
- package/src/jsx/props/AndroidCircleIconButton.ts +18 -0
- package/src/jsx/props/AndroidCircularProgressIndicator.ts +10 -0
- package/src/jsx/props/AndroidColumn.ts +12 -0
- package/src/jsx/props/AndroidFilledButton.ts +20 -0
- package/src/jsx/props/AndroidImage.ts +26 -0
- package/src/jsx/props/AndroidLazyColumn.ts +10 -0
- package/src/jsx/props/AndroidLazyVerticalGrid.ts +12 -0
- package/src/jsx/props/AndroidLinearProgressIndicator.ts +14 -0
- package/src/jsx/props/AndroidOutlineButton.ts +18 -0
- package/src/jsx/props/AndroidRadioButton.ts +22 -0
- package/src/jsx/props/AndroidRow.ts +12 -0
- package/src/jsx/props/AndroidScaffold.ts +12 -0
- package/src/jsx/props/AndroidSpacer.ts +7 -0
- package/src/jsx/props/AndroidSquareIconButton.ts +18 -0
- package/src/jsx/props/AndroidSwitch.ts +24 -0
- package/src/jsx/props/AndroidText.ts +14 -0
- package/src/jsx/props/AndroidTitleBar.ts +18 -0
- package/src/live-update/renderer.ts +36 -0
- package/src/live-update/types.ts +44 -0
- package/src/ongoing-notification/components.tsx +49 -0
- package/src/ongoing-notification/renderer.ts +360 -0
- package/src/ongoing-notification/types.ts +199 -0
- package/src/payload/component-ids.ts +89 -0
- package/src/preload-utils.ts +78 -0
- package/src/renderer/index.ts +6 -0
- package/src/renderer/renderer.ts +25 -0
- package/src/server.ts +19 -0
- package/src/styles/types.ts +114 -0
- package/src/types.ts +38 -0
- package/src/utils/index.ts +0 -0
- package/src/widgets/renderer.ts +90 -0
- package/src/widgets/types.ts +62 -0
package/build/commonjs/index.js
CHANGED
|
@@ -40,6 +40,18 @@ Object.defineProperty(exports, "getAndroidComponentName", {
|
|
|
40
40
|
return _componentIds.getAndroidComponentName;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
+
Object.defineProperty(exports, "isAndroidEnv", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _core.isAndroidEnv;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "isIosEnv", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _core.isIosEnv;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
43
55
|
Object.defineProperty(exports, "renderAndroidLiveUpdateToJson", {
|
|
44
56
|
enumerable: true,
|
|
45
57
|
get: function () {
|
|
@@ -58,6 +70,12 @@ Object.defineProperty(exports, "renderAndroidOngoingNotificationPayload", {
|
|
|
58
70
|
return _renderer2.renderAndroidOngoingNotificationPayload;
|
|
59
71
|
}
|
|
60
72
|
});
|
|
73
|
+
Object.defineProperty(exports, "renderAndroidVariantToJson", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _index.renderAndroidVariantToJson;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
61
79
|
Object.defineProperty(exports, "renderAndroidViewToJson", {
|
|
62
80
|
enumerable: true,
|
|
63
81
|
get: function () {
|
|
@@ -84,5 +102,7 @@ var _renderer = require("./live-update/renderer.js");
|
|
|
84
102
|
var _components = require("./ongoing-notification/components.js");
|
|
85
103
|
var _renderer2 = require("./ongoing-notification/renderer.js");
|
|
86
104
|
var _renderer3 = require("./widgets/renderer.js");
|
|
105
|
+
var _index = require("./renderer/index.js");
|
|
106
|
+
var _core = require("@use-voltra/core");
|
|
87
107
|
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); }
|
|
88
108
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VoltraAndroid","_interopRequireWildcard","require","exports","_dynamicColors","_componentIds","_renderer","_components","_renderer2","_renderer3","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":["VoltraAndroid","_interopRequireWildcard","require","exports","_dynamicColors","_componentIds","_renderer","_components","_renderer2","_renderer3","_index","_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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAoDC,OAAA,CAAAH,aAAA,GAAAA,aAAA;AAGpD,IAAAI,cAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAMA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAR,OAAA;AA+EA,IAAAS,KAAA,GAAAT,OAAA;AAAyD,SAAAD,wBAAAW,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAb,uBAAA,YAAAA,CAAAW,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
|
@@ -9,8 +9,14 @@ export { renderAndroidLiveUpdateToJson, renderAndroidLiveUpdateToString } from '
|
|
|
9
9
|
export { AndroidOngoingNotification } from './ongoing-notification/components.js';
|
|
10
10
|
export { renderAndroidOngoingNotificationPayload } from './ongoing-notification/renderer.js';
|
|
11
11
|
export { renderAndroidViewToJson, renderAndroidWidgetToJson, renderAndroidWidgetToString } from './widgets/renderer.js';
|
|
12
|
+
// Single-node renderer used by Dynamic Widgets (on-device Hermes render). Analog of
|
|
13
|
+
// iOS `renderVoltraVariantToJson`. Invoked with `(props, env)` per render via the generated
|
|
14
|
+
// widget entry.
|
|
15
|
+
export { renderAndroidVariantToJson } from './renderer/index.js';
|
|
12
16
|
|
|
13
17
|
// Android types
|
|
14
18
|
|
|
15
19
|
// Component prop types
|
|
20
|
+
|
|
21
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core';
|
|
16
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VoltraAndroid","AndroidDynamicColors","getAndroidComponentId","getAndroidComponentName","ANDROID_COMPONENT_ID_TO_NAME","ANDROID_COMPONENT_NAME_TO_ID","renderAndroidLiveUpdateToJson","renderAndroidLiveUpdateToString","AndroidOngoingNotification","renderAndroidOngoingNotificationPayload","renderAndroidViewToJson","renderAndroidWidgetToJson","renderAndroidWidgetToString"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,OAAO,KAAKA,aAAa,MAAM,qBAAqB;AAEpD,SAASA,aAAa;AACtB,SAASC,oBAAoB,QAAQ,qBAAqB;AAC1D,SACEC,qBAAqB,EACrBC,uBAAuB,EACvBC,4BAA4B,EAC5BC,4BAA4B,QACvB,4BAA4B;AACnC,SAASC,6BAA6B,EAAEC,+BAA+B,QAAQ,2BAA2B;AAC1G,SAASC,0BAA0B,QAAQ,sCAAsC;AACjF,SAASC,uCAAuC,QAAQ,oCAAoC;AAC5F,SAASC,uBAAuB,EAAEC,yBAAyB,EAAEC,2BAA2B,QAAQ,uBAAuB;;
|
|
1
|
+
{"version":3,"names":["VoltraAndroid","AndroidDynamicColors","getAndroidComponentId","getAndroidComponentName","ANDROID_COMPONENT_ID_TO_NAME","ANDROID_COMPONENT_NAME_TO_ID","renderAndroidLiveUpdateToJson","renderAndroidLiveUpdateToString","AndroidOngoingNotification","renderAndroidOngoingNotificationPayload","renderAndroidViewToJson","renderAndroidWidgetToJson","renderAndroidWidgetToString","renderAndroidVariantToJson","isAndroidEnv","isIosEnv"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,OAAO,KAAKA,aAAa,MAAM,qBAAqB;AAEpD,SAASA,aAAa;AACtB,SAASC,oBAAoB,QAAQ,qBAAqB;AAC1D,SACEC,qBAAqB,EACrBC,uBAAuB,EACvBC,4BAA4B,EAC5BC,4BAA4B,QACvB,4BAA4B;AACnC,SAASC,6BAA6B,EAAEC,+BAA+B,QAAQ,2BAA2B;AAC1G,SAASC,0BAA0B,QAAQ,sCAAsC;AACjF,SAASC,uCAAuC,QAAQ,oCAAoC;AAC5F,SAASC,uBAAuB,EAAEC,yBAAyB,EAAEC,2BAA2B,QAAQ,uBAAuB;AACvH;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,qBAAqB;;AAEhE;;AAiEA;;AAYA,SAASC,YAAY,EAAEC,QAAQ,QAAQ,kBAAkB","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ export { renderAndroidLiveUpdateToJson, renderAndroidLiveUpdateToString } from '
|
|
|
6
6
|
export { AndroidOngoingNotification } from './ongoing-notification/components.js';
|
|
7
7
|
export { renderAndroidOngoingNotificationPayload } from './ongoing-notification/renderer.js';
|
|
8
8
|
export { renderAndroidViewToJson, renderAndroidWidgetToJson, renderAndroidWidgetToString } from './widgets/renderer.js';
|
|
9
|
+
export { renderAndroidVariantToJson } from './renderer/index.js';
|
|
9
10
|
export type { VoltraAndroidBaseProps } from './jsx/baseProps.js';
|
|
10
11
|
export type { VoltraAndroidStyleProp, VoltraAndroidTextStyle, VoltraAndroidTextStyleProp, VoltraAndroidViewStyle, } from './styles/types.js';
|
|
11
12
|
export type { AndroidColorValue, AndroidDynamicColorRole, AndroidDynamicColorToken } from './dynamic-colors.js';
|
|
@@ -24,4 +25,6 @@ export type { LinearProgressIndicatorProps } from './jsx/LinearProgressIndicator
|
|
|
24
25
|
export type { RowProps } from './jsx/Row.js';
|
|
25
26
|
export type { SpacerProps } from './jsx/Spacer.js';
|
|
26
27
|
export type { TextProps } from './jsx/Text.js';
|
|
28
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core';
|
|
29
|
+
export type { WidgetBuildEnvironment, WidgetEnvironment } from '@use-voltra/core';
|
|
27
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAA;AAC5F,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAA;AAC5F,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAIvH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAGhE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAC/G,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,UAAU,GACX,MAAM,oBAAoB,CAAA;AAE3B,YAAY,EACV,uCAAuC,EACvC,qCAAqC,EACrC,wCAAwC,EACxC,sCAAsC,EACtC,sCAAsC,EACtC,4CAA4C,EAC5C,iCAAiC,EACjC,0CAA0C,EAC1C,+BAA+B,EAC/B,iCAAiC,EACjC,yCAAyC,EACzC,uCAAuC,EACvC,uCAAuC,EACvC,yCAAyC,EACzC,qCAAqC,EACrC,gCAAgC,EAChC,oCAAoC,EACpC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,uCAAuC,EACvC,oCAAoC,EACpC,mCAAmC,GACpC,MAAM,iCAAiC,CAAA;AAGxC,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAA;AACxF,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACtE,YAAY,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAA;AACpF,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -6,6 +6,7 @@ export { renderAndroidLiveUpdateToJson, renderAndroidLiveUpdateToString } from '
|
|
|
6
6
|
export { AndroidOngoingNotification } from './ongoing-notification/components.js';
|
|
7
7
|
export { renderAndroidOngoingNotificationPayload } from './ongoing-notification/renderer.js';
|
|
8
8
|
export { renderAndroidViewToJson, renderAndroidWidgetToJson, renderAndroidWidgetToString } from './widgets/renderer.js';
|
|
9
|
+
export { renderAndroidVariantToJson } from './renderer/index.js';
|
|
9
10
|
export type { VoltraAndroidBaseProps } from './jsx/baseProps.js';
|
|
10
11
|
export type { VoltraAndroidStyleProp, VoltraAndroidTextStyle, VoltraAndroidTextStyleProp, VoltraAndroidViewStyle, } from './styles/types.js';
|
|
11
12
|
export type { AndroidColorValue, AndroidDynamicColorRole, AndroidDynamicColorToken } from './dynamic-colors.js';
|
|
@@ -24,4 +25,6 @@ export type { LinearProgressIndicatorProps } from './jsx/LinearProgressIndicator
|
|
|
24
25
|
export type { RowProps } from './jsx/Row.js';
|
|
25
26
|
export type { SpacerProps } from './jsx/Spacer.js';
|
|
26
27
|
export type { TextProps } from './jsx/Text.js';
|
|
28
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core';
|
|
29
|
+
export type { WidgetBuildEnvironment, WidgetEnvironment } from '@use-voltra/core';
|
|
27
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAA;AAC5F,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAA;AAC5F,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAIvH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAGhE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAC/G,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,UAAU,GACX,MAAM,oBAAoB,CAAA;AAE3B,YAAY,EACV,uCAAuC,EACvC,qCAAqC,EACrC,wCAAwC,EACxC,sCAAsC,EACtC,sCAAsC,EACtC,4CAA4C,EAC5C,iCAAiC,EACjC,0CAA0C,EAC1C,+BAA+B,EAC/B,iCAAiC,EACjC,yCAAyC,EACzC,uCAAuC,EACvC,uCAAuC,EACvC,yCAAyC,EACzC,qCAAqC,EACrC,gCAAgC,EAChC,oCAAoC,EACpC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,uCAAuC,EACvC,oCAAoC,EACpC,mCAAmC,GACpC,MAAM,iCAAiC,CAAA;AAGxC,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAA;AACxF,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACtE,YAAY,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAA;AACpF,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@use-voltra/android",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Voltra for Android",
|
|
5
5
|
"main": "build/commonjs/index.js",
|
|
6
6
|
"module": "build/module/index.js",
|
|
@@ -46,10 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"build",
|
|
49
|
+
"src",
|
|
49
50
|
"README.md"
|
|
50
51
|
],
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@use-voltra/core": "^2.
|
|
53
|
+
"@use-voltra/core": "^2.1.0"
|
|
53
54
|
},
|
|
54
55
|
"keywords": [
|
|
55
56
|
"react-native",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const AndroidDynamicColors = {
|
|
2
|
+
primary: '~p',
|
|
3
|
+
onPrimary: '~op',
|
|
4
|
+
primaryContainer: '~pc',
|
|
5
|
+
onPrimaryContainer: '~opc',
|
|
6
|
+
secondary: '~s',
|
|
7
|
+
onSecondary: '~os',
|
|
8
|
+
secondaryContainer: '~sc',
|
|
9
|
+
onSecondaryContainer: '~osc',
|
|
10
|
+
tertiary: '~t',
|
|
11
|
+
onTertiary: '~ot',
|
|
12
|
+
tertiaryContainer: '~tc',
|
|
13
|
+
onTertiaryContainer: '~otc',
|
|
14
|
+
error: '~e',
|
|
15
|
+
errorContainer: '~ec',
|
|
16
|
+
onError: '~oe',
|
|
17
|
+
onErrorContainer: '~oec',
|
|
18
|
+
background: '~b',
|
|
19
|
+
onBackground: '~ob',
|
|
20
|
+
surface: '~sf',
|
|
21
|
+
onSurface: '~osf',
|
|
22
|
+
surfaceVariant: '~sv',
|
|
23
|
+
onSurfaceVariant: '~osv',
|
|
24
|
+
outline: '~ol',
|
|
25
|
+
inverseOnSurface: '~ios',
|
|
26
|
+
inverseSurface: '~is',
|
|
27
|
+
inversePrimary: '~ip',
|
|
28
|
+
widgetBackground: '~wb',
|
|
29
|
+
} as const
|
|
30
|
+
|
|
31
|
+
export type AndroidDynamicColorRole = keyof typeof AndroidDynamicColors
|
|
32
|
+
export type AndroidDynamicColorToken = (typeof AndroidDynamicColors)[AndroidDynamicColorRole]
|
|
33
|
+
export type AndroidColorValue = string | AndroidDynamicColorToken
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Android component namespace
|
|
2
|
+
import * as VoltraAndroid from './jsx/primitives.js'
|
|
3
|
+
|
|
4
|
+
export { VoltraAndroid }
|
|
5
|
+
export { AndroidDynamicColors } from './dynamic-colors.js'
|
|
6
|
+
export {
|
|
7
|
+
getAndroidComponentId,
|
|
8
|
+
getAndroidComponentName,
|
|
9
|
+
ANDROID_COMPONENT_ID_TO_NAME,
|
|
10
|
+
ANDROID_COMPONENT_NAME_TO_ID,
|
|
11
|
+
} from './payload/component-ids.js'
|
|
12
|
+
export { renderAndroidLiveUpdateToJson, renderAndroidLiveUpdateToString } from './live-update/renderer.js'
|
|
13
|
+
export { AndroidOngoingNotification } from './ongoing-notification/components.js'
|
|
14
|
+
export { renderAndroidOngoingNotificationPayload } from './ongoing-notification/renderer.js'
|
|
15
|
+
export { renderAndroidViewToJson, renderAndroidWidgetToJson, renderAndroidWidgetToString } from './widgets/renderer.js'
|
|
16
|
+
// Single-node renderer used by Dynamic Widgets (on-device Hermes render). Analog of
|
|
17
|
+
// iOS `renderVoltraVariantToJson`. Invoked with `(props, env)` per render via the generated
|
|
18
|
+
// widget entry.
|
|
19
|
+
export { renderAndroidVariantToJson } from './renderer/index.js'
|
|
20
|
+
|
|
21
|
+
// Android types
|
|
22
|
+
export type { VoltraAndroidBaseProps } from './jsx/baseProps.js'
|
|
23
|
+
export type {
|
|
24
|
+
VoltraAndroidStyleProp,
|
|
25
|
+
VoltraAndroidTextStyle,
|
|
26
|
+
VoltraAndroidTextStyleProp,
|
|
27
|
+
VoltraAndroidViewStyle,
|
|
28
|
+
} from './styles/types.js'
|
|
29
|
+
export type { AndroidColorValue, AndroidDynamicColorRole, AndroidDynamicColorToken } from './dynamic-colors.js'
|
|
30
|
+
export type {
|
|
31
|
+
AndroidLiveUpdateJson,
|
|
32
|
+
AndroidLiveUpdateVariants,
|
|
33
|
+
AndroidLiveUpdateVariantsJson,
|
|
34
|
+
StartAndroidLiveUpdateOptions,
|
|
35
|
+
UpdateAndroidLiveUpdateOptions,
|
|
36
|
+
UseAndroidLiveUpdateOptions,
|
|
37
|
+
UseAndroidLiveUpdateResult,
|
|
38
|
+
} from './live-update/types.js'
|
|
39
|
+
export type {
|
|
40
|
+
EventSubscription,
|
|
41
|
+
PreloadImageFailure,
|
|
42
|
+
PreloadImageOptions,
|
|
43
|
+
PreloadImageSvgOptions,
|
|
44
|
+
PreloadImageUrlOptions,
|
|
45
|
+
PreloadImagesResult,
|
|
46
|
+
VoltraElementJson,
|
|
47
|
+
VoltraElementRef,
|
|
48
|
+
VoltraNodeJson,
|
|
49
|
+
VoltraPropValue,
|
|
50
|
+
WidgetServerCredentials,
|
|
51
|
+
} from './types.js'
|
|
52
|
+
export type {
|
|
53
|
+
AndroidWidgetSize,
|
|
54
|
+
AndroidWidgetSizeVariant,
|
|
55
|
+
AndroidWidgetVariants,
|
|
56
|
+
UpdateAndroidWidgetOptions,
|
|
57
|
+
WidgetInfo,
|
|
58
|
+
} from './widgets/types.js'
|
|
59
|
+
|
|
60
|
+
export type {
|
|
61
|
+
AndroidOngoingNotificationActionPayload,
|
|
62
|
+
AndroidOngoingNotificationActionProps,
|
|
63
|
+
AndroidOngoingNotificationBigTextPayload,
|
|
64
|
+
AndroidOngoingNotificationBigTextProps,
|
|
65
|
+
AndroidOngoingNotificationCapabilities,
|
|
66
|
+
AndroidOngoingNotificationCommonDisplayProps,
|
|
67
|
+
AndroidOngoingNotificationContent,
|
|
68
|
+
AndroidOngoingNotificationFallbackBehavior,
|
|
69
|
+
AndroidOngoingNotificationInput,
|
|
70
|
+
AndroidOngoingNotificationPayload,
|
|
71
|
+
AndroidOngoingNotificationProgressPayload,
|
|
72
|
+
AndroidOngoingNotificationProgressPoint,
|
|
73
|
+
AndroidOngoingNotificationProgressProps,
|
|
74
|
+
AndroidOngoingNotificationProgressSegment,
|
|
75
|
+
AndroidOngoingNotificationStartResult,
|
|
76
|
+
AndroidOngoingNotificationStatus,
|
|
77
|
+
AndroidOngoingNotificationStopResult,
|
|
78
|
+
AndroidOngoingNotificationUpdateResult,
|
|
79
|
+
AndroidOngoingNotificationUpsertResult,
|
|
80
|
+
StartAndroidOngoingNotificationOptions,
|
|
81
|
+
UpdateAndroidOngoingNotificationOptions,
|
|
82
|
+
UseAndroidOngoingNotificationOptions,
|
|
83
|
+
UseAndroidOngoingNotificationResult,
|
|
84
|
+
} from './ongoing-notification/types.js'
|
|
85
|
+
|
|
86
|
+
// Component prop types
|
|
87
|
+
export type { BoxProps } from './jsx/Box.js'
|
|
88
|
+
export type { ButtonProps } from './jsx/Button.js'
|
|
89
|
+
export type { CircularProgressIndicatorProps } from './jsx/CircularProgressIndicator.js'
|
|
90
|
+
export type { ColumnProps } from './jsx/Column.js'
|
|
91
|
+
export type { ImageProps } from './jsx/Image.js'
|
|
92
|
+
export type { LazyColumnProps } from './jsx/LazyColumn.js'
|
|
93
|
+
export type { LazyVerticalGridProps } from './jsx/LazyVerticalGrid.js'
|
|
94
|
+
export type { LinearProgressIndicatorProps } from './jsx/LinearProgressIndicator.js'
|
|
95
|
+
export type { RowProps } from './jsx/Row.js'
|
|
96
|
+
export type { SpacerProps } from './jsx/Spacer.js'
|
|
97
|
+
export type { TextProps } from './jsx/Text.js'
|
|
98
|
+
export { isAndroidEnv, isIosEnv } from '@use-voltra/core'
|
|
99
|
+
export type { WidgetBuildEnvironment, WidgetEnvironment } from '@use-voltra/core'
|
package/src/internal.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { AndroidColorValue } from '../dynamic-colors.js'
|
|
4
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
5
|
+
import type { ChartDataPoint } from './chart-types.js'
|
|
6
|
+
|
|
7
|
+
export type AreaMarkProps = {
|
|
8
|
+
data: ChartDataPoint[]
|
|
9
|
+
color?: AndroidColorValue
|
|
10
|
+
interpolation?: 'linear' | 'monotone' | 'stepStart' | 'stepEnd' | 'stepCenter' | 'cardinal' | 'catmullRom'
|
|
11
|
+
stacking?: 'standard' | 'normalized' | 'unstacked'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const AreaMark = (props: AreaMarkProps) => createElement('VoltraAreaMark', props as any)
|
|
15
|
+
AreaMark.displayName = 'AreaMark'
|
|
16
|
+
AreaMark[VOLTRA_MARK_TAG] = 'area' as const
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { AndroidColorValue } from '../dynamic-colors.js'
|
|
4
|
+
import type { ChartDataPoint } from './chart-types.js'
|
|
5
|
+
|
|
6
|
+
export const VOLTRA_MARK_TAG = Symbol.for('VOLTRA_MARK_TAG')
|
|
7
|
+
|
|
8
|
+
export type BarMarkProps = {
|
|
9
|
+
data: ChartDataPoint[]
|
|
10
|
+
color?: AndroidColorValue
|
|
11
|
+
stacking?: 'grouped'
|
|
12
|
+
cornerRadius?: number
|
|
13
|
+
width?: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const BarMark = (props: BarMarkProps) => createElement('VoltraBarMark', props as any)
|
|
17
|
+
BarMark.displayName = 'BarMark'
|
|
18
|
+
BarMark[VOLTRA_MARK_TAG] = 'bar' as const
|
package/src/jsx/Box.tsx
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import type { VoltraAndroidBaseProps } from './baseProps.js'
|
|
4
|
+
import type { AreaMarkProps } from './AreaMark.js'
|
|
5
|
+
import type { BarMarkProps } from './BarMark.js'
|
|
6
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
7
|
+
import type { ChartDataPoint, SectorDataPoint } from './chart-types.js'
|
|
8
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
9
|
+
import type { LineMarkProps } from './LineMark.js'
|
|
10
|
+
import type { PointMarkProps } from './PointMark.js'
|
|
11
|
+
import type { RuleMarkProps } from './RuleMark.js'
|
|
12
|
+
import type { SectorMarkProps } from './SectorMark.js'
|
|
13
|
+
|
|
14
|
+
// ---- user-facing prop types ----
|
|
15
|
+
|
|
16
|
+
export type AndroidChartProps = VoltraAndroidBaseProps & {
|
|
17
|
+
xAxisVisibility?: 'automatic' | 'visible' | 'hidden'
|
|
18
|
+
yAxisVisibility?: 'automatic' | 'visible' | 'hidden'
|
|
19
|
+
xAxisGridStyle?: { visible?: boolean }
|
|
20
|
+
yAxisGridStyle?: { visible?: boolean }
|
|
21
|
+
legendVisibility?: 'automatic' | 'visible' | 'hidden'
|
|
22
|
+
foregroundStyleScale?: Record<string, string>
|
|
23
|
+
chartScrollableAxes?: 'horizontal' | 'vertical'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ---- wire encoding helpers (same as iOS Chart) ----
|
|
27
|
+
|
|
28
|
+
type CompactDataPoint = [string | number, number] | [string | number, number, string]
|
|
29
|
+
type CompactSectorPoint = [number, string]
|
|
30
|
+
type MarkWire = [string, CompactDataPoint[] | CompactSectorPoint[] | null, Record<string, unknown>]
|
|
31
|
+
|
|
32
|
+
const encodeDataPoints = (data: ChartDataPoint[]): CompactDataPoint[] =>
|
|
33
|
+
data.map((pt) => (pt.series != null ? [pt.x, pt.y, pt.series] : [pt.x, pt.y]))
|
|
34
|
+
|
|
35
|
+
const encodeSectorPoints = (data: SectorDataPoint[]): CompactSectorPoint[] => data.map((pt) => [pt.value, pt.category])
|
|
36
|
+
|
|
37
|
+
const encodeBarMark = (props: BarMarkProps): MarkWire => {
|
|
38
|
+
const p: Record<string, unknown> = {}
|
|
39
|
+
if (props.color != null) p.c = props.color
|
|
40
|
+
if (props.stacking != null) p.stk = props.stacking
|
|
41
|
+
if (props.cornerRadius != null) p.cr = props.cornerRadius
|
|
42
|
+
if (props.width != null) p.w = props.width
|
|
43
|
+
return ['bar', encodeDataPoints(props.data), p]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const encodeLineMark = (props: LineMarkProps): MarkWire => {
|
|
47
|
+
const p: Record<string, unknown> = {}
|
|
48
|
+
if (props.color != null) p.c = props.color
|
|
49
|
+
if (props.interpolation != null) p.itp = props.interpolation
|
|
50
|
+
if (props.lineWidth != null) p.lw = props.lineWidth
|
|
51
|
+
if (props.symbol != null) p.sym = props.symbol
|
|
52
|
+
return ['line', encodeDataPoints(props.data), p]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const encodeAreaMark = (props: AreaMarkProps): MarkWire => {
|
|
56
|
+
const p: Record<string, unknown> = {}
|
|
57
|
+
if (props.color != null) p.c = props.color
|
|
58
|
+
if (props.interpolation != null) p.itp = props.interpolation
|
|
59
|
+
if (props.stacking != null) p.stk = props.stacking
|
|
60
|
+
return ['area', encodeDataPoints(props.data), p]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const encodePointMark = (props: PointMarkProps): MarkWire => {
|
|
64
|
+
const p: Record<string, unknown> = {}
|
|
65
|
+
if (props.color != null) p.c = props.color
|
|
66
|
+
if (props.symbol != null) p.sym = props.symbol
|
|
67
|
+
if (props.symbolSize != null) p.syms = props.symbolSize
|
|
68
|
+
return ['point', encodeDataPoints(props.data), p]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const encodeRuleMark = (props: RuleMarkProps): MarkWire => {
|
|
72
|
+
const p: Record<string, unknown> = {}
|
|
73
|
+
if (props.color != null) p.c = props.color
|
|
74
|
+
if (props.lineWidth != null) p.lw = props.lineWidth
|
|
75
|
+
if (props.xValue != null) p.xv = props.xValue
|
|
76
|
+
if (props.yValue != null) p.yv = props.yValue
|
|
77
|
+
return ['rule', null, p]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const encodeSectorMark = (props: SectorMarkProps): MarkWire => {
|
|
81
|
+
const p: Record<string, unknown> = {}
|
|
82
|
+
if (props.color != null) p.c = props.color
|
|
83
|
+
if (props.innerRadius != null) p.ir = props.innerRadius
|
|
84
|
+
if (props.outerRadius != null) p.or = props.outerRadius
|
|
85
|
+
if (props.angularInset != null) p.agin = props.angularInset
|
|
86
|
+
return ['sector', encodeSectorPoints(props.data), p]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const ENCODERS: Record<string, (props: any) => MarkWire> = {
|
|
90
|
+
bar: encodeBarMark,
|
|
91
|
+
line: encodeLineMark,
|
|
92
|
+
area: encodeAreaMark,
|
|
93
|
+
point: encodePointMark,
|
|
94
|
+
rule: encodeRuleMark,
|
|
95
|
+
sector: encodeSectorMark,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ---- component ----
|
|
99
|
+
|
|
100
|
+
export const Chart = createVoltraComponent<AndroidChartProps>('AndroidChart', {
|
|
101
|
+
toJSON: ({ children, foregroundStyleScale, xAxisGridStyle, yAxisGridStyle, ...rest }) => {
|
|
102
|
+
const marks: MarkWire[] = []
|
|
103
|
+
|
|
104
|
+
React.Children.forEach(children, (child) => {
|
|
105
|
+
if (!React.isValidElement(child)) return
|
|
106
|
+
const type = child.type as any
|
|
107
|
+
const markType: string | undefined = type[VOLTRA_MARK_TAG]
|
|
108
|
+
if (!markType) return
|
|
109
|
+
const encoder = ENCODERS[markType]
|
|
110
|
+
if (encoder) marks.push(encoder(child.props as any))
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
const result: Record<string, unknown> = { ...rest }
|
|
114
|
+
if (marks.length > 0) result.marks = JSON.stringify(marks)
|
|
115
|
+
if (foregroundStyleScale != null) {
|
|
116
|
+
result.foregroundStyleScale = JSON.stringify(Object.entries(foregroundStyleScale))
|
|
117
|
+
}
|
|
118
|
+
if (xAxisGridStyle?.visible === false) result.xAxisGridVisible = false
|
|
119
|
+
if (yAxisGridStyle?.visible === false) result.yAxisGridVisible = false
|
|
120
|
+
|
|
121
|
+
return result
|
|
122
|
+
},
|
|
123
|
+
})
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidCheckBoxProps as CheckBoxProps } from './props/AndroidCheckBox.js'
|
|
3
|
+
|
|
4
|
+
export type { CheckBoxProps }
|
|
5
|
+
export const CheckBox = createVoltraComponent<CheckBoxProps>('AndroidCheckBox')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidCircleIconButtonProps as CircleIconButtonProps } from './props/AndroidCircleIconButton.js'
|
|
3
|
+
|
|
4
|
+
export type { CircleIconButtonProps }
|
|
5
|
+
export const CircleIconButton = createVoltraComponent<CircleIconButtonProps>('AndroidCircleIconButton', {
|
|
6
|
+
toJSON: (props) => {
|
|
7
|
+
const { icon, ...rest } = props
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
...rest,
|
|
11
|
+
...(icon ? { icon: JSON.stringify(icon) } : {}),
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidCircularProgressIndicatorProps as CircularProgressIndicatorProps } from './props/AndroidCircularProgressIndicator.js'
|
|
3
|
+
|
|
4
|
+
export type { CircularProgressIndicatorProps }
|
|
5
|
+
export const CircularProgressIndicator = createVoltraComponent<CircularProgressIndicatorProps>(
|
|
6
|
+
'AndroidCircularProgressIndicator'
|
|
7
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidFilledButtonProps as FilledButtonProps } from './props/AndroidFilledButton.js'
|
|
3
|
+
|
|
4
|
+
export type { FilledButtonProps }
|
|
5
|
+
export const FilledButton = createVoltraComponent<FilledButtonProps>('AndroidFilledButton', {
|
|
6
|
+
toJSON: (props) => {
|
|
7
|
+
const { icon, ...rest } = props
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
...rest,
|
|
11
|
+
...(icon ? { icon: JSON.stringify(icon) } : {}),
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidImageProps } from './props/AndroidImage.js'
|
|
3
|
+
|
|
4
|
+
export type ImageSource = { assetName: string } | { base64: string }
|
|
5
|
+
|
|
6
|
+
export type ImageProps = Omit<AndroidImageProps, 'source'> & {
|
|
7
|
+
source: ImageSource
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ImagePropsWithSource = ImageProps
|
|
11
|
+
|
|
12
|
+
export const Image = createVoltraComponent<ImageProps>('AndroidImage', {
|
|
13
|
+
toJSON: (props) => {
|
|
14
|
+
const { source, ...rest } = props
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
...rest,
|
|
18
|
+
source: JSON.stringify(source),
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
})
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidLazyColumnProps as LazyColumnProps } from './props/AndroidLazyColumn.js'
|
|
3
|
+
|
|
4
|
+
export type { LazyColumnProps }
|
|
5
|
+
export const LazyColumn = createVoltraComponent<LazyColumnProps>('AndroidLazyColumn')
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidLazyVerticalGridProps } from './props/AndroidLazyVerticalGrid.js'
|
|
3
|
+
|
|
4
|
+
export type LazyVerticalGridColumns =
|
|
5
|
+
| number
|
|
6
|
+
| {
|
|
7
|
+
type: 'fixed'
|
|
8
|
+
count: number
|
|
9
|
+
}
|
|
10
|
+
| {
|
|
11
|
+
type: 'adaptive'
|
|
12
|
+
minSize: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type LazyVerticalGridProps = Omit<AndroidLazyVerticalGridProps, 'columns'> & {
|
|
16
|
+
/** Fixed column count or adaptive grid cell configuration */
|
|
17
|
+
columns?: LazyVerticalGridColumns
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const serializeColumns = (columns: LazyVerticalGridColumns | undefined): number | string | undefined => {
|
|
21
|
+
if (columns === undefined) {
|
|
22
|
+
return undefined
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (typeof columns === 'number') {
|
|
26
|
+
return columns
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (columns.type === 'fixed') {
|
|
30
|
+
return columns.count
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return `a:${columns.minSize}`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const LazyVerticalGrid = createVoltraComponent<LazyVerticalGridProps>('AndroidLazyVerticalGrid', {
|
|
37
|
+
toJSON: ({ columns, ...props }) => {
|
|
38
|
+
const serializedColumns = serializeColumns(columns)
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
...props,
|
|
42
|
+
...(serializedColumns !== undefined ? { columns: serializedColumns } : {}),
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createElement } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { AndroidColorValue } from '../dynamic-colors.js'
|
|
4
|
+
import { VOLTRA_MARK_TAG } from './BarMark.js'
|
|
5
|
+
import type { ChartDataPoint } from './chart-types.js'
|
|
6
|
+
|
|
7
|
+
export type LineMarkProps = {
|
|
8
|
+
data: ChartDataPoint[]
|
|
9
|
+
color?: AndroidColorValue
|
|
10
|
+
interpolation?: 'linear' | 'monotone' | 'stepStart' | 'stepEnd' | 'stepCenter' | 'cardinal' | 'catmullRom'
|
|
11
|
+
lineWidth?: number
|
|
12
|
+
symbol?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const LineMark = (props: LineMarkProps) => createElement('VoltraLineMark', props as any)
|
|
16
|
+
LineMark.displayName = 'LineMark'
|
|
17
|
+
LineMark[VOLTRA_MARK_TAG] = 'line' as const
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidLinearProgressIndicatorProps as LinearProgressIndicatorProps } from './props/AndroidLinearProgressIndicator.js'
|
|
3
|
+
|
|
4
|
+
export type { LinearProgressIndicatorProps }
|
|
5
|
+
export const LinearProgressIndicator = createVoltraComponent<LinearProgressIndicatorProps>(
|
|
6
|
+
'AndroidLinearProgressIndicator'
|
|
7
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createVoltraComponent } from './createVoltraComponent.js'
|
|
2
|
+
import type { AndroidOutlineButtonProps as OutlineButtonProps } from './props/AndroidOutlineButton.js'
|
|
3
|
+
|
|
4
|
+
export type { OutlineButtonProps }
|
|
5
|
+
export const OutlineButton = createVoltraComponent<OutlineButtonProps>('AndroidOutlineButton', {
|
|
6
|
+
toJSON: (props) => {
|
|
7
|
+
const { icon, ...rest } = props
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
...rest,
|
|
11
|
+
...(icon ? { icon: JSON.stringify(icon) } : {}),
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
})
|