physical-quantity 1.1.21 → 1.1.22
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 +8 -3
- package/dist/pq.es.js +5 -3
- package/dist/pq.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Physical Quantity Web Component
|
|
2
2
|
|
|
3
|
-
`physical-quantity(
|
|
3
|
+
`physical-quantity(alias: uc-qty for quantity with built-in unit conversion)` is a web component that allows you to create and manipulate physical quantities with different units. It provides an input for the value and a dropdown for the unit, automatically converting between units in the same category.
|
|
4
4
|
|
|
5
5
|
It is a new HTML element for expressing physical quantities, featuring self-contained unit conversion, a compact and clean UI, no redundant dual units, and seamless integration across all websites and platforms.
|
|
6
6
|

|
|
@@ -39,9 +39,10 @@ Include the following script tag in your HTML file:
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
### Using the Component
|
|
42
|
-
Add the `physical-quantity` tag to your HTML file:
|
|
42
|
+
Add the `physical-quantity` or `uc-qty` tag to your HTML file:
|
|
43
43
|
```html
|
|
44
44
|
<physical-quantity value="25.4" unit="mm" decimal-places="4"></physical-quantity>
|
|
45
|
+
<uc-qty value="25.4" unit="mm" decimal-places="4"></uc-qty>
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
### Example - Linking the Code
|
|
@@ -57,6 +58,7 @@ Here's an example of how to use the component in an HTML file:
|
|
|
57
58
|
</head>
|
|
58
59
|
<body>
|
|
59
60
|
<physical-quantity value="25.4" unit="mm"></physical-quantity>
|
|
61
|
+
<uc-qty value="25.4" unit="mm" decimal-places="4"></uc-qty>
|
|
60
62
|
|
|
61
63
|
<script src="node_modules/physical-quantity/src/pq.es.js"></script>
|
|
62
64
|
</body>
|
|
@@ -76,6 +78,8 @@ Here's an example of how to use the component in an HTML file:
|
|
|
76
78
|
<body>
|
|
77
79
|
<physical-quantity value="25.4" unit="mm"></physical-quantity>
|
|
78
80
|
<physical-quantity value="1500" unit="psf" decimal-places=4></physical-quantity> <br>
|
|
81
|
+
<uc-qty value="2" unit="lbm" decimal-places="2"></uc-qty>
|
|
82
|
+
|
|
79
83
|
</body>
|
|
80
84
|
</html>
|
|
81
85
|
```
|
|
@@ -132,7 +136,8 @@ This project is licensed under the MIT License. See the LICENSE file for more de
|
|
|
132
136
|
Contributions are welcome! Please contact the developer for any bugs, features, or improvements.
|
|
133
137
|
|
|
134
138
|
## Change Log
|
|
135
|
-
-
|
|
139
|
+
- v1.1.21(20250603): added alias uc-qty.
|
|
140
|
+
- v1.1.19(20250602): changed to umd for unpkg, and es for module.
|
|
136
141
|
|
|
137
142
|
## Contact
|
|
138
143
|
If you have any questions or feedback, feel free to contact me at don.wen@yahoo.com.
|
package/dist/pq.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const o = 0.45359237, s = 25.4 / 1e3, a = 12 * s,
|
|
1
|
+
const o = 0.45359237, s = 25.4 / 1e3, a = 12 * s, h = 101325, n = 133.322387415;
|
|
2
2
|
class r extends HTMLElement {
|
|
3
3
|
constructor() {
|
|
4
4
|
super(), this.attachShadow({ mode: "open" }), this.value = 0, this.unit = "mm", this.unitCategory = "Length", this.tooltipTimeout = null, this.decimalPlaces = 3, this.units = {
|
|
@@ -49,7 +49,7 @@ class r extends HTMLElement {
|
|
|
49
49
|
GPa: 1e9,
|
|
50
50
|
bar: 100 * 1e3,
|
|
51
51
|
mbar: 100,
|
|
52
|
-
atm:
|
|
52
|
+
atm: h,
|
|
53
53
|
"mm HG": n,
|
|
54
54
|
"cm HG": n * 10,
|
|
55
55
|
"in HG": n * 25.4,
|
|
@@ -179,4 +179,6 @@ class r extends HTMLElement {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
customElements.define("physical-quantity", r);
|
|
182
|
-
|
|
182
|
+
class c extends r {
|
|
183
|
+
}
|
|
184
|
+
customElements.define("uc-qty", c);
|
package/dist/pq.umd.js
CHANGED
|
@@ -60,4 +60,4 @@
|
|
|
60
60
|
Powered by <a href="https://v2.donwen.com" target="_blank">AutoCalcs</a>
|
|
61
61
|
</div>
|
|
62
62
|
|
|
63
|
-
`}}customElements.define("physical-quantity",l)
|
|
63
|
+
`}}customElements.define("physical-quantity",l);class c extends l{}customElements.define("uc-qty",c)});
|