rte-utils 1.0.0 → 1.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/README.md +128 -0
- package/dist/components/Histogramme.d.ts +1 -0
- package/dist/index.css +1 -0
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -359
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# RTE Utils
|
|
2
|
+
|
|
3
|
+
React components library in TypeScript for agigox projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install rte-utils
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Import Component and Styles
|
|
14
|
+
|
|
15
|
+
You need to import both the component and its CSS styles:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Histogramme } from 'rte-utils';
|
|
19
|
+
import 'rte-utils/dist/index.css'; // Import the CSS styles
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Basic Example
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import { Histogramme } from 'rte-utils';
|
|
27
|
+
import 'rte-utils/dist/index.css';
|
|
28
|
+
|
|
29
|
+
function App() {
|
|
30
|
+
return (
|
|
31
|
+
<div>
|
|
32
|
+
<Histogramme
|
|
33
|
+
maxValue={100}
|
|
34
|
+
relativeValue={56}
|
|
35
|
+
value={56}
|
|
36
|
+
unit="MWh"
|
|
37
|
+
label="Soutirage"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default App;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Advanced Example with Animation
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import React, { useState } from 'react';
|
|
50
|
+
import { Histogramme } from 'rte-utils';
|
|
51
|
+
import 'rte-utils/dist/index.css';
|
|
52
|
+
|
|
53
|
+
function EnergyDashboard() {
|
|
54
|
+
const [currentValue, setCurrentValue] = useState(45);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div style={{ display: 'flex', gap: '1rem' }}>
|
|
58
|
+
<Histogramme
|
|
59
|
+
maxValue={100}
|
|
60
|
+
relativeValue={currentValue}
|
|
61
|
+
value={currentValue}
|
|
62
|
+
unit="MWh"
|
|
63
|
+
label="Consommation"
|
|
64
|
+
backgroundColor="#0066cc"
|
|
65
|
+
barHeight={120}
|
|
66
|
+
width={60}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<button onClick={() => setCurrentValue(prev => prev + 10)}>
|
|
70
|
+
Increase (+10)
|
|
71
|
+
</button>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Components
|
|
78
|
+
|
|
79
|
+
### Histogramme
|
|
80
|
+
|
|
81
|
+
A histogram component with smooth animations for energy data visualization.
|
|
82
|
+
|
|
83
|
+
#### Props
|
|
84
|
+
|
|
85
|
+
| Prop | Type | Required | Default | Description |
|
|
86
|
+
|------|------|----------|---------|-------------|
|
|
87
|
+
| `maxValue` | `number` | ✅ | - | Maximum value for the bar chart |
|
|
88
|
+
| `relativeValue` | `number` | ✅ | - | Relative/current value to compare against max |
|
|
89
|
+
| `value` | `number` | ✅ | - | Value to display in text |
|
|
90
|
+
| `unit` | `string` | ✅ | - | Unit label (e.g., "MWh") |
|
|
91
|
+
| `label` | `string` | ✅ | - | Description label (e.g., "Soutirage") |
|
|
92
|
+
| `backgroundColor` | `string` | ❌ | `#005896` | Background color of the container |
|
|
93
|
+
| `barHeight` | `number` | ❌ | `103` | Height of the histogram bar in pixels |
|
|
94
|
+
| `width` | `number` | ❌ | `54` | Width of the component in pixels |
|
|
95
|
+
|
|
96
|
+
#### Features
|
|
97
|
+
|
|
98
|
+
- **Smooth animations**: 2-second Chart.js-style transitions
|
|
99
|
+
- **Incremental updates**: Animations from previous to new values (not from 0)
|
|
100
|
+
- **Two-color visualization**:
|
|
101
|
+
- Background bar (`#D3D64E`) represents the maximum value
|
|
102
|
+
- Foreground bar (`#C0C402`) represents the relative value
|
|
103
|
+
- **Customizable**: Colors, dimensions, and styling options
|
|
104
|
+
- **TypeScript support**: Full type definitions included
|
|
105
|
+
|
|
106
|
+
## Styling
|
|
107
|
+
|
|
108
|
+
The component uses external CSS classes for styling. Make sure to import the CSS file:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import 'rte-utils/dist/index.css';
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
You can override the default styles by targeting the CSS classes:
|
|
115
|
+
|
|
116
|
+
- `.histogramme-container`
|
|
117
|
+
- `.histogramme-content`
|
|
118
|
+
- `.histogramme-bar`
|
|
119
|
+
- `.histogramme-svg`
|
|
120
|
+
- `.histogramme-text-container`
|
|
121
|
+
- `.histogramme-value-container`
|
|
122
|
+
- `.histogramme-value`
|
|
123
|
+
- `.histogramme-unit`
|
|
124
|
+
- `.histogramme-label`
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.histogramme-container{height:auto;padding:34px 0;position:relative}.histogramme-content{align-items:center;display:flex;flex-direction:column;gap:16px;width:100%}.histogramme-bar{position:relative}.histogramme-svg{display:block}.histogramme-text-container{align-items:center;display:flex;flex-direction:column;gap:2px;width:100%}.histogramme-value-container{text-align:center;width:40px}.histogramme-value{font-size:16px;line-height:14px}.histogramme-unit,.histogramme-value{color:#fff;display:block;font-family:Open Sans,sans-serif;font-weight:600;margin:0}.histogramme-unit{font-size:12px}.histogramme-label{color:#dddfe0;font-family:Open Sans,sans-serif;font-size:12px;font-weight:400;line-height:18px;margin:0;text-align:left;white-space:nowrap}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.histogramme-container{height:auto;padding:34px 0;position:relative}.histogramme-content{align-items:center;display:flex;flex-direction:column;gap:16px;width:100%}.histogramme-bar{position:relative}.histogramme-svg{display:block}.histogramme-text-container{align-items:center;display:flex;flex-direction:column;gap:2px;width:100%}.histogramme-value-container{text-align:center;width:40px}.histogramme-value{font-size:16px;line-height:14px}.histogramme-unit,.histogramme-value{color:#fff;display:block;font-family:Open Sans,sans-serif;font-weight:600;margin:0}.histogramme-unit{font-size:12px}.histogramme-label{color:#dddfe0;font-family:Open Sans,sans-serif;font-size:12px;font-weight:400;line-height:18px;margin:0;text-align:left;white-space:nowrap}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useState as r,useRef as t,useEffect as i}from"react";var n=function(n){var c=n.maxValue,m=n.relativeValue,l=n.value,o=n.unit,h=n.label,s=n.backgroundColor,u=void 0===s?"#005896":s,d=n.barHeight,v=void 0===d?103:d,g=n.width,w=void 0===g?54:g,x=r(0),p=x[0],f=x[1],N=r(!1),M=N[0],b=N[1],D=t(null),q=t(!0),y=Math.min(m/c*100,100),A=v,C=M?p:y/100*v;return i(function(){var e=Math.min(m/c*100,100)/100*v;if(q.current){q.current=!1,b(!0),f(0),D.current=m;var a=Date.now(),r=function(){var t=Date.now()-a,i=Math.min(t/1e3,1),n=1-Math.pow(1-i,4);f(e*n),i<1?requestAnimationFrame(r):b(!1)};requestAnimationFrame(r)}else{if(null!==D.current&&D.current!==m){var t=Math.min(D.current/c*100,100)/100*v;b(!0),f(t);var i=Date.now(),n=function(){var a=Date.now()-i,r=Math.min(a/2e3,1),c=1-Math.pow(1-r,4);f(t+(e-t)*c),r<1?requestAnimationFrame(n):b(!1)};requestAnimationFrame(n)}else null===D.current&&f(e);D.current=m}},[m,c,v]),e("div",{className:"histogramme-container",style:{backgroundColor:u,width:"".concat(w,"px")},children:a("div",{className:"histogramme-content",children:[e("div",{className:"histogramme-bar",style:{height:"".concat(v,"px"),width:"32px"},children:a("svg",{width:"32",height:v,viewBox:"0 0 32 ".concat(v),className:"histogramme-svg",children:[e("rect",{x:"0",y:v-A,width:"32",height:A,fill:"#D3D64E",rx:"2"}),e("rect",{x:"0",y:v-C,width:"32",height:C,fill:"#C0C402",rx:"2"})]})}),a("div",{className:"histogramme-text-container",children:[a("div",{className:"histogramme-value-container",children:[e("p",{className:"histogramme-value",children:l}),e("p",{className:"histogramme-unit",children:o})]}),e("div",{children:e("p",{className:"histogramme-label",children:h})})]})]})})};export{n as Histogramme};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/Histogramme.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from \"react\";\n\ninterface HistogrammeProps {\n /** Maximum value for the bar chart */\n maxValue: number;\n /** Relative/current value to compare against max */\n relativeValue: number;\n /** Value to display in text */\n value: number;\n /** Unit label (e.g., \"MWh\") */\n unit: string;\n /** Description label (e.g., \"Soutirage\") */\n label: string;\n /** Background color of the container */\n backgroundColor?: string;\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the component in pixels */\n width?: number;\n}\n\nexport const Histogramme: React.FC<HistogrammeProps> = ({\n maxValue,\n relativeValue,\n value,\n unit,\n label,\n backgroundColor = \"#005896\",\n barHeight = 103,\n width = 54,\n}) => {\n // Animation state\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [isAnimating, setIsAnimating] = useState(false);\n const previousValueRef = useRef<number | null>(null);\n const isInitialMount = useRef(true);\n\n // Calculate the height percentages for the two bars\n const maxPercentage = 100;\n const relativePercentage = Math.min((relativeValue / maxValue) * 100, 100);\n\n // Calculate actual heights in pixels\n const maxBarHeight = barHeight;\n const targetRelativeBarHeight = (relativePercentage / 100) * barHeight;\n const currentRelativeBarHeight = isAnimating\n ? animatedHeight\n : targetRelativeBarHeight;\n\n // Animation effect\n useEffect(() => {\n const targetHeight =\n (Math.min((relativeValue / maxValue) * 100, 100) / 100) * barHeight;\n\n // On initial mount, start from 0\n if (isInitialMount.current) {\n isInitialMount.current = false;\n setIsAnimating(true);\n setAnimatedHeight(0);\n previousValueRef.current = relativeValue;\n\n const startTime = Date.now();\n const duration = 1000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight = targetHeight * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n return;\n }\n\n // For subsequent updates, animate from previous value to new value\n if (\n previousValueRef.current !== null &&\n previousValueRef.current !== relativeValue\n ) {\n const previousHeight =\n (Math.min((previousValueRef.current / maxValue) * 100, 100) / 100) *\n barHeight;\n setIsAnimating(true);\n setAnimatedHeight(previousHeight);\n\n const startTime = Date.now();\n const duration = 2000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight =\n previousHeight + (targetHeight - previousHeight) * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n } else if (previousValueRef.current === null) {\n // Set initial value without animation if no previous value\n setAnimatedHeight(targetHeight);\n }\n\n previousValueRef.current = relativeValue;\n }, [relativeValue, maxValue, barHeight]);\n const containerStyle: React.CSSProperties = {\n backgroundColor,\n position: \"relative\",\n width: `${width}px`,\n height: \"auto\",\n padding: \"34px 0\",\n };\n\n const contentStyle: React.CSSProperties = {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"16px\",\n width: \"100%\",\n };\n\n const histogramStyle: React.CSSProperties = {\n height: `${barHeight}px`,\n width: \"32px\",\n position: \"relative\",\n };\n\n const imageStyle: React.CSSProperties = {\n display: \"block\",\n maxWidth: \"none\",\n width: \"100%\",\n height: \"100%\",\n };\n\n const textContainerStyle: React.CSSProperties = {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"2px\",\n width: \"100%\",\n };\n\n const valueContainerStyle: React.CSSProperties = {\n textAlign: \"center\",\n width: \"40px\",\n };\n\n const valueStyle: React.CSSProperties = {\n fontFamily: \"'Open Sans', sans-serif\",\n fontWeight: 600,\n fontSize: \"16px\",\n lineHeight: \"14px\",\n color: \"#FFFFFF\",\n margin: 0,\n display: \"block\",\n };\n\n const unitStyle: React.CSSProperties = {\n fontFamily: \"'Open Sans', sans-serif\",\n fontWeight: 600,\n fontSize: \"12px\",\n color: \"#FFFFFF\",\n margin: 0,\n display: \"block\",\n };\n\n const labelStyle: React.CSSProperties = {\n fontFamily: \"'Open Sans', sans-serif\",\n fontWeight: 400,\n fontSize: \"12px\",\n lineHeight: \"18px\",\n color: \"#DDDFE0\",\n textAlign: \"left\",\n whiteSpace: \"nowrap\",\n margin: 0,\n };\n\n return (\n <div style={containerStyle}>\n <div style={contentStyle}>\n <div style={histogramStyle}>\n <svg\n width=\"32\"\n height={barHeight}\n viewBox={`0 0 32 ${barHeight}`}\n style={{ display: \"block\" }}\n >\n {/* Background bar (max value) */}\n <rect\n x=\"0\"\n y={barHeight - maxBarHeight}\n width=\"32\"\n height={maxBarHeight}\n fill=\"#D3D64E\"\n rx=\"2\"\n />\n {/* Foreground bar (relative value) with animation */}\n <rect\n x=\"0\"\n y={barHeight - currentRelativeBarHeight}\n width=\"32\"\n height={currentRelativeBarHeight}\n fill=\"#C0C402\"\n rx=\"2\"\n />\n </svg>\n </div>\n <div style={textContainerStyle}>\n <div style={valueContainerStyle}>\n <p style={valueStyle}>{value}</p>\n <p style={unitStyle}>{unit}</p>\n </div>\n <div>\n <p style={labelStyle}>{label}</p>\n </div>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["Histogramme","_a","maxValue","relativeValue","value","unit","label","_b","backgroundColor","_c","barHeight","_d","width","_e","useState","animatedHeight","setAnimatedHeight","_f","isAnimating","setIsAnimating","previousValueRef","useRef","isInitialMount","relativePercentage","Math","min","maxBarHeight","currentRelativeBarHeight","useEffect","targetHeight","current","startTime_1","Date","now","animate_1","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","previousHeight_1","startTime_2","animate_2","containerStyle","position","concat","height","padding","histogramStyle","_jsx","style","children","_jsxs","display","flexDirection","alignItems","gap","viewBox","x","y","fill","rx","textAlign","fontFamily","fontWeight","fontSize","lineHeight","color","margin","whiteSpace"],"mappings":"8GAqBO,IAAMA,EAA0C,SAACC,GACtD,IAAAC,EAAQD,EAAAC,SACRC,EAAaF,EAAAE,cACbC,EAAKH,EAAAG,MACLC,EAAIJ,EAAAI,KACJC,EAAKL,EAAAK,MACLC,EAA2BN,EAAAO,gBAA3BA,OAAe,IAAAD,EAAG,UAASA,EAC3BE,EAAAR,EAAAS,UAAAA,OAAS,IAAAD,EAAG,IAAGA,EACfE,EAAUV,EAAAW,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAGJE,EAAsCC,EAAS,GAA9CC,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAClCI,EAAgCH,GAAS,GAAxCI,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAC5BG,EAAmBC,EAAsB,MACzCC,EAAiBD,GAAO,GAIxBE,EAAqBC,KAAKC,IAAKtB,EAAgBD,EAAY,IAAK,KAGhEwB,EAAehB,EAEfiB,EAA2BT,EAC7BH,EAF6BQ,EAAqB,IAAOb,EAM7DkB,EAAU,WACR,IAAMC,EACHL,KAAKC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AcQ,SACxBC,EAAK,MAAA,CAAAF,MAlEiC,CACxCG,QAAS,OACTC,cAAe,SACfC,WAAY,SACZC,IAAK,OACL5C,MAAO,QA8DHuC,SAAA,CAAAF,EAAA,MAAA,CAAKC,MAAOF,EACVG,SAAAC,EAAA,MAAA,CACExC,MAAM,KACNkC,OAAQpC,EACR+C,QAAS,UAAAZ,OAAUnC,GACnBwC,MAAO,CAAEG,QAAS,SAASF,SAAA,CAG3BF,EACE,OAAA,CAAAS,EAAE,IACFC,EAAGjD,EAAYgB,EACfd,MAAM,KACNkC,OAAQpB,EACRkC,KAAK,UACLC,GAAG,MAGLZ,EAAA,OAAA,CACES,EAAE,IACFC,EAAGjD,EAAYiB,EACff,MAAM,KACNkC,OAAQnB,EACRiC,KAAK,UACLC,GAAG,WAITT,EAAA,MAAA,CAAKF,MAzEqC,CAC9CG,QAAS,OACTC,cAAe,SACfC,WAAY,SACZC,IAAK,MACL5C,MAAO,QAqEDuC,SAAA,CAAAC,EAAA,MAAA,CAAKF,MAlEoC,CAC/CY,UAAW,SACXlD,MAAO,QAgE8BuC,SAAA,CAC7BF,EAAG,IAAA,CAAAC,MA9D2B,CACtCa,WAAY,0BACZC,WAAY,IACZC,SAAU,OACVC,WAAY,OACZC,MAAO,UACPC,OAAQ,EACRf,QAAS,SAuDmBF,SAAG/C,IACvB6C,EAAA,IAAA,CAAGC,MArD0B,CACrCa,WAAY,0BACZC,WAAY,IACZC,SAAU,OACVE,MAAO,UACPC,OAAQ,EACRf,QAAS,SA+CqBF,SAAA9C,OAExB4C,EAAA,MAAA,CAAAE,SACEF,EAAG,IAAA,CAAAC,MA/C2B,CACtCa,WAAY,0BACZC,WAAY,IACZC,SAAU,OACVC,WAAY,OACZC,MAAO,UACPL,UAAW,OACXO,WAAY,SACZD,OAAQ,GAuCoBjB,SAAG7C,aAMnC"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/Histogramme.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from \"react\";\nimport \"./Histogramme.css\";\n\ninterface HistogrammeProps {\n /** Maximum value for the bar chart */\n maxValue: number;\n /** Relative/current value to compare against max */\n relativeValue: number;\n /** Value to display in text */\n value: number;\n /** Unit label (e.g., \"MWh\") */\n unit: string;\n /** Description label (e.g., \"Soutirage\") */\n label: string;\n /** Background color of the container */\n backgroundColor?: string;\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the component in pixels */\n width?: number;\n}\n\nexport const Histogramme: React.FC<HistogrammeProps> = ({\n maxValue,\n relativeValue,\n value,\n unit,\n label,\n backgroundColor = \"#005896\",\n barHeight = 103,\n width = 54,\n}) => {\n // Animation state\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [isAnimating, setIsAnimating] = useState(false);\n const previousValueRef = useRef<number | null>(null);\n const isInitialMount = useRef(true);\n\n // Calculate the height percentages for the two bars\n const maxPercentage = 100;\n const relativePercentage = Math.min((relativeValue / maxValue) * 100, 100);\n\n // Calculate actual heights in pixels\n const maxBarHeight = barHeight;\n const targetRelativeBarHeight = (relativePercentage / 100) * barHeight;\n const currentRelativeBarHeight = isAnimating\n ? animatedHeight\n : targetRelativeBarHeight;\n\n // Animation effect\n useEffect(() => {\n const targetHeight =\n (Math.min((relativeValue / maxValue) * 100, 100) / 100) * barHeight;\n\n // On initial mount, start from 0\n if (isInitialMount.current) {\n isInitialMount.current = false;\n setIsAnimating(true);\n setAnimatedHeight(0);\n previousValueRef.current = relativeValue;\n\n const startTime = Date.now();\n const duration = 1000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight = targetHeight * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n return;\n }\n\n // For subsequent updates, animate from previous value to new value\n if (\n previousValueRef.current !== null &&\n previousValueRef.current !== relativeValue\n ) {\n const previousHeight =\n (Math.min((previousValueRef.current / maxValue) * 100, 100) / 100) *\n barHeight;\n setIsAnimating(true);\n setAnimatedHeight(previousHeight);\n\n const startTime = Date.now();\n const duration = 2000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight =\n previousHeight + (targetHeight - previousHeight) * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n } else if (previousValueRef.current === null) {\n // Set initial value without animation if no previous value\n setAnimatedHeight(targetHeight);\n }\n\n previousValueRef.current = relativeValue;\n }, [relativeValue, maxValue, barHeight]);\n\n return (\n <div \n className=\"histogramme-container\"\n style={{ \n backgroundColor,\n width: `${width}px`\n }}\n >\n <div className=\"histogramme-content\">\n <div \n className=\"histogramme-bar\"\n style={{\n height: `${barHeight}px`,\n width: \"32px\"\n }}\n >\n <svg\n width=\"32\"\n height={barHeight}\n viewBox={`0 0 32 ${barHeight}`}\n className=\"histogramme-svg\"\n >\n {/* Background bar (max value) */}\n <rect\n x=\"0\"\n y={barHeight - maxBarHeight}\n width=\"32\"\n height={maxBarHeight}\n fill=\"#D3D64E\"\n rx=\"2\"\n />\n {/* Foreground bar (relative value) with animation */}\n <rect\n x=\"0\"\n y={barHeight - currentRelativeBarHeight}\n width=\"32\"\n height={currentRelativeBarHeight}\n fill=\"#C0C402\"\n rx=\"2\"\n />\n </svg>\n </div>\n <div className=\"histogramme-text-container\">\n <div className=\"histogramme-value-container\">\n <p className=\"histogramme-value\">{value}</p>\n <p className=\"histogramme-unit\">{unit}</p>\n </div>\n <div>\n <p className=\"histogramme-label\">{label}</p>\n </div>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["Histogramme","_a","maxValue","relativeValue","value","unit","label","_b","backgroundColor","_c","barHeight","_d","width","_e","useState","animatedHeight","setAnimatedHeight","_f","isAnimating","setIsAnimating","previousValueRef","useRef","isInitialMount","relativePercentage","Math","min","maxBarHeight","currentRelativeBarHeight","useEffect","targetHeight","current","startTime_1","Date","now","animate_1","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","previousHeight_1","startTime_2","animate_2","_jsx","className","style","concat","children","_jsxs","height","viewBox","x","y","fill","rx"],"mappings":"8GAsBO,IAAMA,EAA0C,SAACC,GACtD,IAAAC,EAAQD,EAAAC,SACRC,EAAaF,EAAAE,cACbC,EAAKH,EAAAG,MACLC,EAAIJ,EAAAI,KACJC,EAAKL,EAAAK,MACLC,EAA2BN,EAAAO,gBAA3BA,OAAe,IAAAD,EAAG,UAASA,EAC3BE,EAAAR,EAAAS,UAAAA,OAAS,IAAAD,EAAG,IAAGA,EACfE,EAAUV,EAAAW,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAGJE,EAAsCC,EAAS,GAA9CC,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAClCI,EAAgCH,GAAS,GAAxCI,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAC5BG,EAAmBC,EAAsB,MACzCC,EAAiBD,GAAO,GAIxBE,EAAqBC,KAAKC,IAAKtB,EAAgBD,EAAY,IAAK,KAGhEwB,EAAehB,EAEfiB,EAA2BT,EAC7BH,EAF6BQ,EAAqB,IAAOb,EAkF7D,OA5EAkB,EAAU,WACR,IAAMC,EACHL,KAAKC,IAAKtB,EAAgBD,EAAY,IAAK,KAAO,IAAOQ,EAG5D,GAAIY,EAAeQ,QAAnB,CACER,EAAeQ,SAAU,EACzBX,GAAe,GACfH,EAAkB,GAClBI,EAAiBU,QAAU3B,EAE3B,IAAM4B,EAAYC,KAAKC,MAGjBC,EAAU,WACd,IAAMC,EAAUH,KAAKC,MAAQF,EACvBK,EAAWZ,KAAKC,IAAIU,E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ACEQ,EAAE,IACFC,EAAG1C,EAAYiB,EACff,MAAM,KACNqC,OAAQtB,EACR0B,KAAK,UACLC,GAAG,WAITN,EAAA,MAAA,CAAKJ,UAAU,6BAA4BG,SAAA,CACzCC,EAAK,MAAA,CAAAJ,UAAU,8BACbG,SAAA,CAAAJ,EAAA,IAAA,CAAGC,UAAU,oBAAqBG,SAAA3C,IAClCuC,EAAG,IAAA,CAAAC,UAAU,mBAAoBG,SAAA1C,OAEnCsC,EAAA,MAAA,CAAAI,SACEJ,EAAG,IAAA,CAAAC,UAAU,oBAAqBG,SAAAzC,aAM9C"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react");exports.Histogramme=function(
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react");exports.Histogramme=function(a){var r=a.maxValue,i=a.relativeValue,n=a.value,s=a.unit,c=a.label,l=a.backgroundColor,m=void 0===l?"#005896":l,o=a.barHeight,h=void 0===o?103:o,u=a.width,d=void 0===u?54:u,v=t.useState(0),x=v[0],g=v[1],j=t.useState(!1),w=j[0],f=j[1],p=t.useRef(null),N=t.useRef(!0),M=Math.min(i/r*100,100),b=h,q=w?x:M/100*h;return t.useEffect(function(){var e=Math.min(i/r*100,100)/100*h;if(N.current){N.current=!1,f(!0),g(0),p.current=i;var t=Date.now(),a=function(){var r=Date.now()-t,i=Math.min(r/1e3,1),n=1-Math.pow(1-i,4);g(e*n),i<1?requestAnimationFrame(a):f(!1)};requestAnimationFrame(a)}else{if(null!==p.current&&p.current!==i){var n=Math.min(p.current/r*100,100)/100*h;f(!0),g(n);var s=Date.now(),c=function(){var t=Date.now()-s,a=Math.min(t/2e3,1),r=1-Math.pow(1-a,4);g(n+(e-n)*r),a<1?requestAnimationFrame(c):f(!1)};requestAnimationFrame(c)}else null===p.current&&g(e);p.current=i}},[i,r,h]),e.jsx("div",{className:"histogramme-container",style:{backgroundColor:m,width:"".concat(d,"px")},children:e.jsxs("div",{className:"histogramme-content",children:[e.jsx("div",{className:"histogramme-bar",style:{height:"".concat(h,"px"),width:"32px"},children:e.jsxs("svg",{width:"32",height:h,viewBox:"0 0 32 ".concat(h),className:"histogramme-svg",children:[e.jsx("rect",{x:"0",y:h-b,width:"32",height:b,fill:"#D3D64E",rx:"2"}),e.jsx("rect",{x:"0",y:h-q,width:"32",height:q,fill:"#C0C402",rx:"2"})]})}),e.jsxs("div",{className:"histogramme-text-container",children:[e.jsxs("div",{className:"histogramme-value-container",children:[e.jsx("p",{className:"histogramme-value",children:n}),e.jsx("p",{className:"histogramme-unit",children:s})]}),e.jsx("div",{children:e.jsx("p",{className:"histogramme-label",children:c})})]})]})})};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/Histogramme.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from \"react\";\n\ninterface HistogrammeProps {\n /** Maximum value for the bar chart */\n maxValue: number;\n /** Relative/current value to compare against max */\n relativeValue: number;\n /** Value to display in text */\n value: number;\n /** Unit label (e.g., \"MWh\") */\n unit: string;\n /** Description label (e.g., \"Soutirage\") */\n label: string;\n /** Background color of the container */\n backgroundColor?: string;\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the component in pixels */\n width?: number;\n}\n\nexport const Histogramme: React.FC<HistogrammeProps> = ({\n maxValue,\n relativeValue,\n value,\n unit,\n label,\n backgroundColor = \"#005896\",\n barHeight = 103,\n width = 54,\n}) => {\n // Animation state\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [isAnimating, setIsAnimating] = useState(false);\n const previousValueRef = useRef<number | null>(null);\n const isInitialMount = useRef(true);\n\n // Calculate the height percentages for the two bars\n const maxPercentage = 100;\n const relativePercentage = Math.min((relativeValue / maxValue) * 100, 100);\n\n // Calculate actual heights in pixels\n const maxBarHeight = barHeight;\n const targetRelativeBarHeight = (relativePercentage / 100) * barHeight;\n const currentRelativeBarHeight = isAnimating\n ? animatedHeight\n : targetRelativeBarHeight;\n\n // Animation effect\n useEffect(() => {\n const targetHeight =\n (Math.min((relativeValue / maxValue) * 100, 100) / 100) * barHeight;\n\n // On initial mount, start from 0\n if (isInitialMount.current) {\n isInitialMount.current = false;\n setIsAnimating(true);\n setAnimatedHeight(0);\n previousValueRef.current = relativeValue;\n\n const startTime = Date.now();\n const duration = 1000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight = targetHeight * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n return;\n }\n\n // For subsequent updates, animate from previous value to new value\n if (\n previousValueRef.current !== null &&\n previousValueRef.current !== relativeValue\n ) {\n const previousHeight =\n (Math.min((previousValueRef.current / maxValue) * 100, 100) / 100) *\n barHeight;\n setIsAnimating(true);\n setAnimatedHeight(previousHeight);\n\n const startTime = Date.now();\n const duration = 2000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight =\n previousHeight + (targetHeight - previousHeight) * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n } else if (previousValueRef.current === null) {\n // Set initial value without animation if no previous value\n setAnimatedHeight(targetHeight);\n }\n\n previousValueRef.current = relativeValue;\n }, [relativeValue, maxValue, barHeight]);\n const containerStyle: React.CSSProperties = {\n backgroundColor,\n position: \"relative\",\n width: `${width}px`,\n height: \"auto\",\n padding: \"34px 0\",\n };\n\n const contentStyle: React.CSSProperties = {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"16px\",\n width: \"100%\",\n };\n\n const histogramStyle: React.CSSProperties = {\n height: `${barHeight}px`,\n width: \"32px\",\n position: \"relative\",\n };\n\n const imageStyle: React.CSSProperties = {\n display: \"block\",\n maxWidth: \"none\",\n width: \"100%\",\n height: \"100%\",\n };\n\n const textContainerStyle: React.CSSProperties = {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"2px\",\n width: \"100%\",\n };\n\n const valueContainerStyle: React.CSSProperties = {\n textAlign: \"center\",\n width: \"40px\",\n };\n\n const valueStyle: React.CSSProperties = {\n fontFamily: \"'Open Sans', sans-serif\",\n fontWeight: 600,\n fontSize: \"16px\",\n lineHeight: \"14px\",\n color: \"#FFFFFF\",\n margin: 0,\n display: \"block\",\n };\n\n const unitStyle: React.CSSProperties = {\n fontFamily: \"'Open Sans', sans-serif\",\n fontWeight: 600,\n fontSize: \"12px\",\n color: \"#FFFFFF\",\n margin: 0,\n display: \"block\",\n };\n\n const labelStyle: React.CSSProperties = {\n fontFamily: \"'Open Sans', sans-serif\",\n fontWeight: 400,\n fontSize: \"12px\",\n lineHeight: \"18px\",\n color: \"#DDDFE0\",\n textAlign: \"left\",\n whiteSpace: \"nowrap\",\n margin: 0,\n };\n\n return (\n <div style={containerStyle}>\n <div style={contentStyle}>\n <div style={histogramStyle}>\n <svg\n width=\"32\"\n height={barHeight}\n viewBox={`0 0 32 ${barHeight}`}\n style={{ display: \"block\" }}\n >\n {/* Background bar (max value) */}\n <rect\n x=\"0\"\n y={barHeight - maxBarHeight}\n width=\"32\"\n height={maxBarHeight}\n fill=\"#D3D64E\"\n rx=\"2\"\n />\n {/* Foreground bar (relative value) with animation */}\n <rect\n x=\"0\"\n y={barHeight - currentRelativeBarHeight}\n width=\"32\"\n height={currentRelativeBarHeight}\n fill=\"#C0C402\"\n rx=\"2\"\n />\n </svg>\n </div>\n <div style={textContainerStyle}>\n <div style={valueContainerStyle}>\n <p style={valueStyle}>{value}</p>\n <p style={unitStyle}>{unit}</p>\n </div>\n <div>\n <p style={labelStyle}>{label}</p>\n </div>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["_a","maxValue","relativeValue","value","unit","label","_b","backgroundColor","_c","barHeight","_d","width","_e","useState","animatedHeight","setAnimatedHeight","_f","isAnimating","setIsAnimating","previousValueRef","useRef","isInitialMount","relativePercentage","Math","min","maxBarHeight","currentRelativeBarHeight","useEffect","targetHeight","current","startTime_1","Date","now","animate_1","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","previousHeight_1","startTime_2","animate_2","containerStyle","position","concat","height","padding","histogramStyle","_jsx","jsx","style","children","_jsxs","display","flexDirection","alignItems","gap","viewBox","x","y","fill","rx","textAlign","fontFamily","fontWeight","fontSize","lineHeight","color","margin","whiteSpace"],"mappings":"uFAqBuD,SAACA,GACtD,IAAAC,EAAQD,EAAAC,SACRC,EAAaF,EAAAE,cACbC,EAAKH,EAAAG,MACLC,EAAIJ,EAAAI,KACJC,EAAKL,EAAAK,MACLC,EAA2BN,EAAAO,gBAA3BA,OAAe,IAAAD,EAAG,UAASA,EAC3BE,EAAAR,EAAAS,UAAAA,OAAS,IAAAD,EAAG,IAAGA,EACfE,EAAUV,EAAAW,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAGJE,EAAsCC,EAAAA,SAAS,GAA9CC,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAClCI,EAAgCH,EAAAA,UAAS,GAAxCI,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAC5BG,EAAmBC,SAAsB,MACzCC,EAAiBD,UAAO,GAIxBE,EAAqBC,KAAKC,IAAKtB,EAAgBD,EAAY,IAAK,KAGhEwB,EAAehB,EAEfiB,EAA2BT,EAC7BH,EAF6BQ,EAAqB,IAAOb,EAM7DkB,EAAAA,UAAU,WACR,IAAMC,EACHL,KAAKC,IA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index.js","sources":["../src/components/Histogramme.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from \"react\";\nimport \"./Histogramme.css\";\n\ninterface HistogrammeProps {\n /** Maximum value for the bar chart */\n maxValue: number;\n /** Relative/current value to compare against max */\n relativeValue: number;\n /** Value to display in text */\n value: number;\n /** Unit label (e.g., \"MWh\") */\n unit: string;\n /** Description label (e.g., \"Soutirage\") */\n label: string;\n /** Background color of the container */\n backgroundColor?: string;\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the component in pixels */\n width?: number;\n}\n\nexport const Histogramme: React.FC<HistogrammeProps> = ({\n maxValue,\n relativeValue,\n value,\n unit,\n label,\n backgroundColor = \"#005896\",\n barHeight = 103,\n width = 54,\n}) => {\n // Animation state\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [isAnimating, setIsAnimating] = useState(false);\n const previousValueRef = useRef<number | null>(null);\n const isInitialMount = useRef(true);\n\n // Calculate the height percentages for the two bars\n const maxPercentage = 100;\n const relativePercentage = Math.min((relativeValue / maxValue) * 100, 100);\n\n // Calculate actual heights in pixels\n const maxBarHeight = barHeight;\n const targetRelativeBarHeight = (relativePercentage / 100) * barHeight;\n const currentRelativeBarHeight = isAnimating\n ? animatedHeight\n : targetRelativeBarHeight;\n\n // Animation effect\n useEffect(() => {\n const targetHeight =\n (Math.min((relativeValue / maxValue) * 100, 100) / 100) * barHeight;\n\n // On initial mount, start from 0\n if (isInitialMount.current) {\n isInitialMount.current = false;\n setIsAnimating(true);\n setAnimatedHeight(0);\n previousValueRef.current = relativeValue;\n\n const startTime = Date.now();\n const duration = 1000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight = targetHeight * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n return;\n }\n\n // For subsequent updates, animate from previous value to new value\n if (\n previousValueRef.current !== null &&\n previousValueRef.current !== relativeValue\n ) {\n const previousHeight =\n (Math.min((previousValueRef.current / maxValue) * 100, 100) / 100) *\n barHeight;\n setIsAnimating(true);\n setAnimatedHeight(previousHeight);\n\n const startTime = Date.now();\n const duration = 2000; // 2 seconds\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing function (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n const currentHeight =\n previousHeight + (targetHeight - previousHeight) * easeOutQuart;\n setAnimatedHeight(currentHeight);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n } else {\n setIsAnimating(false);\n }\n };\n\n requestAnimationFrame(animate);\n } else if (previousValueRef.current === null) {\n // Set initial value without animation if no previous value\n setAnimatedHeight(targetHeight);\n }\n\n previousValueRef.current = relativeValue;\n }, [relativeValue, maxValue, barHeight]);\n\n return (\n <div \n className=\"histogramme-container\"\n style={{ \n backgroundColor,\n width: `${width}px`\n }}\n >\n <div className=\"histogramme-content\">\n <div \n className=\"histogramme-bar\"\n style={{\n height: `${barHeight}px`,\n width: \"32px\"\n }}\n >\n <svg\n width=\"32\"\n height={barHeight}\n viewBox={`0 0 32 ${barHeight}`}\n className=\"histogramme-svg\"\n >\n {/* Background bar (max value) */}\n <rect\n x=\"0\"\n y={barHeight - maxBarHeight}\n width=\"32\"\n height={maxBarHeight}\n fill=\"#D3D64E\"\n rx=\"2\"\n />\n {/* Foreground bar (relative value) with animation */}\n <rect\n x=\"0\"\n y={barHeight - currentRelativeBarHeight}\n width=\"32\"\n height={currentRelativeBarHeight}\n fill=\"#C0C402\"\n rx=\"2\"\n />\n </svg>\n </div>\n <div className=\"histogramme-text-container\">\n <div className=\"histogramme-value-container\">\n <p className=\"histogramme-value\">{value}</p>\n <p className=\"histogramme-unit\">{unit}</p>\n </div>\n <div>\n <p className=\"histogramme-label\">{label}</p>\n </div>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["_a","maxValue","relativeValue","value","unit","label","_b","backgroundColor","_c","barHeight","_d","width","_e","useState","animatedHeight","setAnimatedHeight","_f","isAnimating","setIsAnimating","previousValueRef","useRef","isInitialMount","relativePercentage","Math","min","maxBarHeight","currentRelativeBarHeight","useEffect","targetHeight","current","startTime_1","Date","now","animate_1","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","previousHeight_1","startTime_2","animate_2","_jsx","jsx","className","style","concat","children","_jsxs","jsxs","height","viewBox","x","y","fill","rx"],"mappings":"uFAsBuD,SAACA,GACtD,IAAAC,EAAQD,EAAAC,SACRC,EAAaF,EAAAE,cACbC,EAAKH,EAAAG,MACLC,EAAIJ,EAAAI,KACJC,EAAKL,EAAAK,MACLC,EAA2BN,EAAAO,gBAA3BA,OAAe,IAAAD,EAAG,UAASA,EAC3BE,EAAAR,EAAAS,UAAAA,OAAS,IAAAD,EAAG,IAAGA,EACfE,EAAUV,EAAAW,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAGJE,EAAsCC,EAAAA,SAAS,GAA9CC,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAClCI,EAAgCH,EAAAA,UAAS,GAAxCI,EAAWD,EAAA,GAAEE,EAAcF,EAAA,GAC5BG,EAAmBC,SAAsB,MACzCC,EAAiBD,UAAO,GAIxBE,EAAqBC,KAAKC,IAAKtB,EAAgBD,EAAY,IAAK,KAGhEwB,EAAehB,EAEfiB,EAA2BT,EAC7BH,EAF6BQ,EAAqB,IAAOb,EAkF7D,OA5EAkB,EAAAA,UAAU,WACR,IAAMC,EACHL,KAAKC,IAAKtB,EAAgBD,EAAY,IAAK,KAAO,IAAOQ,EAG5D,GAAIY,EAAeQ,QAAnB,CACER,EAAeQ,SAAU,EACzBX,GAAe,GACfH,EAAkB,GAClBI,EAAiBU,QAAU3B,EAE3B,IAAM4B,EAAYC,KAAKC,MAGjB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AAE,IACFC,EAAG5C,EAAYgB,EACfd,MAAM,KACNuC,OAAQzB,EACR6B,KAAK,UACLC,GAAG,MAGLb,EAAAC,IAAA,OAAA,CACES,EAAE,IACFC,EAAG5C,EAAYiB,EACff,MAAM,KACNuC,OAAQxB,EACR4B,KAAK,UACLC,GAAG,WAITP,EAAAA,KAAA,MAAA,CAAKJ,UAAU,6BAA4BG,SAAA,CACzCC,EAAAA,KAAK,MAAA,CAAAJ,UAAU,8BACbG,SAAA,CAAAL,EAAAA,IAAA,IAAA,CAAGE,UAAU,oBAAqBG,SAAA5C,IAClCuC,EAAGC,IAAA,IAAA,CAAAC,UAAU,mBAAoBG,SAAA3C,OAEnCsC,EAAAC,IAAA,MAAA,CAAAI,SACEL,EAAAA,IAAG,IAAA,CAAAE,UAAU,oBAAqBG,SAAA1C,aAM9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rte-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "React components library in TypeScript for agigox projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,366 +45,10 @@
|
|
|
45
45
|
"jest": "^29.6.0",
|
|
46
46
|
"rollup": "^3.26.0",
|
|
47
47
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
48
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
48
49
|
"tslib": "^2.8.1",
|
|
49
50
|
"typescript": "^5.1.0"
|
|
50
51
|
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"acorn": "^8.15.0",
|
|
53
|
-
"acorn-jsx": "^5.3.2",
|
|
54
|
-
"ajv": "^6.12.6",
|
|
55
|
-
"ansi-escapes": "^4.3.2",
|
|
56
|
-
"ansi-regex": "^5.0.1",
|
|
57
|
-
"ansi-styles": "^4.3.0",
|
|
58
|
-
"anymatch": "^3.1.3",
|
|
59
|
-
"argparse": "^2.0.1",
|
|
60
|
-
"array-buffer-byte-length": "^1.0.2",
|
|
61
|
-
"array-includes": "^3.1.9",
|
|
62
|
-
"array-union": "^2.1.0",
|
|
63
|
-
"array.prototype.findlast": "^1.2.5",
|
|
64
|
-
"array.prototype.flat": "^1.3.3",
|
|
65
|
-
"array.prototype.flatmap": "^1.3.3",
|
|
66
|
-
"array.prototype.tosorted": "^1.1.4",
|
|
67
|
-
"arraybuffer.prototype.slice": "^1.0.4",
|
|
68
|
-
"async-function": "^1.0.0",
|
|
69
|
-
"available-typed-arrays": "^1.0.7",
|
|
70
|
-
"babel-jest": "^29.7.0",
|
|
71
|
-
"babel-plugin-istanbul": "^6.1.1",
|
|
72
|
-
"babel-plugin-jest-hoist": "^29.6.3",
|
|
73
|
-
"babel-preset-current-node-syntax": "^1.1.1",
|
|
74
|
-
"babel-preset-jest": "^29.6.3",
|
|
75
|
-
"balanced-match": "^1.0.2",
|
|
76
|
-
"brace-expansion": "^2.0.2",
|
|
77
|
-
"braces": "^3.0.3",
|
|
78
|
-
"browserslist": "^4.25.1",
|
|
79
|
-
"bser": "^2.1.1",
|
|
80
|
-
"buffer-from": "^1.1.2",
|
|
81
|
-
"call-bind": "^1.0.8",
|
|
82
|
-
"call-bind-apply-helpers": "^1.0.2",
|
|
83
|
-
"call-bound": "^1.0.4",
|
|
84
|
-
"callsites": "^3.1.0",
|
|
85
|
-
"camelcase": "^5.3.1",
|
|
86
|
-
"caniuse-lite": "^1.0.30001731",
|
|
87
|
-
"chalk": "^4.1.2",
|
|
88
|
-
"char-regex": "^1.0.2",
|
|
89
|
-
"ci-info": "^3.9.0",
|
|
90
|
-
"cjs-module-lexer": "^1.4.3",
|
|
91
|
-
"cliui": "^8.0.1",
|
|
92
|
-
"co": "^4.6.0",
|
|
93
|
-
"collect-v8-coverage": "^1.0.2",
|
|
94
|
-
"color-convert": "^2.0.1",
|
|
95
|
-
"color-name": "^1.1.4",
|
|
96
|
-
"commander": "^2.20.3",
|
|
97
|
-
"commondir": "^1.0.1",
|
|
98
|
-
"concat-map": "^0.0.1",
|
|
99
|
-
"convert-source-map": "^2.0.0",
|
|
100
|
-
"create-jest": "^29.7.0",
|
|
101
|
-
"cross-spawn": "^7.0.6",
|
|
102
|
-
"csstype": "^3.1.3",
|
|
103
|
-
"data-view-buffer": "^1.0.2",
|
|
104
|
-
"data-view-byte-length": "^1.0.2",
|
|
105
|
-
"data-view-byte-offset": "^1.0.1",
|
|
106
|
-
"debug": "^4.4.1",
|
|
107
|
-
"dedent": "^1.6.0",
|
|
108
|
-
"deep-is": "^0.1.4",
|
|
109
|
-
"deepmerge": "^4.3.1",
|
|
110
|
-
"define-data-property": "^1.1.4",
|
|
111
|
-
"define-properties": "^1.2.1",
|
|
112
|
-
"detect-newline": "^3.1.0",
|
|
113
|
-
"diff-sequences": "^29.6.3",
|
|
114
|
-
"dir-glob": "^3.0.1",
|
|
115
|
-
"doctrine": "^3.0.0",
|
|
116
|
-
"dunder-proto": "^1.0.1",
|
|
117
|
-
"electron-to-chromium": "^1.5.192",
|
|
118
|
-
"emittery": "^0.13.1",
|
|
119
|
-
"emoji-regex": "^8.0.0",
|
|
120
|
-
"error-ex": "^1.3.2",
|
|
121
|
-
"es-abstract": "^1.24.0",
|
|
122
|
-
"es-define-property": "^1.0.1",
|
|
123
|
-
"es-errors": "^1.3.0",
|
|
124
|
-
"es-iterator-helpers": "^1.2.1",
|
|
125
|
-
"es-object-atoms": "^1.1.1",
|
|
126
|
-
"es-set-tostringtag": "^2.1.0",
|
|
127
|
-
"es-shim-unscopables": "^1.1.0",
|
|
128
|
-
"es-to-primitive": "^1.3.0",
|
|
129
|
-
"escalade": "^3.2.0",
|
|
130
|
-
"escape-string-regexp": "^4.0.0",
|
|
131
|
-
"eslint-scope": "^7.2.2",
|
|
132
|
-
"eslint-visitor-keys": "^3.4.3",
|
|
133
|
-
"espree": "^9.6.1",
|
|
134
|
-
"esprima": "^4.0.1",
|
|
135
|
-
"esquery": "^1.6.0",
|
|
136
|
-
"esrecurse": "^4.3.0",
|
|
137
|
-
"estraverse": "^5.3.0",
|
|
138
|
-
"estree-walker": "^2.0.2",
|
|
139
|
-
"esutils": "^2.0.3",
|
|
140
|
-
"execa": "^5.1.1",
|
|
141
|
-
"exit": "^0.1.2",
|
|
142
|
-
"expect": "^29.7.0",
|
|
143
|
-
"fast-deep-equal": "^3.1.3",
|
|
144
|
-
"fast-glob": "^3.3.3",
|
|
145
|
-
"fast-json-stable-stringify": "^2.1.0",
|
|
146
|
-
"fast-levenshtein": "^2.0.6",
|
|
147
|
-
"fastq": "^1.19.1",
|
|
148
|
-
"fb-watchman": "^2.0.2",
|
|
149
|
-
"file-entry-cache": "^6.0.1",
|
|
150
|
-
"fill-range": "^7.1.1",
|
|
151
|
-
"find-up": "^5.0.0",
|
|
152
|
-
"flat-cache": "^3.2.0",
|
|
153
|
-
"flatted": "^3.3.3",
|
|
154
|
-
"for-each": "^0.3.5",
|
|
155
|
-
"fs.realpath": "^1.0.0",
|
|
156
|
-
"fsevents": "^2.3.3",
|
|
157
|
-
"function-bind": "^1.1.2",
|
|
158
|
-
"function.prototype.name": "^1.1.8",
|
|
159
|
-
"functions-have-names": "^1.2.3",
|
|
160
|
-
"gensync": "^1.0.0-beta.2",
|
|
161
|
-
"get-caller-file": "^2.0.5",
|
|
162
|
-
"get-intrinsic": "^1.3.0",
|
|
163
|
-
"get-package-type": "^0.1.0",
|
|
164
|
-
"get-proto": "^1.0.1",
|
|
165
|
-
"get-stream": "^6.0.1",
|
|
166
|
-
"get-symbol-description": "^1.1.0",
|
|
167
|
-
"glob": "^8.1.0",
|
|
168
|
-
"glob-parent": "^6.0.2",
|
|
169
|
-
"globals": "^13.24.0",
|
|
170
|
-
"globalthis": "^1.0.4",
|
|
171
|
-
"globby": "^11.1.0",
|
|
172
|
-
"gopd": "^1.2.0",
|
|
173
|
-
"graceful-fs": "^4.2.11",
|
|
174
|
-
"graphemer": "^1.4.0",
|
|
175
|
-
"has-bigints": "^1.1.0",
|
|
176
|
-
"has-flag": "^4.0.0",
|
|
177
|
-
"has-property-descriptors": "^1.0.2",
|
|
178
|
-
"has-proto": "^1.2.0",
|
|
179
|
-
"has-symbols": "^1.1.0",
|
|
180
|
-
"has-tostringtag": "^1.0.2",
|
|
181
|
-
"hasown": "^2.0.2",
|
|
182
|
-
"html-escaper": "^2.0.2",
|
|
183
|
-
"human-signals": "^2.1.0",
|
|
184
|
-
"ignore": "^5.3.2",
|
|
185
|
-
"import-fresh": "^3.3.1",
|
|
186
|
-
"import-local": "^3.2.0",
|
|
187
|
-
"imurmurhash": "^0.1.4",
|
|
188
|
-
"inflight": "^1.0.6",
|
|
189
|
-
"inherits": "^2.0.4",
|
|
190
|
-
"internal-slot": "^1.1.0",
|
|
191
|
-
"is-array-buffer": "^3.0.5",
|
|
192
|
-
"is-arrayish": "^0.2.1",
|
|
193
|
-
"is-async-function": "^2.1.1",
|
|
194
|
-
"is-bigint": "^1.1.0",
|
|
195
|
-
"is-boolean-object": "^1.2.2",
|
|
196
|
-
"is-callable": "^1.2.7",
|
|
197
|
-
"is-core-module": "^2.16.1",
|
|
198
|
-
"is-data-view": "^1.0.2",
|
|
199
|
-
"is-date-object": "^1.1.0",
|
|
200
|
-
"is-extglob": "^2.1.1",
|
|
201
|
-
"is-finalizationregistry": "^1.1.1",
|
|
202
|
-
"is-fullwidth-code-point": "^3.0.0",
|
|
203
|
-
"is-generator-fn": "^2.1.0",
|
|
204
|
-
"is-generator-function": "^1.1.0",
|
|
205
|
-
"is-glob": "^4.0.3",
|
|
206
|
-
"is-map": "^2.0.3",
|
|
207
|
-
"is-module": "^1.0.0",
|
|
208
|
-
"is-negative-zero": "^2.0.3",
|
|
209
|
-
"is-number": "^7.0.0",
|
|
210
|
-
"is-number-object": "^1.1.1",
|
|
211
|
-
"is-path-inside": "^3.0.3",
|
|
212
|
-
"is-reference": "^1.2.1",
|
|
213
|
-
"is-regex": "^1.2.1",
|
|
214
|
-
"is-set": "^2.0.3",
|
|
215
|
-
"is-shared-array-buffer": "^1.0.4",
|
|
216
|
-
"is-stream": "^2.0.1",
|
|
217
|
-
"is-string": "^1.1.1",
|
|
218
|
-
"is-symbol": "^1.1.1",
|
|
219
|
-
"is-typed-array": "^1.1.15",
|
|
220
|
-
"is-weakmap": "^2.0.2",
|
|
221
|
-
"is-weakref": "^1.1.1",
|
|
222
|
-
"is-weakset": "^2.0.4",
|
|
223
|
-
"isarray": "^2.0.5",
|
|
224
|
-
"isexe": "^2.0.0",
|
|
225
|
-
"istanbul-lib-coverage": "^3.2.2",
|
|
226
|
-
"istanbul-lib-instrument": "^6.0.3",
|
|
227
|
-
"istanbul-lib-report": "^3.0.1",
|
|
228
|
-
"istanbul-lib-source-maps": "^4.0.1",
|
|
229
|
-
"istanbul-reports": "^3.1.7",
|
|
230
|
-
"iterator.prototype": "^1.1.5",
|
|
231
|
-
"jest-changed-files": "^29.7.0",
|
|
232
|
-
"jest-circus": "^29.7.0",
|
|
233
|
-
"jest-cli": "^29.7.0",
|
|
234
|
-
"jest-config": "^29.7.0",
|
|
235
|
-
"jest-diff": "^29.7.0",
|
|
236
|
-
"jest-docblock": "^29.7.0",
|
|
237
|
-
"jest-each": "^29.7.0",
|
|
238
|
-
"jest-environment-node": "^29.7.0",
|
|
239
|
-
"jest-get-type": "^29.6.3",
|
|
240
|
-
"jest-haste-map": "^29.7.0",
|
|
241
|
-
"jest-leak-detector": "^29.7.0",
|
|
242
|
-
"jest-matcher-utils": "^29.7.0",
|
|
243
|
-
"jest-message-util": "^29.7.0",
|
|
244
|
-
"jest-mock": "^29.7.0",
|
|
245
|
-
"jest-pnp-resolver": "^1.2.3",
|
|
246
|
-
"jest-regex-util": "^29.6.3",
|
|
247
|
-
"jest-resolve": "^29.7.0",
|
|
248
|
-
"jest-resolve-dependencies": "^29.7.0",
|
|
249
|
-
"jest-runner": "^29.7.0",
|
|
250
|
-
"jest-runtime": "^29.7.0",
|
|
251
|
-
"jest-snapshot": "^29.7.0",
|
|
252
|
-
"jest-util": "^29.7.0",
|
|
253
|
-
"jest-validate": "^29.7.0",
|
|
254
|
-
"jest-watcher": "^29.7.0",
|
|
255
|
-
"jest-worker": "^29.7.0",
|
|
256
|
-
"js-tokens": "^4.0.0",
|
|
257
|
-
"js-yaml": "^4.1.0",
|
|
258
|
-
"jsesc": "^3.1.0",
|
|
259
|
-
"json-buffer": "^3.0.1",
|
|
260
|
-
"json-parse-even-better-errors": "^2.3.1",
|
|
261
|
-
"json-schema-traverse": "^0.4.1",
|
|
262
|
-
"json-stable-stringify-without-jsonify": "^1.0.1",
|
|
263
|
-
"json5": "^2.2.3",
|
|
264
|
-
"jsx-ast-utils": "^3.3.5",
|
|
265
|
-
"keyv": "^4.5.4",
|
|
266
|
-
"kleur": "^3.0.3",
|
|
267
|
-
"leven": "^3.1.0",
|
|
268
|
-
"levn": "^0.4.1",
|
|
269
|
-
"lines-and-columns": "^1.2.4",
|
|
270
|
-
"locate-path": "^6.0.0",
|
|
271
|
-
"lodash.merge": "^4.6.2",
|
|
272
|
-
"loose-envify": "^1.4.0",
|
|
273
|
-
"lru-cache": "^5.1.1",
|
|
274
|
-
"magic-string": "^0.30.17",
|
|
275
|
-
"make-dir": "^4.0.0",
|
|
276
|
-
"makeerror": "^1.0.12",
|
|
277
|
-
"math-intrinsics": "^1.1.0",
|
|
278
|
-
"merge-stream": "^2.0.0",
|
|
279
|
-
"merge2": "^1.4.1",
|
|
280
|
-
"micromatch": "^4.0.8",
|
|
281
|
-
"mimic-fn": "^2.1.0",
|
|
282
|
-
"minimatch": "^9.0.3",
|
|
283
|
-
"ms": "^2.1.3",
|
|
284
|
-
"natural-compare": "^1.4.0",
|
|
285
|
-
"node-int64": "^0.4.0",
|
|
286
|
-
"node-releases": "^2.0.19",
|
|
287
|
-
"normalize-path": "^3.0.0",
|
|
288
|
-
"npm-run-path": "^4.0.1",
|
|
289
|
-
"object-assign": "^4.1.1",
|
|
290
|
-
"object-inspect": "^1.13.4",
|
|
291
|
-
"object-keys": "^1.1.1",
|
|
292
|
-
"object.assign": "^4.1.7",
|
|
293
|
-
"object.entries": "^1.1.9",
|
|
294
|
-
"object.fromentries": "^2.0.8",
|
|
295
|
-
"object.values": "^1.2.1",
|
|
296
|
-
"once": "^1.4.0",
|
|
297
|
-
"onetime": "^5.1.2",
|
|
298
|
-
"optionator": "^0.9.4",
|
|
299
|
-
"own-keys": "^1.0.1",
|
|
300
|
-
"p-limit": "^3.1.0",
|
|
301
|
-
"p-locate": "^5.0.0",
|
|
302
|
-
"p-try": "^2.2.0",
|
|
303
|
-
"parent-module": "^1.0.1",
|
|
304
|
-
"parse-json": "^5.2.0",
|
|
305
|
-
"path-exists": "^4.0.0",
|
|
306
|
-
"path-is-absolute": "^1.0.1",
|
|
307
|
-
"path-key": "^3.1.1",
|
|
308
|
-
"path-parse": "^1.0.7",
|
|
309
|
-
"path-type": "^4.0.0",
|
|
310
|
-
"picocolors": "^1.1.1",
|
|
311
|
-
"picomatch": "^4.0.3",
|
|
312
|
-
"pirates": "^4.0.7",
|
|
313
|
-
"pkg-dir": "^4.2.0",
|
|
314
|
-
"possible-typed-array-names": "^1.1.0",
|
|
315
|
-
"prelude-ls": "^1.2.1",
|
|
316
|
-
"pretty-format": "^29.7.0",
|
|
317
|
-
"prompts": "^2.4.2",
|
|
318
|
-
"prop-types": "^15.8.1",
|
|
319
|
-
"punycode": "^2.3.1",
|
|
320
|
-
"pure-rand": "^6.1.0",
|
|
321
|
-
"queue-microtask": "^1.2.3",
|
|
322
|
-
"randombytes": "^2.1.0",
|
|
323
|
-
"react": "^19.1.1",
|
|
324
|
-
"react-dom": "^19.1.1",
|
|
325
|
-
"react-is": "^18.3.1",
|
|
326
|
-
"reflect.getprototypeof": "^1.0.10",
|
|
327
|
-
"regexp.prototype.flags": "^1.5.4",
|
|
328
|
-
"require-directory": "^2.1.1",
|
|
329
|
-
"resolve": "^1.22.10",
|
|
330
|
-
"resolve-cwd": "^3.0.0",
|
|
331
|
-
"resolve-from": "^4.0.0",
|
|
332
|
-
"resolve.exports": "^2.0.3",
|
|
333
|
-
"reusify": "^1.1.0",
|
|
334
|
-
"rimraf": "^3.0.2",
|
|
335
|
-
"run-parallel": "^1.2.0",
|
|
336
|
-
"safe-array-concat": "^1.1.3",
|
|
337
|
-
"safe-buffer": "^5.2.1",
|
|
338
|
-
"safe-push-apply": "^1.0.0",
|
|
339
|
-
"safe-regex-test": "^1.1.0",
|
|
340
|
-
"scheduler": "^0.26.0",
|
|
341
|
-
"semver": "^7.7.2",
|
|
342
|
-
"serialize-javascript": "^6.0.2",
|
|
343
|
-
"set-function-length": "^1.2.2",
|
|
344
|
-
"set-function-name": "^2.0.2",
|
|
345
|
-
"set-proto": "^1.0.0",
|
|
346
|
-
"shebang-command": "^2.0.0",
|
|
347
|
-
"shebang-regex": "^3.0.0",
|
|
348
|
-
"side-channel": "^1.1.0",
|
|
349
|
-
"side-channel-list": "^1.0.0",
|
|
350
|
-
"side-channel-map": "^1.0.1",
|
|
351
|
-
"side-channel-weakmap": "^1.0.2",
|
|
352
|
-
"signal-exit": "^3.0.7",
|
|
353
|
-
"sisteransi": "^1.0.5",
|
|
354
|
-
"slash": "^3.0.0",
|
|
355
|
-
"smob": "^1.5.0",
|
|
356
|
-
"source-map": "^0.6.1",
|
|
357
|
-
"source-map-support": "^0.5.13",
|
|
358
|
-
"sprintf-js": "^1.0.3",
|
|
359
|
-
"stack-utils": "^2.0.6",
|
|
360
|
-
"stop-iteration-iterator": "^1.1.0",
|
|
361
|
-
"string-length": "^4.0.2",
|
|
362
|
-
"string-width": "^4.2.3",
|
|
363
|
-
"string.prototype.matchall": "^4.0.12",
|
|
364
|
-
"string.prototype.repeat": "^1.0.0",
|
|
365
|
-
"string.prototype.trim": "^1.2.10",
|
|
366
|
-
"string.prototype.trimend": "^1.0.9",
|
|
367
|
-
"string.prototype.trimstart": "^1.0.8",
|
|
368
|
-
"strip-ansi": "^6.0.1",
|
|
369
|
-
"strip-bom": "^4.0.0",
|
|
370
|
-
"strip-final-newline": "^2.0.0",
|
|
371
|
-
"strip-json-comments": "^3.1.1",
|
|
372
|
-
"supports-color": "^7.2.0",
|
|
373
|
-
"supports-preserve-symlinks-flag": "^1.0.0",
|
|
374
|
-
"terser": "^5.43.1",
|
|
375
|
-
"test-exclude": "^6.0.0",
|
|
376
|
-
"text-table": "^0.2.0",
|
|
377
|
-
"tmpl": "^1.0.5",
|
|
378
|
-
"to-regex-range": "^5.0.1",
|
|
379
|
-
"ts-api-utils": "^1.4.3",
|
|
380
|
-
"type-check": "^0.4.0",
|
|
381
|
-
"type-detect": "^4.0.8",
|
|
382
|
-
"type-fest": "^0.20.2",
|
|
383
|
-
"typed-array-buffer": "^1.0.3",
|
|
384
|
-
"typed-array-byte-length": "^1.0.3",
|
|
385
|
-
"typed-array-byte-offset": "^1.0.4",
|
|
386
|
-
"typed-array-length": "^1.0.7",
|
|
387
|
-
"unbox-primitive": "^1.1.0",
|
|
388
|
-
"undici-types": "^7.8.0",
|
|
389
|
-
"update-browserslist-db": "^1.1.3",
|
|
390
|
-
"uri-js": "^4.4.1",
|
|
391
|
-
"v8-to-istanbul": "^9.3.0",
|
|
392
|
-
"walker": "^1.0.8",
|
|
393
|
-
"which": "^2.0.2",
|
|
394
|
-
"which-boxed-primitive": "^1.1.1",
|
|
395
|
-
"which-builtin-type": "^1.2.1",
|
|
396
|
-
"which-collection": "^1.0.2",
|
|
397
|
-
"which-typed-array": "^1.1.19",
|
|
398
|
-
"word-wrap": "^1.2.5",
|
|
399
|
-
"wrap-ansi": "^7.0.0",
|
|
400
|
-
"wrappy": "^1.0.2",
|
|
401
|
-
"write-file-atomic": "^4.0.2",
|
|
402
|
-
"y18n": "^5.0.8",
|
|
403
|
-
"yallist": "^3.1.1",
|
|
404
|
-
"yargs": "^17.7.2",
|
|
405
|
-
"yargs-parser": "^21.1.1",
|
|
406
|
-
"yocto-queue": "^0.1.0"
|
|
407
|
-
},
|
|
408
52
|
"repository": {
|
|
409
53
|
"type": "git",
|
|
410
54
|
"url": "git+https://github.com/agigox/rte-utils.git"
|
|
@@ -412,5 +56,8 @@
|
|
|
412
56
|
"bugs": {
|
|
413
57
|
"url": "https://github.com/agigox/rte-utils/issues"
|
|
414
58
|
},
|
|
415
|
-
"homepage": "https://github.com/agigox/rte-utils#readme"
|
|
59
|
+
"homepage": "https://github.com/agigox/rte-utils#readme",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"rte-utils": "^1.0.0"
|
|
62
|
+
}
|
|
416
63
|
}
|