@tamagui/progress 2.7.7 → 3.0.0-beta.643.1

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.
@@ -1,34 +1,33 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
24
  var Progress_exports = {};
26
25
  __export(Progress_exports, {
27
- Progress: () => Progress,
28
- ProgressFrame: () => ProgressFrame,
29
- ProgressIndicator: () => ProgressIndicator,
30
- ProgressIndicatorFrame: () => ProgressIndicatorFrame,
31
- createProgressScope: () => createProgressScope
26
+ Progress: () => Progress,
27
+ ProgressFrame: () => ProgressFrame,
28
+ ProgressIndicator: () => ProgressIndicator,
29
+ ProgressIndicatorFrame: () => ProgressIndicatorFrame,
30
+ createProgressScope: () => createProgressScope
32
31
  });
33
32
  module.exports = __toCommonJS(Progress_exports);
34
33
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -43,143 +42,97 @@ var [createProgressContext, createProgressScope] = (0, import_create_context.cre
43
42
  var [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);
44
43
  var INDICATOR_NAME = "ProgressIndicator";
45
44
  var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
46
- name: INDICATOR_NAME,
47
- variants: {
48
- unstyled: {
49
- false: {
50
- height: "100%",
51
- width: "100%",
52
- backgroundColor: "$background"
53
- }
54
- }
55
- },
56
- defaultVariants: {
57
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
58
- }
45
+ displayName: INDICATOR_NAME,
46
+ height: "100%",
47
+ width: "100%"
59
48
  });
60
- var ProgressIndicator = ProgressIndicatorFrame.styleable(function ProgressIndicator2(props, forwardedRef) {
61
- var {
62
- __scopeProgress,
63
- transition,
64
- ...indicatorProps
65
- } = props;
66
- var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
67
- var _context_value;
68
- var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
69
- var x;
70
- if (import_core.isWeb) {
71
- x = `${-100 + progressRatio * 50}%`;
72
- } else {
73
- var baseWidth = context.width || 0;
74
- x = Math.ceil(-baseWidth * (2 - progressRatio));
75
- }
76
- var _context_value1;
77
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
78
- "data-state": getProgressState(context.value, context.max),
79
- "data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
80
- "data-max": context.max,
81
- x,
82
- width: "200%",
83
- ...(!props.unstyled && {
84
- animateOnly: ["transform"],
85
- // on native, hide until we have width measurement
86
- ...(!import_core.isWeb && context.width === 0 && {
87
- opacity: 0
88
- })
89
- }),
90
- ...indicatorProps,
91
- ref: forwardedRef,
92
- transition: !import_core.isWeb && !context.width ? null : transition
93
- });
49
+ var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {
50
+ var { __scopeProgress, transition, ...indicatorProps } = props;
51
+ var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
52
+ var _context_value;
53
+ var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
54
+ var x;
55
+ if (import_core.isWeb) {
56
+ x = `${-100 + progressRatio * 50}%`;
57
+ } else {
58
+ var baseWidth = context.width || 0;
59
+ x = Math.ceil(-baseWidth * (2 - progressRatio));
60
+ }
61
+ var _context_value1;
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
63
+ "data-state": getProgressState(context.value, context.max),
64
+ "data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
65
+ "data-max": context.max,
66
+ x,
67
+ width: "200%",
68
+ animateOnly: ["transform"],
69
+ ...!import_core.isWeb && context.width === 0 && { opacity: 0 },
70
+ ...indicatorProps,
71
+ ref: forwardedRef,
72
+ transition: !import_core.isWeb && !context.width ? null : transition
73
+ });
94
74
  });
95
75
  function defaultGetValueLabel(value, max) {
96
- return `${Math.round(value / max * 100)}%`;
76
+ return `${Math.round(value / max * 100)}%`;
97
77
  }
98
78
  function getProgressState(value, maxValue) {
99
- return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
79
+ return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
100
80
  }
101
81
  function isNumber(value) {
102
- return typeof value === "number";
82
+ return typeof value === "number";
103
83
  }
104
84
  function isValidMaxNumber(max) {
105
- return isNumber(max) && !Number.isNaN(max) && max > 0;
85
+ return isNumber(max) && !Number.isNaN(max) && max > 0;
106
86
  }
107
87
  function isValidValueNumber(value, max) {
108
- return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
88
+ return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
109
89
  }
110
90
  var DEFAULT_MAX = 100;
111
91
  var ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
112
- name: "Progress",
113
- variants: {
114
- unstyled: {
115
- false: {
116
- borderRadius: 1e5,
117
- overflow: "hidden",
118
- backgroundColor: "$background"
119
- }
120
- },
121
- size: {
122
- "...size": function (val) {
123
- var size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * 0.25);
124
- return {
125
- height: size,
126
- minWidth: (0, import_core.getVariableValue)(size) * 20,
127
- width: "100%"
128
- };
129
- }
130
- }
131
- },
132
- defaultVariants: {
133
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
134
- }
135
- });
136
- var Progress = (0, import_helpers.withStaticProperties)(ProgressFrame.styleable(function Progress2(props, forwardedRef) {
137
- var {
138
- // @ts-expect-error
139
- __scopeProgress,
140
- value: valueProp,
141
- max: maxProp,
142
- getValueLabel = defaultGetValueLabel,
143
- size = "$true",
144
- ...progressProps
145
- } = props;
146
- var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
147
- var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
148
- var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;
149
- var [width, setWidth] = (0, import_react.useState)(0);
150
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressProvider, {
151
- scope: __scopeProgress,
152
- value,
153
- max,
154
- width,
155
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressFrame, {
156
- "aria-valuemax": max,
157
- "aria-valuemin": 0,
158
- "aria-valuenow": isNumber(value) ? value : void 0,
159
- "aria-valuetext": valueLabel,
160
- // @ts-ignore
161
- role: "progressbar",
162
- "data-state": getProgressState(value, max),
163
- "data-value": value !== null && value !== void 0 ? value : void 0,
164
- "data-max": max,
165
- ...(progressProps.unstyled !== true && {
166
- size
167
- }),
168
- ...progressProps,
169
- ...(!import_core.isWeb && {
170
- onLayout: function (e) {
171
- var _progressProps_onLayout;
172
- var newWidth = Math.round(e.nativeEvent.layout.width);
173
- if (newWidth !== width) {
174
- setWidth(newWidth);
175
- }
176
- (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);
177
- }
178
- }),
179
- ref: forwardedRef
180
- })
181
- });
182
- }), {
183
- Indicator: ProgressIndicator
92
+ displayName: "Progress",
93
+ overflow: "hidden",
94
+ variants: { size: { Size: function(val) {
95
+ var size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * .25);
96
+ return {
97
+ height: size,
98
+ minWidth: (0, import_core.getVariableValue)(size) * 20,
99
+ width: "100%"
100
+ };
101
+ } } }
184
102
  });
103
+ var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(props, forwardedRef) {
104
+ var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
105
+ var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
106
+ var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
107
+ var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;
108
+ var [width, setWidth] = (0, import_react.useState)(0);
109
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, {
110
+ scope: __scopeProgress,
111
+ value,
112
+ max,
113
+ width,
114
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame, {
115
+ "aria-valuemax": max,
116
+ "aria-valuemin": 0,
117
+ "aria-valuenow": isNumber(value) ? value : void 0,
118
+ "aria-valuetext": valueLabel,
119
+ role: "progressbar",
120
+ "data-state": getProgressState(value, max),
121
+ "data-value": value !== null && value !== void 0 ? value : void 0,
122
+ "data-max": max,
123
+ size,
124
+ ...progressProps,
125
+ ...!import_core.isWeb && { onLayout: function(e) {
126
+ var _progressProps_onLayout;
127
+ var newWidth = Math.round(e.nativeEvent.layout.width);
128
+ if (newWidth !== width) {
129
+ setWidth(newWidth);
130
+ }
131
+ (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);
132
+ } },
133
+ ref: forwardedRef
134
+ })
135
+ });
136
+ }), { Indicator: ProgressIndicator });
137
+
185
138
  //# sourceMappingURL=Progress.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Progress_exports","__export","Progress","ProgressFrame","ProgressIndicator","ProgressIndicatorFrame","createProgressScope","module","exports","import_jsx_runtime","require","import_core","import_create_context","import_get_token","import_helpers","import_stacks","import_react","PROGRESS_NAME","createProgressContext","createContextScope","ProgressProvider","useProgressContext","INDICATOR_NAME","styled","YStack","name","variants","unstyled","false","height","width","backgroundColor","defaultVariants","process","env","TAMAGUI_HEADLESS","styleable","ProgressIndicator2","props","forwardedRef","__scopeProgress","transition","indicatorProps","context","_context_value","progressRatio","max","x","isWeb","baseWidth","Math","ceil","_context_value1","jsx","getProgressState","animateOnly","opacity","ref","defaultGetValueLabel","round","maxValue","isNumber","isValidMaxNumber","Number","isNaN","isValidValueNumber","DEFAULT_MAX","borderRadius","overflow","size","...size","val","getVariableValue","getSize","minWidth","withStaticProperties","Progress2","valueProp","maxProp","getValueLabel","progressProps","valueLabel","setWidth","useState","scope","children","role","onLayout","e","_progressProps_onLayout","newWidth","nativeEvent","layout","call"],"sources":["../../src/Progress.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,gBAAA;AAAAC,QAAA,CAAAD,gBAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAA,QAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA,aAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAA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kB,SAAA,IAAiB;EAChB,IAACI,UAAA,GAAApB,QAAA,CAAA9D,KAAA,IAAAgF,aAAA,CAAAhF,KAAA,EAAA+C,GAAA;EAAA,KAAAhB,KAAA,EAAAoD,QAAA,QAAAlE,YAAA,CAAAmE,QAAA;EAAA,OACC,eAAe,IAAA1E,kBAAA,CAAA4C,GAAA,EAAAjC,gBAAA;IAAAgE,KACf,EAAA5C,eAAe;IAAAzC,KACf;IAAyC+C,GAAA;IACzBhB,KAEhB;IAAKuD,QACL,iBAAY,IAAA5E,kBAA2B,CAAA4C,GAAA,EAAAlD,aAAA;MAAA,eACvC,EAAY2C,GAAA;MAAS,eACX;MAAA,eACL,EAAAe,QAAc,CAAA9D,KAAA,CAAa,GAAAA,KAAQ;MAAA,gBACtC,EAAAkF,UAAA;MAAA;MACFK,IACC,EAAG;MAAA,YACE,EAAAhC,gBAAS,CAAAvD,KAAA,EAAA+C,GAAA;MAAA,YACb,EAAU/C,KAAC,KAAM,QAAAA,KAAA,cAAAA,KAAA;MACf,YAAM+C,GAAA;MACN,IAAAkC,aAAI,CAAArD,QAAa,KAAO;QACtB0C;MAAiB;MAEnB,GAAAW,aAAA;MAA0B,KAC5BrE,WAAA,CAAAqC,KAAA;QACFuC,QAAA,WAAAA,CAAAC,CAAA;UACA,IAAKC,uBAAA;UAAA,IAAAC,QAAA,GAAAxC,IAAA,CAAAS,KAAA,CAAA6B,CAAA,CAAAG,WAAA,CAAAC,MAAA,CAAA9D,KAAA;UAET,IAAA4D,QAAA,KAAA5D,KAAA;YAEHoD,QAAA,CAAAQ,QAAA;UACD;UACE,CAAAD,uBAAW,GAAAT,aAAA,CAAAO,QAAA,cAAAE,uBAAA,uBAAAA,uBAAA,CAAAI,IAAA,CAAAb,aAAA,EAAAQ,CAAA;QACb;MACF","ignoreList":[]}
1
+ {"version":3,"file":"Progress.native.js","names":[],"sources":["cjs/Progress.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Progress_exports = {};\n__export(Progress_exports, {\n Progress: () => Progress,\n ProgressFrame: () => ProgressFrame,\n ProgressIndicator: () => ProgressIndicator,\n ProgressIndicatorFrame: () => ProgressIndicatorFrame,\n createProgressScope: () => createProgressScope\n});\nmodule.exports = __toCommonJS(Progress_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_get_token = require(\"@tamagui/get-token\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_react = require(\"react\");\nvar PROGRESS_NAME = \"Progress\";\nvar [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME);\nvar [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nvar INDICATOR_NAME = \"ProgressIndicator\";\nvar ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nvar ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {\n var { __scopeProgress, transition, ...indicatorProps } = props;\n var context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n var _context_value;\n var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;\n var x;\n if (import_core.isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n var baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n var _context_value1;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n animateOnly: [\n \"transform\"\n ],\n ...!import_core.isWeb && context.width === 0 && {\n opacity: 0\n },\n ...indicatorProps,\n ref: forwardedRef,\n transition: !import_core.isWeb && !context.width ? null : transition\n });\n});\nfunction defaultGetValueLabel(value, max) {\n return `${Math.round(value / max * 100)}%`;\n}\nfunction getProgressState(value, maxValue) {\n return value == null ? \"indeterminate\" : value === maxValue ? \"complete\" : \"loading\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isValidMaxNumber(max) {\n return isNumber(max) && !Number.isNaN(max) && max > 0;\n}\nfunction isValidValueNumber(value, max) {\n return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;\n}\nvar DEFAULT_MAX = 100;\nvar ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: {\n Size: function(val) {\n var size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * 0.25);\n return {\n height: size,\n minWidth: (0, import_core.getVariableValue)(size) * 20,\n width: \"100%\"\n };\n }\n }\n }\n});\nvar Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(props, forwardedRef) {\n var {\n // @ts-expect-error\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n var [width, setWidth] = (0, import_react.useState)(0);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, {\n scope: __scopeProgress,\n value,\n max,\n width,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame, {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n // @ts-ignore\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value !== null && value !== void 0 ? value : void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!import_core.isWeb && {\n onLayout: function(e) {\n var _progressProps_onLayout;\n var newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);\n }\n },\n ref: forwardedRef\n })\n });\n}), {\n Indicator: ProgressIndicator\n});\n//# sourceMappingURL=Progress.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iB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AAC;AACD,IAAI,YAAY,GAAG,eAAe,uBAAuB,GAAG,YAAY,iBAAiB,eAAe,SAAS,UAAU,OAAO,cAAc;CAC9I,IAAI,EAEF,iBACA,OAAO,WACP,KAAK,SACL,gBAAgB,sBAChB,OAAO,MACP,GAAG,kBACD;CACJ,IAAI,MAAM,iBAAiB,OAAO,IAAI,UAAU;CAChD,IAAI,QAAQ,mBAAmB,WAAW,GAAG,IAAI,KAAK,MAAM,SAAS,IAAI;CACzE,IAAI,aAAa,SAAS,KAAK,IAAI,cAAc,OAAO,GAAG,IAAI,KAAK;CACpE,IAAI,CAAC,OAAO,aAAa,GAAG,aAAa,UAAU,CAAC;CACpD,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,kBAAkB;EACnE,OAAO;EACP;EACA;EACA;EACA,UAA0B,iBAAC,GAAG,mBAAmB,KAAK,eAAe;GACnE,iBAAiB;GACjB,iBAAiB;GACjB,iBAAiB,SAAS,KAAK,IAAI,QAAQ,KAAK;GAChD,kBAAkB;GAElB,MAAM;GACN,cAAc,iBAAiB,OAAO,GAAG;GACzC,cAAc,UAAU,QAAQ,UAAU,KAAK,IAAI,QAAQ,KAAK;GAChE,YAAY;GACZ;GACA,GAAG;GACH,GAAG,CAAC,YAAY,SAAS,EACvB,UAAU,SAAS,GAAG;IACpB,IAAI;IACJ,IAAI,WAAW,KAAK,MAAM,EAAE,YAAY,OAAO,KAAK;IACpD,IAAI,aAAa,OAAO;KACtB,SAAS,QAAQ;IACnB;IACA,CAAC,0BAA0B,cAAc,cAAc,QAAQ,4BAA4B,KAAK,IAAI,KAAK,IAAI,wBAAwB,KAAK,eAAe,CAAC;GAC5J,EACF;GACA,KAAK;EACP,CAAC;CACH,CAAC;AACH,CAAC,GAAG,EACF,WAAW,kBACb,CAAC"}
@@ -1,20 +1,19 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
15
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: true
17
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
17
  var index_exports = {};
19
18
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./Progress.cjs"), module.exports);
19
+ __reExport(index_exports, require("./Progress.cjs"), module.exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ module.exports = __toCommonJS(index_exports);
21
+ __reExport(index_exports, require("./Progress.native.js"), module.exports);
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
19
  var index_exports = {};
21
20
  module.exports = __toCommonJS(index_exports);
22
21
  __reExport(index_exports, require("./Progress.native.js"), module.exports);
22
+
23
23
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Progress\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,sBAAY,GAAG,OAAO,OAAO"}