react-led-digit 0.0.19 → 0.0.21
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 +2 -2
- package/lib/BlinkingDigit/BlinkingDigit.d.ts +3 -3
- package/lib/Digit/Digit.d.ts +3 -3
- package/lib/Digit/Digit.stories.d.ts +4 -4
- package/lib/Digit/Digit.stories.js +10 -5
- package/lib/Digit/UnstyledDigit.d.ts +62 -4
- package/lib/Digit/UnstyledDigit.js +1 -1
- package/lib/Digit/UnstyledDigit.stories.d.ts +2 -2
- package/lib/Digit/components/AmpmSegments.d.ts +3 -3
- package/lib/Digit/components/ColonSegments.d.ts +3 -3
- package/lib/Digit/components/DigitSegments.d.ts +3 -3
- package/lib/Digit/components/DotSegments.d.ts +3 -3
- package/lib/Digit/digit.css +81 -22
- package/lib/Digit/digit.css.generated.js +82 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ import { Digit, BlinkingDigit } from 'react-led-digit';
|
|
|
23
23
|
Styled segments example (see [sandbox](https://codesandbox.io/p/sandbox/react-led-digit-forked-c4f2v3)):
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
import { Digit
|
|
26
|
+
import { Digit } from 'react-led-digit';
|
|
27
27
|
|
|
28
28
|
<>
|
|
29
29
|
<Digit
|
|
@@ -33,7 +33,7 @@ import { Digit, BlinkingDigit } from 'react-led-digit';
|
|
|
33
33
|
colorOff: 'blue',
|
|
34
34
|
length: '1em',
|
|
35
35
|
thickness: '.5em',
|
|
36
|
-
|
|
36
|
+
cornerCutoff: '-.1em',
|
|
37
37
|
spacing: '-.1em',
|
|
38
38
|
shiftAD: '.1em',
|
|
39
39
|
opacityOn: 1,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type DigitProps } from '../Digit';
|
|
3
3
|
import { Blinker } from '../Blinker';
|
|
4
|
-
type
|
|
4
|
+
type BlinkingDigitProps = DigitProps & {
|
|
5
5
|
blinkOptions?: {
|
|
6
6
|
period?: Blinker['period'];
|
|
7
7
|
ratio?: Blinker['ratio'];
|
|
8
8
|
sync?: boolean;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export declare const BlinkingDigit: React.MemoExoticComponent<({ blinkOptions, className, ...rest }:
|
|
11
|
+
export declare const BlinkingDigit: React.MemoExoticComponent<({ blinkOptions, className, ...rest }: BlinkingDigitProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
12
|
export {};
|
package/lib/Digit/Digit.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
3
|
-
export declare const Digit: ({ ...rest }:
|
|
1
|
+
import { type DigitProps } from './UnstyledDigit';
|
|
2
|
+
export type { DigitProps } from './UnstyledDigit';
|
|
3
|
+
export declare const Digit: ({ ...rest }: DigitProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import {
|
|
2
|
+
import { type DigitProps } from '../';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ ...rest }:
|
|
5
|
+
component: ({ ...rest }: DigitProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
@@ -17,8 +17,8 @@ export default meta;
|
|
|
17
17
|
type Story = StoryObj<typeof meta>;
|
|
18
18
|
export type DisplayProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
19
19
|
scale?: number;
|
|
20
|
-
shape?:
|
|
21
|
-
segmentStyle?:
|
|
20
|
+
shape?: DigitProps['shape'];
|
|
21
|
+
segmentStyle?: DigitProps['segmentStyle'];
|
|
22
22
|
value: string;
|
|
23
23
|
};
|
|
24
24
|
export declare const Clock: Story;
|
|
@@ -129,8 +129,13 @@ const Display = (_a) => {
|
|
|
129
129
|
fontSize: `${scale * 100}%`,
|
|
130
130
|
},
|
|
131
131
|
segmentStyle: {
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
spacing: '.01em',
|
|
133
|
+
color: 'black',
|
|
134
|
+
colorOff: 'orange',
|
|
135
|
+
opacityOff: 0.25,
|
|
136
|
+
thickness: '.35em',
|
|
137
|
+
cornerCutoff: '-.025em',
|
|
138
|
+
transitionDuration: '1s',
|
|
134
139
|
},
|
|
135
140
|
};
|
|
136
141
|
if (digit === ':') {
|
|
@@ -170,7 +175,7 @@ const SegmentShapeTest = (args) => {
|
|
|
170
175
|
thickness: `${args.thickness}em`,
|
|
171
176
|
spacing: `${args.spacing}em`,
|
|
172
177
|
shiftAD: `${args.shiftAD}em`,
|
|
173
|
-
|
|
178
|
+
cornerCutoff: `${args.cornerCutoff}em`,
|
|
174
179
|
} }));
|
|
175
180
|
return ((0, jsx_runtime_1.jsxs)("div", { style: Object.assign({}, grid), children: [(0, jsx_runtime_1.jsx)(Dgt, { shape: 'default' }), (0, jsx_runtime_1.jsx)(Dgt, { shape: 'rect' }), (0, jsx_runtime_1.jsx)(Dgt, { shape: 'round' }), (0, jsx_runtime_1.jsx)(Dgt, { shape: 'pill' }), (0, jsx_runtime_1.jsx)(Dgt, { shape: 'calculator' })] }));
|
|
176
181
|
};
|
|
@@ -213,14 +218,14 @@ exports.Shape = {
|
|
|
213
218
|
thickness: 2,
|
|
214
219
|
spacing: 0.1,
|
|
215
220
|
shiftAD: 0,
|
|
216
|
-
|
|
221
|
+
cornerCutoff: 0,
|
|
217
222
|
},
|
|
218
223
|
argTypes: {
|
|
219
224
|
length: { control: { type: 'range', min: 1, max: 20, step: 0.5 } },
|
|
220
225
|
thickness: { control: { type: 'range', min: 0.5, max: 10, step: 0.25 } },
|
|
221
226
|
spacing: { control: { type: 'range', min: -0.5, max: 2, step: 0.05 } },
|
|
222
227
|
shiftAD: { control: { type: 'range', min: -1, max: 1, step: 0.05 } },
|
|
223
|
-
|
|
228
|
+
cornerCutoff: { control: { type: 'range', min: -5, max: 5, step: 0.1 } },
|
|
224
229
|
},
|
|
225
230
|
render: SegmentShapeTest,
|
|
226
231
|
};
|
|
@@ -3,25 +3,83 @@ import { SevenSegmentsValue } from './charToSevenSegments';
|
|
|
3
3
|
type NumValue = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
4
4
|
type DigitValue = NumValue | SevenSegmentsValue | 'am' | 'pm' | ':' | '.';
|
|
5
5
|
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
6
|
-
export type
|
|
6
|
+
export type DigitBaseProps = {
|
|
7
|
+
/**
|
|
8
|
+
* When `true`, all segments are dimmed to `opacityOff` (default 0.1),
|
|
9
|
+
* simulating a powered-off LED display.
|
|
10
|
+
*/
|
|
7
11
|
off?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Controls the visual shape of each segment.
|
|
14
|
+
* - `"default"` — diamond for digits, circle for colon/dot, plain text for am/pm
|
|
15
|
+
* - `"rect"` — rectangular segments with sharp corners
|
|
16
|
+
* - `"round"` — segments with fully rounded ends
|
|
17
|
+
* - `"pill"` — capsule-shaped segments (rounded rectangle)
|
|
18
|
+
* - `"calculator"` — angled segments resembling a classic LCD calculator
|
|
19
|
+
*/
|
|
8
20
|
shape?: 'default' | 'rect' | 'round' | 'pill' | 'calculator';
|
|
21
|
+
/**
|
|
22
|
+
* The character to display.
|
|
23
|
+
* - `0`–`9` or a supported letter (e.g. `"L"`, `"H"`) — renders as a 7-segment digit
|
|
24
|
+
* - `":"` — renders as a colon (two vertically stacked dots)
|
|
25
|
+
* - `"."` — renders as a single decimal dot
|
|
26
|
+
* - `"am"` / `"pm"` — renders as an AM/PM indicator
|
|
27
|
+
* - A `SevenSegmentsValue` string — directly specifies which segments to light up
|
|
28
|
+
*/
|
|
9
29
|
value: DigitValue;
|
|
10
30
|
};
|
|
11
31
|
type SegmentStyle = {
|
|
32
|
+
/**
|
|
33
|
+
* Color of active (lit) segments. Overrides the inherited `currentColor`.
|
|
34
|
+
* Accepts any CSS color value (e.g. `"#ff0000"`, `"red"`, `"rgb(0,255,0)"`).
|
|
35
|
+
*/
|
|
12
36
|
color?: CSSProperties['color'];
|
|
37
|
+
/**
|
|
38
|
+
* Color of inactive (unlit) segments. Useful for showing a faint "ghost"
|
|
39
|
+
* outline of the full display. Defaults to the same as `color` at reduced opacity.
|
|
40
|
+
*/
|
|
13
41
|
colorOff?: CSSProperties['color'];
|
|
42
|
+
/**
|
|
43
|
+
* Length of each segment (the longer dimension).
|
|
44
|
+
* Accepts any CSS length value (e.g. `"20px"`, `"1.5em"`).
|
|
45
|
+
*/
|
|
14
46
|
length?: CSSProperties['width'];
|
|
47
|
+
/**
|
|
48
|
+
* Thickness of each segment (the shorter dimension).
|
|
49
|
+
* Accepts any CSS length value (e.g. `"4px"`, `"0.3em"`).
|
|
50
|
+
*/
|
|
15
51
|
thickness?: CSSProperties['width'];
|
|
52
|
+
/**
|
|
53
|
+
* Gap between adjacent segments. Can be negative to overlap segments.
|
|
54
|
+
* Accepts any CSS length value (e.g. `"1px"`, `"-0.5px"`).
|
|
55
|
+
*/
|
|
16
56
|
spacing?: CSSProperties['width'];
|
|
57
|
+
/**
|
|
58
|
+
* Vertical offset applied to the top (A) and bottom (D) horizontal segments,
|
|
59
|
+
* pushing them closer together or farther apart. Useful for fine-tuning
|
|
60
|
+
* the digit's aspect ratio.
|
|
61
|
+
*/
|
|
17
62
|
shiftAD?: CSSProperties['width'];
|
|
63
|
+
/**
|
|
64
|
+
* Opacity of active (lit) segments. Defaults to `1`.
|
|
65
|
+
*/
|
|
18
66
|
opacityOn?: CSSProperties['opacity'];
|
|
67
|
+
/**
|
|
68
|
+
* Opacity of inactive (unlit) segments. Defaults to `0.1`.
|
|
69
|
+
*/
|
|
19
70
|
opacityOff?: CSSProperties['opacity'];
|
|
71
|
+
/**
|
|
72
|
+
* CSS transition duration for segment color and opacity changes.
|
|
73
|
+
* Defaults to `".25s"`. Set to `"0s"` for instant switching.
|
|
74
|
+
*/
|
|
20
75
|
transitionDuration?: CSSProperties['transitionDuration'];
|
|
21
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Size of the corner cutoff. Don't applies when `shape` is `"calculator"`.
|
|
78
|
+
*/
|
|
79
|
+
cornerCutoff?: CSSProperties['width'];
|
|
22
80
|
};
|
|
23
|
-
export type
|
|
81
|
+
export type DigitProps = DivProps & DigitBaseProps & {
|
|
24
82
|
segmentStyle?: SegmentStyle;
|
|
25
83
|
};
|
|
26
|
-
export declare const Digit: ({ segmentStyle, value, ...rest }:
|
|
84
|
+
export declare const Digit: ({ segmentStyle, value, ...rest }: DigitProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
85
|
export {};
|
|
@@ -24,7 +24,7 @@ const Digit = (_a) => {
|
|
|
24
24
|
const v = value.toString();
|
|
25
25
|
const type = valueToType(value);
|
|
26
26
|
const segments = type && valueToSegments(value); // {A: true, ...}
|
|
27
|
-
const sx = Object.assign({ '--segment-color': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.color, '--segment-color-off': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.colorOff, '--segment-thickness': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.thickness, '--segment-spacing': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.spacing, '--segment-length': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.length, '--segment-shift-ad': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.shiftAD, '--segment-opacity-on': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.opacityOn, '--segment-opacity-off': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.opacityOff, '--segment-transition-duration': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.transitionDuration, '--segment-corner-
|
|
27
|
+
const sx = Object.assign({ '--segment-color': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.color, '--segment-color-off': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.colorOff, '--segment-thickness': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.thickness, '--segment-spacing': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.spacing, '--segment-length': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.length, '--segment-shift-ad': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.shiftAD, '--segment-opacity-on': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.opacityOn, '--segment-opacity-off': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.opacityOff, '--segment-transition-duration': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.transitionDuration, '--segment-corner-cutoff': segmentStyle === null || segmentStyle === void 0 ? void 0 : segmentStyle.cornerCutoff }, rest.style);
|
|
28
28
|
if (type === 'digit')
|
|
29
29
|
return (0, jsx_runtime_1.jsx)(components_1.DigitSegments, Object.assign({ "aria-label": v }, rest, segments, { style: sx }));
|
|
30
30
|
if (type === 'colon')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import {
|
|
2
|
+
import { type DigitProps } from '..';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ segmentStyle, value, ...rest }:
|
|
5
|
+
component: ({ segmentStyle, value, ...rest }: DigitProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DigitBaseProps } from '../UnstyledDigit';
|
|
2
2
|
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
3
3
|
export type AmpmSegments = DivProps & {
|
|
4
4
|
className?: string;
|
|
5
|
-
off?:
|
|
6
|
-
shape?:
|
|
5
|
+
off?: DigitBaseProps['off'];
|
|
6
|
+
shape?: DigitBaseProps['shape'];
|
|
7
7
|
AM?: boolean;
|
|
8
8
|
PM?: boolean;
|
|
9
9
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DigitBaseProps } from '../UnstyledDigit';
|
|
2
2
|
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
3
3
|
export type ColonSegments = DivProps & {
|
|
4
4
|
className?: string;
|
|
5
|
-
off?:
|
|
6
|
-
shape?:
|
|
5
|
+
off?: DigitBaseProps['off'];
|
|
6
|
+
shape?: DigitBaseProps['shape'];
|
|
7
7
|
D1?: boolean;
|
|
8
8
|
D2?: boolean;
|
|
9
9
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DigitBaseProps } from '../UnstyledDigit';
|
|
2
2
|
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
3
3
|
export type DigitSegments = DivProps & {
|
|
4
4
|
className?: string;
|
|
5
|
-
off?:
|
|
6
|
-
shape?:
|
|
5
|
+
off?: DigitBaseProps['off'];
|
|
6
|
+
shape?: DigitBaseProps['shape'];
|
|
7
7
|
A?: boolean;
|
|
8
8
|
B?: boolean;
|
|
9
9
|
C?: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DigitBaseProps } from '../UnstyledDigit';
|
|
2
2
|
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
3
3
|
export type DotSegments = DivProps & {
|
|
4
4
|
className?: string;
|
|
5
|
-
off?:
|
|
6
|
-
shape?:
|
|
5
|
+
off?: DigitBaseProps['off'];
|
|
6
|
+
shape?: DigitBaseProps['shape'];
|
|
7
7
|
DP?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare const DotSegments: ({ className, off, shape, DP, ...rest }: DotSegments) => import("react/jsx-runtime").JSX.Element;
|
package/lib/Digit/digit.css
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
--ad: calc(
|
|
15
15
|
var(--segment-shift-ad, 0em) * var(--scale)
|
|
16
16
|
); /* moves segments A, D in vertical direction */
|
|
17
|
-
--corner-
|
|
18
|
-
--segment-corner-
|
|
17
|
+
--corner-cutoff: var(
|
|
18
|
+
--segment-corner-cutoff,
|
|
19
19
|
0em
|
|
20
20
|
); /* distortion of outer corners of a digit */
|
|
21
21
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
--thk-half: calc(var(--thk) / 2);
|
|
35
35
|
|
|
36
36
|
--spc: calc(var(--spacing) / 1.4142); /* divided by sqrt(2) */
|
|
37
|
-
--crn: var(--corner-
|
|
37
|
+
--crn: var(--corner-cutoff);
|
|
38
38
|
|
|
39
39
|
--radius-round: calc(var(--thk) * 0.33);
|
|
40
40
|
--radius-pill: var(--thk, 10em);
|
|
@@ -255,23 +255,71 @@
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
/*
|
|
259
|
-
&.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
258
|
+
/* digit shape */
|
|
259
|
+
&.digit .opacity-wrapper {
|
|
260
|
+
clip-path: polygon(
|
|
261
|
+
0px 0px,
|
|
262
|
+
0px 0px,
|
|
263
|
+
0px 0px,
|
|
264
|
+
0px 0px,
|
|
265
|
+
0px 0px,
|
|
266
|
+
0px 0px,
|
|
267
|
+
100% 0px,
|
|
268
|
+
100% 0px,
|
|
269
|
+
100% 0px,
|
|
270
|
+
100% 0px,
|
|
271
|
+
100% 0px,
|
|
272
|
+
100% 0px,
|
|
273
|
+
100% 100%,
|
|
274
|
+
100% 100%,
|
|
275
|
+
100% 100%,
|
|
276
|
+
100% 100%,
|
|
277
|
+
100% 100%,
|
|
278
|
+
100% 100%,
|
|
279
|
+
0px 100%,
|
|
280
|
+
0px 100%,
|
|
281
|
+
0px 100%,
|
|
282
|
+
0px 100%,
|
|
283
|
+
0px 100%,
|
|
284
|
+
0px 100%
|
|
285
|
+
);
|
|
268
286
|
}
|
|
269
|
-
|
|
270
|
-
|
|
287
|
+
|
|
288
|
+
&.shape-default .opacity-wrapper {
|
|
289
|
+
--crn-2: calc(var(--crn) * -1 + var(--spc) + var(--thk));
|
|
290
|
+
|
|
291
|
+
clip-path: polygon(
|
|
292
|
+
0px var(--crn-2),
|
|
293
|
+
0px var(--crn-2),
|
|
294
|
+
0px var(--crn-2),
|
|
295
|
+
var(--crn-2) 0px,
|
|
296
|
+
var(--crn-2) 0px,
|
|
297
|
+
var(--crn-2) 0px,
|
|
298
|
+
calc(100% - var(--crn-2)) 0px,
|
|
299
|
+
calc(100% - var(--crn-2)) 0px,
|
|
300
|
+
calc(100% - var(--crn-2)) 0px,
|
|
301
|
+
100% var(--crn-2),
|
|
302
|
+
100% var(--crn-2),
|
|
303
|
+
100% var(--crn-2),
|
|
304
|
+
100% calc(100% - var(--crn-2)),
|
|
305
|
+
100% calc(100% - var(--crn-2)),
|
|
306
|
+
100% calc(100% - var(--crn-2)),
|
|
307
|
+
calc(100% - var(--crn-2)) 100%,
|
|
308
|
+
calc(100% - var(--crn-2)) 100%,
|
|
309
|
+
calc(100% - var(--crn-2)) 100%,
|
|
310
|
+
var(--crn-2) 100%,
|
|
311
|
+
var(--crn-2) 100%,
|
|
312
|
+
var(--crn-2) 100%,
|
|
313
|
+
0px calc(100% - var(--crn-2)),
|
|
314
|
+
0px calc(100% - var(--crn-2)),
|
|
315
|
+
0px calc(100% - var(--crn-2))
|
|
316
|
+
);
|
|
271
317
|
}
|
|
272
|
-
& {
|
|
273
|
-
--r: calc(var(--thk) * 0);
|
|
274
318
|
|
|
319
|
+
&.shape-calculator .opacity-wrapper {
|
|
320
|
+
--r: calc(var(--thk) * 1.35);
|
|
321
|
+
|
|
322
|
+
/* rounded corners */
|
|
275
323
|
clip-path: polygon(
|
|
276
324
|
/* top-left corner */ 0px var(--r),
|
|
277
325
|
calc(var(--r) * 0.0495) calc(var(--r) * 0.691),
|
|
@@ -298,11 +346,22 @@
|
|
|
298
346
|
calc(var(--r) * 0.0495) calc(var(--dh) - var(--r) * 0.691),
|
|
299
347
|
0px calc(var(--dh) - var(--r))
|
|
300
348
|
);
|
|
349
|
+
}
|
|
301
350
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
351
|
+
/* segment shapes */
|
|
352
|
+
&.shape-default .segment.segment,
|
|
353
|
+
&.shape-rect .segment.segment {
|
|
354
|
+
border-radius: 0;
|
|
355
|
+
}
|
|
356
|
+
&.shape-round .segment.segment {
|
|
357
|
+
border-radius: var(--radius-round);
|
|
358
|
+
}
|
|
359
|
+
&.shape-pill .segment.segment {
|
|
360
|
+
border-radius: var(--radius-pill);
|
|
361
|
+
}
|
|
362
|
+
&.shape-calculator .segment.segment {
|
|
363
|
+
--crn: var(--thk);
|
|
364
|
+
--shft: calc(var(--thk) * 1);
|
|
306
365
|
}
|
|
307
366
|
|
|
308
367
|
&.shape-rect,
|
|
@@ -395,7 +454,7 @@
|
|
|
395
454
|
transform: rotate3d(1, -1, 0, 0.025deg);
|
|
396
455
|
}
|
|
397
456
|
|
|
398
|
-
/* better subpixel rendering
|
|
457
|
+
/* better subpixel (16x) rendering for Firefox */
|
|
399
458
|
@-moz-document url-prefix() {
|
|
400
459
|
.digit {
|
|
401
460
|
--scale: 4;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const css = {
|
|
4
4
|
src: `src/Digit/digit.css`,
|
|
5
|
-
hash: `
|
|
5
|
+
hash: `ru8357il70`,
|
|
6
6
|
content: `
|
|
7
7
|
/**
|
|
8
8
|
* A
|
|
@@ -20,8 +20,8 @@ const css = {
|
|
|
20
20
|
--ad: calc(
|
|
21
21
|
var(--segment-shift-ad, 0em) * var(--scale)
|
|
22
22
|
); /* moves segments A, D in vertical direction */
|
|
23
|
-
--corner-
|
|
24
|
-
--segment-corner-
|
|
23
|
+
--corner-cutoff: var(
|
|
24
|
+
--segment-corner-cutoff,
|
|
25
25
|
0em
|
|
26
26
|
); /* distortion of outer corners of a digit */
|
|
27
27
|
|
|
@@ -40,7 +40,7 @@ const css = {
|
|
|
40
40
|
--thk-half: calc(var(--thk) / 2);
|
|
41
41
|
|
|
42
42
|
--spc: calc(var(--spacing) / 1.4142); /* divided by sqrt(2) */
|
|
43
|
-
--crn: var(--corner-
|
|
43
|
+
--crn: var(--corner-cutoff);
|
|
44
44
|
|
|
45
45
|
--radius-round: calc(var(--thk) * 0.33);
|
|
46
46
|
--radius-pill: var(--thk, 10em);
|
|
@@ -261,23 +261,71 @@ const css = {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
/*
|
|
265
|
-
&.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
264
|
+
/* digit shape */
|
|
265
|
+
&.digit .opacity-wrapper {
|
|
266
|
+
clip-path: polygon(
|
|
267
|
+
0px 0px,
|
|
268
|
+
0px 0px,
|
|
269
|
+
0px 0px,
|
|
270
|
+
0px 0px,
|
|
271
|
+
0px 0px,
|
|
272
|
+
0px 0px,
|
|
273
|
+
100% 0px,
|
|
274
|
+
100% 0px,
|
|
275
|
+
100% 0px,
|
|
276
|
+
100% 0px,
|
|
277
|
+
100% 0px,
|
|
278
|
+
100% 0px,
|
|
279
|
+
100% 100%,
|
|
280
|
+
100% 100%,
|
|
281
|
+
100% 100%,
|
|
282
|
+
100% 100%,
|
|
283
|
+
100% 100%,
|
|
284
|
+
100% 100%,
|
|
285
|
+
0px 100%,
|
|
286
|
+
0px 100%,
|
|
287
|
+
0px 100%,
|
|
288
|
+
0px 100%,
|
|
289
|
+
0px 100%,
|
|
290
|
+
0px 100%
|
|
291
|
+
);
|
|
274
292
|
}
|
|
275
|
-
|
|
276
|
-
|
|
293
|
+
|
|
294
|
+
&.shape-default .opacity-wrapper {
|
|
295
|
+
--crn-2: calc(var(--crn) * -1 + var(--spc) + var(--thk));
|
|
296
|
+
|
|
297
|
+
clip-path: polygon(
|
|
298
|
+
0px var(--crn-2),
|
|
299
|
+
0px var(--crn-2),
|
|
300
|
+
0px var(--crn-2),
|
|
301
|
+
var(--crn-2) 0px,
|
|
302
|
+
var(--crn-2) 0px,
|
|
303
|
+
var(--crn-2) 0px,
|
|
304
|
+
calc(100% - var(--crn-2)) 0px,
|
|
305
|
+
calc(100% - var(--crn-2)) 0px,
|
|
306
|
+
calc(100% - var(--crn-2)) 0px,
|
|
307
|
+
100% var(--crn-2),
|
|
308
|
+
100% var(--crn-2),
|
|
309
|
+
100% var(--crn-2),
|
|
310
|
+
100% calc(100% - var(--crn-2)),
|
|
311
|
+
100% calc(100% - var(--crn-2)),
|
|
312
|
+
100% calc(100% - var(--crn-2)),
|
|
313
|
+
calc(100% - var(--crn-2)) 100%,
|
|
314
|
+
calc(100% - var(--crn-2)) 100%,
|
|
315
|
+
calc(100% - var(--crn-2)) 100%,
|
|
316
|
+
var(--crn-2) 100%,
|
|
317
|
+
var(--crn-2) 100%,
|
|
318
|
+
var(--crn-2) 100%,
|
|
319
|
+
0px calc(100% - var(--crn-2)),
|
|
320
|
+
0px calc(100% - var(--crn-2)),
|
|
321
|
+
0px calc(100% - var(--crn-2))
|
|
322
|
+
);
|
|
277
323
|
}
|
|
278
|
-
& {
|
|
279
|
-
--r: calc(var(--thk) * 0);
|
|
280
324
|
|
|
325
|
+
&.shape-calculator .opacity-wrapper {
|
|
326
|
+
--r: calc(var(--thk) * 1.35);
|
|
327
|
+
|
|
328
|
+
/* rounded corners */
|
|
281
329
|
clip-path: polygon(
|
|
282
330
|
/* top-left corner */ 0px var(--r),
|
|
283
331
|
calc(var(--r) * 0.0495) calc(var(--r) * 0.691),
|
|
@@ -304,11 +352,22 @@ const css = {
|
|
|
304
352
|
calc(var(--r) * 0.0495) calc(var(--dh) - var(--r) * 0.691),
|
|
305
353
|
0px calc(var(--dh) - var(--r))
|
|
306
354
|
);
|
|
355
|
+
}
|
|
307
356
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
357
|
+
/* segment shapes */
|
|
358
|
+
&.shape-default .segment.segment,
|
|
359
|
+
&.shape-rect .segment.segment {
|
|
360
|
+
border-radius: 0;
|
|
361
|
+
}
|
|
362
|
+
&.shape-round .segment.segment {
|
|
363
|
+
border-radius: var(--radius-round);
|
|
364
|
+
}
|
|
365
|
+
&.shape-pill .segment.segment {
|
|
366
|
+
border-radius: var(--radius-pill);
|
|
367
|
+
}
|
|
368
|
+
&.shape-calculator .segment.segment {
|
|
369
|
+
--crn: var(--thk);
|
|
370
|
+
--shft: calc(var(--thk) * 1);
|
|
312
371
|
}
|
|
313
372
|
|
|
314
373
|
&.shape-rect,
|
|
@@ -401,7 +460,7 @@ const css = {
|
|
|
401
460
|
transform: rotate3d(1, -1, 0, 0.025deg);
|
|
402
461
|
}
|
|
403
462
|
|
|
404
|
-
/* better subpixel rendering
|
|
463
|
+
/* better subpixel (16x) rendering for Firefox */
|
|
405
464
|
@-moz-document url-prefix() {
|
|
406
465
|
.digit {
|
|
407
466
|
--scale: 4;
|