@wandelbots/mui 0.0.0 → 1.0.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.
- package/README.md +131 -1
- package/dist/components/AdornedSelect/AdornedSelect.cjs +2 -0
- package/dist/components/AdornedSelect/AdornedSelect.d.ts +19 -0
- package/dist/components/AdornedSelect/AdornedSelect.d.ts.map +1 -0
- package/dist/components/AdornedSelect/AdornedSelect.js +85 -0
- package/dist/components/AdornedSelect/index.d.ts +2 -0
- package/dist/components/AdornedSelect/index.d.ts.map +1 -0
- package/dist/components/AdornedTextField/AdornedAutocomplete.cjs +2 -0
- package/dist/components/AdornedTextField/AdornedAutocomplete.d.ts +21 -0
- package/dist/components/AdornedTextField/AdornedAutocomplete.d.ts.map +1 -0
- package/dist/components/AdornedTextField/AdornedAutocomplete.js +47 -0
- package/dist/components/AdornedTextField/AdornedTextField.cjs +2 -0
- package/dist/components/AdornedTextField/AdornedTextField.d.ts +12 -0
- package/dist/components/AdornedTextField/AdornedTextField.d.ts.map +1 -0
- package/dist/components/AdornedTextField/AdornedTextField.js +158 -0
- package/dist/components/AdornedTextField/index.d.ts +3 -0
- package/dist/components/AdornedTextField/index.d.ts.map +1 -0
- package/dist/components/ElevationCard/ElevationCard.cjs +2 -0
- package/dist/components/ElevationCard/ElevationCard.d.ts +39 -0
- package/dist/components/ElevationCard/ElevationCard.d.ts.map +1 -0
- package/dist/components/ElevationCard/ElevationCard.js +43 -0
- package/dist/components/ElevationCard/index.d.ts +2 -0
- package/dist/components/ElevationCard/index.d.ts.map +1 -0
- package/dist/components/PrimaryButton/PrimaryButton.cjs +2 -0
- package/dist/components/PrimaryButton/PrimaryButton.d.ts +8 -0
- package/dist/components/PrimaryButton/PrimaryButton.d.ts.map +1 -0
- package/dist/components/PrimaryButton/PrimaryButton.js +18 -0
- package/dist/components/PrimaryButton/index.d.ts +2 -0
- package/dist/components/PrimaryButton/index.d.ts.map +1 -0
- package/dist/components/RoundedIconButton/RoundedIconButton.cjs +2 -0
- package/dist/components/RoundedIconButton/RoundedIconButton.d.ts +30 -0
- package/dist/components/RoundedIconButton/RoundedIconButton.d.ts.map +1 -0
- package/dist/components/RoundedIconButton/RoundedIconButton.js +45 -0
- package/dist/components/RoundedIconButton/index.d.ts +2 -0
- package/dist/components/RoundedIconButton/index.d.ts.map +1 -0
- package/dist/components/SecondaryButton/SecondaryButton.cjs +2 -0
- package/dist/components/SecondaryButton/SecondaryButton.d.ts +8 -0
- package/dist/components/SecondaryButton/SecondaryButton.d.ts.map +1 -0
- package/dist/components/SecondaryButton/SecondaryButton.js +26 -0
- package/dist/components/SecondaryButton/index.d.ts +2 -0
- package/dist/components/SecondaryButton/index.d.ts.map +1 -0
- package/dist/components/fields/FloatTextField.cjs +2 -0
- package/dist/components/fields/FloatTextField.d.ts +5 -0
- package/dist/components/fields/FloatTextField.d.ts.map +1 -0
- package/dist/components/fields/FloatTextField.js +17 -0
- package/dist/components/fields/IntegerTextField.cjs +2 -0
- package/dist/components/fields/IntegerTextField.d.ts +5 -0
- package/dist/components/fields/IntegerTextField.d.ts.map +1 -0
- package/dist/components/fields/IntegerTextField.js +17 -0
- package/dist/components/fields/IpAddressTextField.cjs +2 -0
- package/dist/components/fields/IpAddressTextField.d.ts +5 -0
- package/dist/components/fields/IpAddressTextField.d.ts.map +1 -0
- package/dist/components/fields/IpAddressTextField.js +17 -0
- package/dist/components/fields/ParsingTextField.cjs +2 -0
- package/dist/components/fields/ParsingTextField.d.ts +18 -0
- package/dist/components/fields/ParsingTextField.d.ts.map +1 -0
- package/dist/components/fields/ParsingTextField.js +35 -0
- package/dist/components/fields/PortTextField.cjs +2 -0
- package/dist/components/fields/PortTextField.d.ts +5 -0
- package/dist/components/fields/PortTextField.d.ts.map +1 -0
- package/dist/components/fields/PortTextField.js +17 -0
- package/dist/components/fields/StringValidationTextField.cjs +2 -0
- package/dist/components/fields/StringValidationTextField.d.ts +5 -0
- package/dist/components/fields/StringValidationTextField.d.ts.map +1 -0
- package/dist/components/fields/StringValidationTextField.js +9 -0
- package/dist/components/fields/index.d.ts +7 -0
- package/dist/components/fields/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/theme/createNovaMuiTheme.cjs +2 -0
- package/dist/theme/createNovaMuiTheme.d.ts +144 -0
- package/dist/theme/createNovaMuiTheme.d.ts.map +1 -0
- package/dist/theme/createNovaMuiTheme.js +374 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/validators/core.cjs +1 -0
- package/dist/validators/core.d.ts +7 -0
- package/dist/validators/core.d.ts.map +1 -0
- package/dist/validators/core.js +10 -0
- package/dist/validators/index.cjs +1 -0
- package/dist/validators/index.d.ts +5 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +25 -0
- package/dist/validators/network.cjs +1 -0
- package/dist/validators/network.d.ts +21 -0
- package/dist/validators/network.d.ts.map +1 -0
- package/dist/validators/network.js +40 -0
- package/dist/validators/number.cjs +1 -0
- package/dist/validators/number.d.ts +13 -0
- package/dist/validators/number.d.ts.map +1 -0
- package/dist/validators/number.js +40 -0
- package/dist/validators/string.cjs +1 -0
- package/dist/validators/string.d.ts +7 -0
- package/dist/validators/string.d.ts.map +1 -0
- package/dist/validators/string.js +32 -0
- package/package.json +79 -3
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Theme, ThemeOptions } from "@mui/material/styles";
|
|
2
|
+
/** Nova-only palette extension, exposed as `theme.paletteExt`. */
|
|
3
|
+
export interface NovaPaletteExt {
|
|
4
|
+
primary?: {
|
|
5
|
+
hover?: string;
|
|
6
|
+
selected?: string;
|
|
7
|
+
focus?: string;
|
|
8
|
+
focusVisible?: string;
|
|
9
|
+
outlineBorder?: string;
|
|
10
|
+
};
|
|
11
|
+
secondary?: {
|
|
12
|
+
tonal?: string;
|
|
13
|
+
};
|
|
14
|
+
components?: {
|
|
15
|
+
inputFilledEnabledFill?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
interface NovaColorPaletteExtension {
|
|
19
|
+
paletteExt?: NovaPaletteExt;
|
|
20
|
+
}
|
|
21
|
+
/** The Nova paper-elevation ramp, exposed as `palette.backgroundPaperElevation`. */
|
|
22
|
+
export interface BackgroundPaperElevation {
|
|
23
|
+
[key: number]: string | undefined;
|
|
24
|
+
0?: string;
|
|
25
|
+
1?: string;
|
|
26
|
+
2?: string;
|
|
27
|
+
3?: string;
|
|
28
|
+
4?: string;
|
|
29
|
+
5?: string;
|
|
30
|
+
6?: string;
|
|
31
|
+
7?: string;
|
|
32
|
+
8?: string;
|
|
33
|
+
9?: string;
|
|
34
|
+
10?: string;
|
|
35
|
+
11?: string;
|
|
36
|
+
12?: string;
|
|
37
|
+
13?: string;
|
|
38
|
+
14?: string;
|
|
39
|
+
15?: string;
|
|
40
|
+
16?: string;
|
|
41
|
+
17?: string;
|
|
42
|
+
18?: string;
|
|
43
|
+
19?: string;
|
|
44
|
+
20?: string;
|
|
45
|
+
21?: string;
|
|
46
|
+
22?: string;
|
|
47
|
+
23?: string;
|
|
48
|
+
24?: string;
|
|
49
|
+
}
|
|
50
|
+
declare module "@mui/material/styles" {
|
|
51
|
+
interface Palette {
|
|
52
|
+
tertiary: Palette["primary"];
|
|
53
|
+
backgroundPaperElevation?: BackgroundPaperElevation;
|
|
54
|
+
}
|
|
55
|
+
interface PaletteOptions {
|
|
56
|
+
tertiary?: PaletteOptions["primary"];
|
|
57
|
+
backgroundPaperElevation?: BackgroundPaperElevation;
|
|
58
|
+
}
|
|
59
|
+
interface Theme extends NovaColorPaletteExtension {
|
|
60
|
+
}
|
|
61
|
+
interface ThemeOptions extends NovaColorPaletteExtension {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns the Nova dark theme `ThemeOptions`. Includes:
|
|
66
|
+
*
|
|
67
|
+
* - `palette` — full dark palette (primary/secondary/tertiary/error/warning/
|
|
68
|
+
* success/background/action/common/divider) plus the Nova additions
|
|
69
|
+
* `backgroundPaperElevation[0..16]` and `tertiary`.
|
|
70
|
+
* - `paletteExt` — Nova-only extension with `primary.{hover,selected,focus,
|
|
71
|
+
* focusVisible,outlineBorder}` and `secondary.tonal`.
|
|
72
|
+
* - `shape.borderRadius` — from the `RadiusSm` token.
|
|
73
|
+
* - `typography` — Inter font stack, `fontWeightRegular: 500`, `body2` at
|
|
74
|
+
* 14/400.
|
|
75
|
+
*
|
|
76
|
+
* Internal building block: does **not** include component overrides. Use
|
|
77
|
+
* {@link createNovaMuiTheme}, which composes this with {@link commonComponents}.
|
|
78
|
+
*/
|
|
79
|
+
export declare function darkBaseOptions(): ThemeOptions;
|
|
80
|
+
/**
|
|
81
|
+
* Returns Nova's MUI component overrides.
|
|
82
|
+
*
|
|
83
|
+
* Palette-dependent style values use MUI's function-form callbacks
|
|
84
|
+
* (`({ theme }) => ({...})`), which are evaluated against the *final merged*
|
|
85
|
+
* theme. That means consumer palette overrides (passed to
|
|
86
|
+
* {@link createNovaMuiTheme} as additional layers) propagate into these components
|
|
87
|
+
* automatically.
|
|
88
|
+
*
|
|
89
|
+
* `MuiCssBaseline.styleOverrides` is intentionally a plain object (not a
|
|
90
|
+
* callback) so consumers can deep-merge their own global selectors
|
|
91
|
+
* (e.g. `.MuiDataGrid-panelContent`) without replacing Nova's scrollbar rules.
|
|
92
|
+
*
|
|
93
|
+
* Excludes package-specific overrides (DataGrid, JoggingPanel) — consumers add
|
|
94
|
+
* those via their own override layer.
|
|
95
|
+
*
|
|
96
|
+
* Internal building block: use {@link createNovaMuiTheme}.
|
|
97
|
+
*/
|
|
98
|
+
export declare function commonComponents(): NonNullable<ThemeOptions["components"]>;
|
|
99
|
+
/**
|
|
100
|
+
* Create the Wandelbots Nova MUI theme — the single public theme factory of
|
|
101
|
+
* `@wandelbots/mui`.
|
|
102
|
+
*
|
|
103
|
+
* Composes the Nova palette, `paletteExt`, elevation ramp, typography and
|
|
104
|
+
* component overrides from `@wandelbots/design-tokens` values. Dark-only in v1;
|
|
105
|
+
* light mode will be added inside this factory (via MUI's `colorSchemes`) once
|
|
106
|
+
* the upstream Figma sync ships light tokens, so call sites won't have to
|
|
107
|
+
* change.
|
|
108
|
+
*
|
|
109
|
+
* Accepts variadic `ThemeOptions` overrides. Each override is deep-merged into
|
|
110
|
+
* the result via MUI's own `createTheme(base, ...overrides)` API, so consumers
|
|
111
|
+
* can layer their own palette tweaks, custom components, or per-app styling
|
|
112
|
+
* without having to reconstruct the base theme. The last layer wins.
|
|
113
|
+
*
|
|
114
|
+
* Palette-dependent component styles use MUI's function-form callbacks, so
|
|
115
|
+
* consumer palette overrides automatically propagate into Nova's built-in
|
|
116
|
+
* component overrides (MuiTab text color, MuiFab background, etc.).
|
|
117
|
+
*
|
|
118
|
+
* Importing this module also activates the MUI module augmentation
|
|
119
|
+
* (`palette.tertiary`, `palette.backgroundPaperElevation`, `paletteExt`).
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* import { ThemeProvider } from "@mui/material/styles"
|
|
123
|
+
* import { createNovaMuiTheme } from "@wandelbots/mui"
|
|
124
|
+
*
|
|
125
|
+
* const theme = createNovaMuiTheme()
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* // Override + extend
|
|
129
|
+
* const theme = createNovaMuiTheme({
|
|
130
|
+
* palette: { primary: { main: "#ff00ff" } },
|
|
131
|
+
* components: {
|
|
132
|
+
* MuiDialog: {
|
|
133
|
+
* styleOverrides: { paper: { borderRadius: 16 } },
|
|
134
|
+
* },
|
|
135
|
+
* },
|
|
136
|
+
* })
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* // Multi-layer: app-wide + feature-specific
|
|
140
|
+
* const theme = createNovaMuiTheme(appOverrides, joggingPanelOverrides)
|
|
141
|
+
*/
|
|
142
|
+
export declare function createNovaMuiTheme(...overrides: ThemeOptions[]): Theme;
|
|
143
|
+
export {};
|
|
144
|
+
//# sourceMappingURL=createNovaMuiTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNovaMuiTheme.d.ts","sourceRoot":"","sources":["../../src/theme/createNovaMuiTheme.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAmD/D,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;IACD,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,UAAU,CAAC,EAAE;QACX,sBAAsB,CAAC,EAAE,MAAM,CAAA;KAChC,CAAA;CACF;AAED,UAAU,yBAAyB;IACjC,UAAU,CAAC,EAAE,cAAc,CAAA;CAC5B;AAED,oFAAoF;AACpF,MAAM,WAAW,wBAAwB;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACjC,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,OAAO;QACf,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QAC5B,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;KACpD;IAED,UAAU,cAAc;QACtB,QAAQ,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;QACpC,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;KACpD;IAED,UAAU,KAAM,SAAQ,yBAAyB;KAAG;IAEpD,UAAU,YAAa,SAAQ,yBAAyB;KAAG;CAC5D;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAgH9C;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAyM1E;AAqBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,SAAS,EAAE,YAAY,EAAE,GAAG,KAAK,CAOtE"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createTheme as s } from "@mui/material/styles";
|
|
3
|
+
import { ZeroGravityComponentsInputFilledEnabledFill as p, ZeroGravitySecondaryTonal as c, ZeroGravityNovaViolet5 as t, ZeroGravityBackgroundPaperElevation11 as u, ZeroGravityBackgroundPaperElevation8 as b, ZeroGravityBackgroundPaperElevation5 as y, ZeroGravityBackgroundPaperElevation2 as v, ZeroGravityBackgroundPaperElevation1 as g, ZeroGravityDivider as d, ZeroGravityActionDisabled as f, ZeroGravityActionDisabledBackground as x, ZeroGravityActionSelected as m, ZeroGravityActionHover as k, ZeroGravityActionActive as h, ColorsTeal200 as T, ColorsTeal700 as G, ColorsTeal400 as l, ColorsOrangeA100 as M, ColorsOrangeA400 as Z, ColorsOrangeA200 as B, ColorsRed200 as $, ColorsRed600 as C, ColorsRed400 as O, ColorsTealA100 as E, ColorsTealA200 as R, ZeroGravitySecondaryContrast as A, ZeroGravitySecondaryDark as S, ZeroGravitySecondaryMain as w, ZeroGravityNovaViolet6 as P, ZeroGravityNovaViolet4 as D, ZeroGravityTextDisabled as F, ZeroGravityTextSecondary as N, ZeroGravityTextPrimary as W, RadiusSm as i } from "@wandelbots/design-tokens";
|
|
4
|
+
function I() {
|
|
5
|
+
return {
|
|
6
|
+
palette: {
|
|
7
|
+
mode: "dark",
|
|
8
|
+
text: {
|
|
9
|
+
primary: W,
|
|
10
|
+
secondary: N,
|
|
11
|
+
disabled: F
|
|
12
|
+
},
|
|
13
|
+
primary: {
|
|
14
|
+
main: t,
|
|
15
|
+
dark: D,
|
|
16
|
+
light: P,
|
|
17
|
+
contrastText: "rgba(255, 255, 255, 0.87)"
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
main: w,
|
|
21
|
+
dark: S,
|
|
22
|
+
contrastText: A
|
|
23
|
+
},
|
|
24
|
+
tertiary: {
|
|
25
|
+
main: R,
|
|
26
|
+
dark: l,
|
|
27
|
+
light: E,
|
|
28
|
+
contrastText: "rgba(0, 0, 0, 1)"
|
|
29
|
+
},
|
|
30
|
+
error: {
|
|
31
|
+
main: O,
|
|
32
|
+
dark: C,
|
|
33
|
+
light: $,
|
|
34
|
+
contrastText: "rgba(255, 255, 255, 1)"
|
|
35
|
+
},
|
|
36
|
+
warning: {
|
|
37
|
+
main: B,
|
|
38
|
+
dark: Z,
|
|
39
|
+
light: M,
|
|
40
|
+
contrastText: "rgba(0, 0, 0, 0.87)"
|
|
41
|
+
},
|
|
42
|
+
success: {
|
|
43
|
+
main: l,
|
|
44
|
+
dark: G,
|
|
45
|
+
light: T,
|
|
46
|
+
contrastText: "rgba(255, 255, 255, 0.87)"
|
|
47
|
+
},
|
|
48
|
+
background: {
|
|
49
|
+
// NovaDeck's app background. Deliberately diverges from the token
|
|
50
|
+
// ZeroGravityBackgroundDefault (#020617) — decision "Bg" in the spec.
|
|
51
|
+
// TODO: resolve upstream in Figma so this comes from tokens again.
|
|
52
|
+
default: "#161825",
|
|
53
|
+
paper: "#11131f"
|
|
54
|
+
// ZeroGravityBackgroundPaperElevation0 (skipped: "no use")
|
|
55
|
+
},
|
|
56
|
+
action: {
|
|
57
|
+
active: h,
|
|
58
|
+
hover: k,
|
|
59
|
+
selected: m,
|
|
60
|
+
disabledBackground: x,
|
|
61
|
+
focus: "#ffffff1f",
|
|
62
|
+
// ZeroGravityActionFocus (skipped: "no use")
|
|
63
|
+
disabled: f
|
|
64
|
+
},
|
|
65
|
+
common: {
|
|
66
|
+
white: "rgba(255, 255, 255, 1)",
|
|
67
|
+
black: "rgba(0, 0, 0, 1)"
|
|
68
|
+
},
|
|
69
|
+
divider: d,
|
|
70
|
+
backgroundPaperElevation: {
|
|
71
|
+
0: "#11131f",
|
|
72
|
+
// ZeroGravityBackgroundPaperElevation0 (skipped: "no use")
|
|
73
|
+
1: g,
|
|
74
|
+
2: v,
|
|
75
|
+
3: "#1a1c2b",
|
|
76
|
+
// ZeroGravityBackgroundPaperElevation3 (skipped: "no use")
|
|
77
|
+
4: "#1d1f2f",
|
|
78
|
+
// ZeroGravityBackgroundPaperElevation4 (skipped: "no use")
|
|
79
|
+
5: y,
|
|
80
|
+
6: "#232537",
|
|
81
|
+
// ZeroGravityBackgroundPaperElevation6 (skipped: "no use")
|
|
82
|
+
7: "#26283b",
|
|
83
|
+
// ZeroGravityBackgroundPaperElevation7 (skipped: "no use")
|
|
84
|
+
8: b,
|
|
85
|
+
9: "#2c2e43",
|
|
86
|
+
// ZeroGravityBackgroundPaperElevation9 (skipped: "no use")
|
|
87
|
+
10: "#2f3147",
|
|
88
|
+
// ZeroGravityBackgroundPaperElevation10 (skipped: "no use")
|
|
89
|
+
11: u,
|
|
90
|
+
12: "#35374f",
|
|
91
|
+
// ZeroGravityBackgroundPaperElevation12 (skipped: "no use")
|
|
92
|
+
13: "#383a53",
|
|
93
|
+
// ZeroGravityBackgroundPaperElevation13 (skipped: "no use")
|
|
94
|
+
14: "#3b3d57",
|
|
95
|
+
// ZeroGravityBackgroundPaperElevation14 (skipped: "no use")
|
|
96
|
+
15: "#3e405b",
|
|
97
|
+
// ZeroGravityBackgroundPaperElevation15 (skipped: "no use")
|
|
98
|
+
16: "#393f57"
|
|
99
|
+
// ZeroGravityBackgroundPaperElevation16 (skipped: "no use")
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
paletteExt: {
|
|
103
|
+
primary: {
|
|
104
|
+
hover: `${t}14`,
|
|
105
|
+
// 8% alpha
|
|
106
|
+
selected: `${t}29`,
|
|
107
|
+
// 16% alpha
|
|
108
|
+
focus: `${t}1f`,
|
|
109
|
+
// 12% alpha
|
|
110
|
+
focusVisible: `${t}4d`,
|
|
111
|
+
// 30% alpha
|
|
112
|
+
outlineBorder: `${t}80`
|
|
113
|
+
// 50% alpha
|
|
114
|
+
},
|
|
115
|
+
secondary: {
|
|
116
|
+
tonal: c
|
|
117
|
+
},
|
|
118
|
+
components: {
|
|
119
|
+
inputFilledEnabledFill: p
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
shape: {
|
|
123
|
+
borderRadius: Number.parseInt(i, 10)
|
|
124
|
+
},
|
|
125
|
+
typography: {
|
|
126
|
+
fontFamily: '"Inter", "Roboto", "Helvetica", "Arial", system-ui, sans-serif',
|
|
127
|
+
fontWeightRegular: 500,
|
|
128
|
+
// Weight 400 per Figma/NovaDeck (design ruling CP2.4) — fontWeightRegular
|
|
129
|
+
// 500 would otherwise apply. Buttons keep weight 500 (fontWeightMedium),
|
|
130
|
+
// as MUI's button variant does.
|
|
131
|
+
body2: { fontSize: 14, fontWeight: 400 }
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function V() {
|
|
136
|
+
const o = i;
|
|
137
|
+
return {
|
|
138
|
+
MuiCssBaseline: {
|
|
139
|
+
// Static (not a function-form callback) so consumer global selectors
|
|
140
|
+
// deep-merge into these rules instead of replacing them. Uses the
|
|
141
|
+
// ZeroGravityDivider token directly (same value as palette.divider).
|
|
142
|
+
styleOverrides: {
|
|
143
|
+
"html, body, *": {
|
|
144
|
+
scrollbarWidth: "none",
|
|
145
|
+
msOverflowStyle: "none"
|
|
146
|
+
},
|
|
147
|
+
"html:hover, body:hover, *:hover": {
|
|
148
|
+
scrollbarWidth: "thin",
|
|
149
|
+
scrollbarColor: `${d} transparent`
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
MuiButton: {
|
|
154
|
+
styleOverrides: {
|
|
155
|
+
root: {
|
|
156
|
+
textTransform: "none",
|
|
157
|
+
borderRadius: o
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
variants: [
|
|
161
|
+
{
|
|
162
|
+
props: { color: "secondary", variant: "contained" },
|
|
163
|
+
style: ({ theme: r }) => {
|
|
164
|
+
var e, a, n;
|
|
165
|
+
return {
|
|
166
|
+
border: `1px solid ${r.palette.divider}`,
|
|
167
|
+
background: (n = (a = (e = r.paletteExt) == null ? void 0 : e.secondary) == null ? void 0 : a.tonal) == null ? void 0 : n.toString()
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
props: { color: "secondary", variant: "outlined" },
|
|
173
|
+
style: ({ theme: r }) => ({
|
|
174
|
+
border: `1px solid ${r.palette.divider}`
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
MuiTab: {
|
|
180
|
+
styleOverrides: {
|
|
181
|
+
root: ({ theme: r }) => ({
|
|
182
|
+
textTransform: "none",
|
|
183
|
+
color: r.palette.text.secondary,
|
|
184
|
+
"&.Mui-selected": {
|
|
185
|
+
color: r.palette.text.primary
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
MuiTabs: {
|
|
191
|
+
styleOverrides: {
|
|
192
|
+
root: ({ theme: r }) => {
|
|
193
|
+
var e;
|
|
194
|
+
return {
|
|
195
|
+
background: (e = r.palette.backgroundPaperElevation) == null ? void 0 : e[1]
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
MuiToggleButtonGroup: {
|
|
201
|
+
styleOverrides: {
|
|
202
|
+
root: {
|
|
203
|
+
".MuiToggleButtonGroup-firstButton": {
|
|
204
|
+
borderRadius: `${o} 0 0 ${o}`
|
|
205
|
+
},
|
|
206
|
+
".MuiToggleButtonGroup-lastButton": {
|
|
207
|
+
borderRadius: `0 ${o} ${o} 0`
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
MuiToggleButton: {
|
|
213
|
+
styleOverrides: {
|
|
214
|
+
root: {
|
|
215
|
+
textTransform: "none",
|
|
216
|
+
padding: "6px 16px"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
// MuiAutocomplete / MuiSelect root / MuiTooltip are ported 1:1 from
|
|
221
|
+
// NovaDeck's theme.ts, adapted to function-form callbacks so consumer
|
|
222
|
+
// palette overrides propagate.
|
|
223
|
+
MuiAutocomplete: {
|
|
224
|
+
styleOverrides: {
|
|
225
|
+
root: ({ theme: r }) => ({
|
|
226
|
+
background: r.palette.secondary.dark,
|
|
227
|
+
fieldset: {
|
|
228
|
+
border: "none"
|
|
229
|
+
},
|
|
230
|
+
"&.MuiAutocomplete-root": {
|
|
231
|
+
borderRadius: "16px",
|
|
232
|
+
border: "1px solid transparent"
|
|
233
|
+
},
|
|
234
|
+
"&.Mui-focused": {
|
|
235
|
+
border: `1px solid ${r.palette.primary.main}`,
|
|
236
|
+
label: {
|
|
237
|
+
transform: "translate(14px, 6px) scale(0.75)",
|
|
238
|
+
color: r.palette.text.secondary
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"&.MuiAutocomplete-hasClearIcon": {
|
|
242
|
+
label: {
|
|
243
|
+
transform: "translate(14px, 6px) scale(0.75)"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
label: {
|
|
247
|
+
color: r.palette.text.secondary
|
|
248
|
+
},
|
|
249
|
+
input: {
|
|
250
|
+
transform: "translate(0px, 6px)"
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
MuiSelect: {
|
|
256
|
+
styleOverrides: {
|
|
257
|
+
root: ({ theme: r }) => ({
|
|
258
|
+
background: r.palette.secondary.dark,
|
|
259
|
+
borderRadius: "16px",
|
|
260
|
+
border: "1px solid transparent",
|
|
261
|
+
fieldset: {
|
|
262
|
+
border: "none"
|
|
263
|
+
},
|
|
264
|
+
"&:hover": {
|
|
265
|
+
border: `1px solid ${r.palette.action.hover}`
|
|
266
|
+
},
|
|
267
|
+
"&.Mui-focused": {
|
|
268
|
+
border: `1px solid ${r.palette.primary.main}`
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
},
|
|
272
|
+
variants: [
|
|
273
|
+
{
|
|
274
|
+
props: { variant: "filled" },
|
|
275
|
+
style: {
|
|
276
|
+
borderRadius: o,
|
|
277
|
+
"::before, ::after": {
|
|
278
|
+
visibility: "collapse"
|
|
279
|
+
},
|
|
280
|
+
".MuiInputBase-input": {
|
|
281
|
+
padding: "6px 16px",
|
|
282
|
+
borderRadius: o
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
MuiTooltip: {
|
|
289
|
+
styleOverrides: {
|
|
290
|
+
tooltip: ({ theme: r }) => {
|
|
291
|
+
var e;
|
|
292
|
+
return {
|
|
293
|
+
background: (e = r.palette.backgroundPaperElevation) == null ? void 0 : e[1],
|
|
294
|
+
border: `1px solid ${r.palette.divider}`,
|
|
295
|
+
borderRadius: i,
|
|
296
|
+
padding: "8px 12px",
|
|
297
|
+
lineHeight: "1.8em",
|
|
298
|
+
fontWeight: "300",
|
|
299
|
+
fontSize: "10px",
|
|
300
|
+
maxWidth: "260px"
|
|
301
|
+
};
|
|
302
|
+
},
|
|
303
|
+
arrow: ({ theme: r }) => {
|
|
304
|
+
var e;
|
|
305
|
+
return {
|
|
306
|
+
"&:before": {
|
|
307
|
+
border: `1px solid ${r.palette.divider}`,
|
|
308
|
+
background: (e = r.palette.backgroundPaperElevation) == null ? void 0 : e[1]
|
|
309
|
+
},
|
|
310
|
+
color: r.palette.common.white
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
MuiDrawer: {
|
|
316
|
+
styleOverrides: {
|
|
317
|
+
paper: {
|
|
318
|
+
border: "none",
|
|
319
|
+
boxShadow: "4px 0 8px -4px rgba(0, 0, 0, 0.3)"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
MuiDialog: {
|
|
324
|
+
styleOverrides: {
|
|
325
|
+
paper: ({ theme: r }) => {
|
|
326
|
+
var e;
|
|
327
|
+
return {
|
|
328
|
+
background: (e = r.palette.backgroundPaperElevation) == null ? void 0 : e[2],
|
|
329
|
+
border: `1px solid ${r.palette.divider}`,
|
|
330
|
+
borderRadius: "16px"
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
MuiFab: {
|
|
336
|
+
styleOverrides: {
|
|
337
|
+
root: ({ theme: r }) => {
|
|
338
|
+
var e, a;
|
|
339
|
+
return {
|
|
340
|
+
background: (a = (e = r.paletteExt) == null ? void 0 : e.secondary) == null ? void 0 : a.tonal
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
variants: [
|
|
345
|
+
{
|
|
346
|
+
props: { color: "primary" },
|
|
347
|
+
style: ({ theme: r }) => ({
|
|
348
|
+
background: r.palette.primary.main
|
|
349
|
+
})
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function H(o) {
|
|
356
|
+
var r;
|
|
357
|
+
for (const e of o)
|
|
358
|
+
if (((r = e == null ? void 0 : e.palette) == null ? void 0 : r.mode) === "light")
|
|
359
|
+
throw new Error(
|
|
360
|
+
"createNovaMuiTheme: palette.mode 'light' is not yet supported by @wandelbots/mui. Use the default dark theme or omit palette.mode. Light tokens will land when synced from Figma."
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
function U(...o) {
|
|
364
|
+
return H(o), s(
|
|
365
|
+
I(),
|
|
366
|
+
{ components: V() },
|
|
367
|
+
...o
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
export {
|
|
371
|
+
V as commonComponents,
|
|
372
|
+
U as createNovaMuiTheme,
|
|
373
|
+
I as darkBaseOptions
|
|
374
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAcA,YAAY,EACV,wBAAwB,EACxB,cAAc,GACf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(e,t){return r=>{if(!e(r))throw new Error(t);return r}}exports.assertValid=i;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Parses a raw input string into T; throws `Error(message)` on invalid input. */
|
|
2
|
+
export type Parser<T> = (raw: string) => T;
|
|
3
|
+
/** Boolean validity check; never throws. */
|
|
4
|
+
export type Predicate = (raw: string) => boolean;
|
|
5
|
+
/** Turn a predicate + message into a `Parser<string>` (returns the raw string unchanged). */
|
|
6
|
+
export declare function assertValid(predicate: Predicate, message: string): Parser<string>;
|
|
7
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/validators/core.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,CAAA;AAE1C,4CAA4C;AAC5C,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAA;AAEhD,6FAA6F;AAC7F,wBAAgB,WAAW,CACzB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,CAAC,CAOhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./core.cjs"),e=require("./network.cjs"),r=require("./number.cjs"),t=require("./string.cjs");exports.assertValid=s.assertValid;exports.isCidr=e.isCidr;exports.isHostname=e.isHostname;exports.isHttpUrl=e.isHttpUrl;exports.isIpv4=e.isIpv4;exports.isPort=e.isPort;exports.parseCidr=e.parseCidr;exports.parseHostname=e.parseHostname;exports.parseHttpUrl=e.parseHttpUrl;exports.parseIpv4=e.parseIpv4;exports.parsePort=e.parsePort;exports.parseFloatInRange=r.parseFloatInRange;exports.parseFloatStrict=r.parseFloatStrict;exports.parseInteger=r.parseInteger;exports.parseIntegerInRange=r.parseIntegerInRange;exports.matches=t.matches;exports.maxLength=t.maxLength;exports.minLength=t.minLength;exports.nonEmpty=t.nonEmpty;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { assertValid as t } from "./core.js";
|
|
2
|
+
import { isCidr as s, isHostname as p, isHttpUrl as o, isIpv4 as n, isPort as i, parseCidr as m, parseHostname as g, parseHttpUrl as I, parseIpv4 as l, parsePort as x } from "./network.js";
|
|
3
|
+
import { parseFloatInRange as H, parseFloatStrict as d, parseInteger as h, parseIntegerInRange as c } from "./number.js";
|
|
4
|
+
import { matches as C, maxLength as F, minLength as L, nonEmpty as P } from "./string.js";
|
|
5
|
+
export {
|
|
6
|
+
t as assertValid,
|
|
7
|
+
s as isCidr,
|
|
8
|
+
p as isHostname,
|
|
9
|
+
o as isHttpUrl,
|
|
10
|
+
n as isIpv4,
|
|
11
|
+
i as isPort,
|
|
12
|
+
C as matches,
|
|
13
|
+
F as maxLength,
|
|
14
|
+
L as minLength,
|
|
15
|
+
P as nonEmpty,
|
|
16
|
+
m as parseCidr,
|
|
17
|
+
H as parseFloatInRange,
|
|
18
|
+
d as parseFloatStrict,
|
|
19
|
+
g as parseHostname,
|
|
20
|
+
I as parseHttpUrl,
|
|
21
|
+
h as parseInteger,
|
|
22
|
+
c as parseIntegerInRange,
|
|
23
|
+
l as parseIpv4,
|
|
24
|
+
x as parsePort
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core.cjs"),c=/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,r=t=>c.test(t),l=e.assertValid(r,"Not a valid IPv4 address."),a=t=>/^[1-9]\d{0,4}$/.test(t)&&Number(t)<=65535,u=t=>{if(!a(t))throw new Error("Port must be between 1 and 65535.");return Number(t)},v=/^(?=.{1,253}$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,n=t=>v.test(t)&&!/^[\d.]+$/.test(t),m=e.assertValid(n,"Not a valid hostname."),i=t=>{const[s,o,...p]=t.split("/");return p.length>0||o===void 0?!1:r(s)&&/^(3[0-2]|[12]?\d)$/.test(o)},h=e.assertValid(i,"Not a valid IPv4 CIDR block (e.g. 10.0.0.0/8)."),d=t=>{try{const s=new URL(t);return s.protocol==="http:"||s.protocol==="https:"}catch{return!1}},H=e.assertValid(d,"Not a valid http(s) URL.");exports.isCidr=i;exports.isHostname=n;exports.isHttpUrl=d;exports.isIpv4=r;exports.isPort=a;exports.parseCidr=h;exports.parseHostname=m;exports.parseHttpUrl=H;exports.parseIpv4=l;exports.parsePort=u;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Parser, Predicate } from "./core";
|
|
2
|
+
/** Valid IPv4 address (four octets 0–255, no leading zeros). */
|
|
3
|
+
export declare const isIpv4: Predicate;
|
|
4
|
+
export declare const parseIpv4: Parser<string>;
|
|
5
|
+
/** TCP/UDP port: integer 1–65535 (0 excluded per spec/03; no leading zeros). */
|
|
6
|
+
export declare const isPort: Predicate;
|
|
7
|
+
export declare const parsePort: Parser<number>;
|
|
8
|
+
/**
|
|
9
|
+
* RFC-1123 hostname. All-numeric names (digits and dots only, e.g. "65535" or
|
|
10
|
+
* "192.168.1.1") are rejected even though RFC-1123 technically allows them —
|
|
11
|
+
* they are ambiguous with IP addresses (spec/03 test matrix).
|
|
12
|
+
*/
|
|
13
|
+
export declare const isHostname: Predicate;
|
|
14
|
+
export declare const parseHostname: Parser<string>;
|
|
15
|
+
/** IPv4 CIDR block: a.b.c.d/prefix with prefix 0–32 (no leading zeros). */
|
|
16
|
+
export declare const isCidr: Predicate;
|
|
17
|
+
export declare const parseCidr: Parser<string>;
|
|
18
|
+
/** http(s) URL accepted by `new URL()` — matches RobotPad's validateHost approach. */
|
|
19
|
+
export declare const isHttpUrl: Predicate;
|
|
20
|
+
export declare const parseHttpUrl: Parser<string>;
|
|
21
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/validators/network.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAW/C,gEAAgE;AAChE,eAAO,MAAM,MAAM,EAAE,SAAwC,CAAA;AAE7D,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,CAGpC,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,MAAM,EAAE,SAC+B,CAAA;AAEpD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,CAKpC,CAAA;AAQD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,SACyB,CAAA;AAElD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,CAGxC,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,MAAM,EAAE,SAMpB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,CAGpC,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,SAAS,EAAE,SAOvB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAGvC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { assertValid as e } from "./core.js";
|
|
2
|
+
const n = /^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, r = (t) => n.test(t), m = e(
|
|
3
|
+
r,
|
|
4
|
+
"Not a valid IPv4 address."
|
|
5
|
+
), d = (t) => /^[1-9]\d{0,4}$/.test(t) && Number(t) <= 65535, u = (t) => {
|
|
6
|
+
if (!d(t))
|
|
7
|
+
throw new Error("Port must be between 1 and 65535.");
|
|
8
|
+
return Number(t);
|
|
9
|
+
}, c = /^(?=.{1,253}$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, i = (t) => c.test(t) && !/^[\d.]+$/.test(t), h = e(
|
|
10
|
+
i,
|
|
11
|
+
"Not a valid hostname."
|
|
12
|
+
), p = (t) => {
|
|
13
|
+
const [s, o, ...a] = t.split("/");
|
|
14
|
+
return a.length > 0 || o === void 0 ? !1 : r(s) && /^(3[0-2]|[12]?\d)$/.test(o);
|
|
15
|
+
}, f = e(
|
|
16
|
+
p,
|
|
17
|
+
"Not a valid IPv4 CIDR block (e.g. 10.0.0.0/8)."
|
|
18
|
+
), l = (t) => {
|
|
19
|
+
try {
|
|
20
|
+
const s = new URL(t);
|
|
21
|
+
return s.protocol === "http:" || s.protocol === "https:";
|
|
22
|
+
} catch {
|
|
23
|
+
return !1;
|
|
24
|
+
}
|
|
25
|
+
}, z = e(
|
|
26
|
+
l,
|
|
27
|
+
"Not a valid http(s) URL."
|
|
28
|
+
);
|
|
29
|
+
export {
|
|
30
|
+
p as isCidr,
|
|
31
|
+
i as isHostname,
|
|
32
|
+
l as isHttpUrl,
|
|
33
|
+
r as isIpv4,
|
|
34
|
+
d as isPort,
|
|
35
|
+
f as parseCidr,
|
|
36
|
+
h as parseHostname,
|
|
37
|
+
z as parseHttpUrl,
|
|
38
|
+
m as parseIpv4,
|
|
39
|
+
u as parsePort
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=r=>{const e=r.trim();if(e.length===0)throw new Error("Input string is empty.");if(!/^[+-]?([0-9]*[.])?[0-9]+([eE][+-]?[0-9]+)?$/.test(e))throw new Error("Input string is not a valid floating point number.");const t=Number(e);if(Number.isNaN(t))throw new Error("Input string cannot be parsed into a float.");return t},a=r=>{const e=r.trim();if(e.length===0)throw new Error("Input string is empty.");if(!/^[+-]?\d+$/.test(e))throw new Error("Input string is not a valid integer.");return Number(e)};function s(r,e){return n=>{const t=o(n);if(t<r||t>e)throw new Error(`Value must be between ${r} and ${e}.`);return t}}function i(r,e){return n=>{const t=a(n);if(t<r||t>e)throw new Error(`Value must be between ${r} and ${e}.`);return t}}exports.parseFloatInRange=s;exports.parseFloatStrict=o;exports.parseInteger=a;exports.parseIntegerInRange=i;
|