@sybilion/uilib 1.5.0 → 1.6.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 +17 -1
- package/assets/base.css +148 -0
- package/assets/globals.css +10 -564
- package/assets/tokens.css +288 -0
- package/dist/esm/src/components/ui/AnalysesSelector/AnalysesSelector.styl.js +1 -1
- package/dist/esm/src/components/ui/AppHeader/AppHeader.styl.js +1 -1
- package/dist/esm/src/components/ui/Breadcrumb/Breadcrumb.js +2 -2
- package/dist/esm/src/components/ui/Breadcrumb/Breadcrumb.styl.js +1 -1
- package/dist/esm/src/components/ui/Button/Button.styl.js +1 -1
- package/dist/esm/src/components/ui/Chat/ChatChrome/ChatChrome.js +1 -1
- package/dist/esm/src/components/ui/Checkbox/Checkbox.styl.js +1 -1
- package/dist/esm/src/components/ui/Chip/Chip.styl.js +1 -1
- package/dist/esm/src/components/ui/DatePicker/DatePicker.styl.js +1 -1
- package/dist/esm/src/components/ui/Dialog/Dialog.styl.js +1 -1
- package/dist/esm/src/components/ui/DropdownMenu/DropdownMenu.js +3 -3
- package/dist/esm/src/components/ui/DropdownMenu/DropdownMenu.styl.js +2 -2
- package/dist/esm/src/components/ui/FileChip/FileChip.styl.js +1 -1
- package/dist/esm/src/components/ui/Input/Input.styl.js +1 -1
- package/dist/esm/src/components/ui/LegacyPlatformLink/LegacyPlatformLink.styl.js +1 -1
- package/dist/esm/src/components/ui/Notifications/Notifications.styl.js +1 -1
- package/dist/esm/src/components/ui/RadioGroup/RadioGroup.styl.js +1 -1
- package/dist/esm/src/components/ui/Select/Select.styl.js +1 -1
- package/dist/esm/src/components/ui/Sheet/Sheet.js +1 -1
- package/dist/esm/src/components/ui/Sheet/Sheet.styl.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.styl.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.styl.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.styl.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.styl.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarRail/SidebarRail.styl.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.styl.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.js +1 -1
- package/dist/esm/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl.js +1 -1
- package/dist/esm/src/components/ui/Slider/Slider.styl.js +1 -1
- package/dist/esm/src/components/ui/SupplyChainMap/SupplyChainMap.styl.js +1 -1
- package/dist/esm/src/components/ui/SupplyChainMap/use-map-base-renderer.js +2 -2
- package/dist/esm/src/components/ui/Switch/Switch.styl.js +1 -1
- package/dist/esm/src/components/ui/Tabs/Tabs.styl.js +1 -1
- package/dist/esm/src/components/ui/Toggle/Toggle.styl.js +1 -1
- package/dist/esm/src/components/ui/ToggleGroup/ToggleGroup.styl.js +1 -1
- package/dist/esm/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.styl.js +1 -1
- package/dist/esm/src/components/widgets/DriverMap/DriverIcon/DriverIcon.styl.js +1 -1
- package/dist/esm/src/components/widgets/DriverMap/driverCategoryIcon.js +23 -23
- package/dist/esm/types/src/docs/config/vite.config.d.ts +2 -0
- package/dist/esm/types/tests/buttonStyles.test.d.ts +1 -0
- package/dist/esm/types/tests/cssEntries.test.d.ts +1 -0
- package/dist/esm/types/tests/focusOutline.test.d.ts +1 -0
- package/package.json +9 -28
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +1 -2
- package/src/components/ui/Button/Button.styl +118 -104
- package/src/components/ui/Chat/ChatChrome/ChatChrome.tsx +1 -1
- package/src/components/ui/Chat/ChatPrompt/ChatPrompt.styl.d.ts +11 -11
- package/src/components/ui/DropdownMenu/DropdownMenu.styl +3 -0
- package/src/components/ui/DropdownMenu/DropdownMenu.styl.d.ts +1 -0
- package/src/components/ui/DropdownMenu/DropdownMenu.tsx +3 -3
- package/src/components/ui/Select/Select.styl.d.ts +28 -28
- package/src/components/ui/Sheet/Sheet.tsx +1 -1
- package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl +1 -0
- package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.tsx +1 -1
- package/src/components/ui/SupplyChainMap/SupplyChainMap.styl.d.ts +19 -19
- package/src/components/ui/SupplyChainMap/use-map-base-renderer.ts +2 -1
- package/src/components/widgets/DriverMap/driverCategoryIcon.tsx +23 -23
- package/src/docs/config/vite.config.ts +253 -0
- package/src/docs/pages/SpacingPage.tsx +1 -1
- package/src/lib/theme.styl +3 -1
- package/assets/index.html +0 -18
- package/src/docs/config/webpack.config.js +0 -275
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
// This file is automatically generated.
|
|
2
2
|
// Please do not change this file!
|
|
3
3
|
interface CssExports {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
4
|
+
clear: string;
|
|
5
|
+
darker: string;
|
|
6
|
+
fadeIn: string;
|
|
7
|
+
fadeOut: string;
|
|
8
|
+
searchable: string;
|
|
9
|
+
selectContent: string;
|
|
10
|
+
selectContentPopper: string;
|
|
11
|
+
selectEmpty: string;
|
|
12
|
+
selectIcon: string;
|
|
13
|
+
selectItem: string;
|
|
14
|
+
selectItemIndicator: string;
|
|
15
|
+
selectItemIndicatorContainer: string;
|
|
16
|
+
selectItemText: string;
|
|
17
|
+
selectLabel: string;
|
|
18
|
+
selectScrollButton: string;
|
|
19
|
+
selectScrollIcon: string;
|
|
20
|
+
selectSeparator: string;
|
|
21
|
+
selectTrigger: string;
|
|
22
|
+
selectTriggerInput: string;
|
|
23
|
+
selectViewport: string;
|
|
24
|
+
selectViewportPopper: string;
|
|
25
|
+
selected: string;
|
|
26
|
+
slideInFromBottom: string;
|
|
27
|
+
slideInFromLeft: string;
|
|
28
|
+
slideInFromRight: string;
|
|
29
|
+
slideInFromTop: string;
|
|
30
|
+
zoomIn: string;
|
|
31
|
+
zoomOut: string;
|
|
32
32
|
}
|
|
33
33
|
export const cssExports: CssExports;
|
|
34
34
|
export default cssExports;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
// This file is automatically generated.
|
|
2
2
|
// Please do not change this file!
|
|
3
3
|
interface CssExports {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
action: string;
|
|
5
|
+
baseCanvas: string;
|
|
6
|
+
canvas: string;
|
|
7
|
+
cluster: string;
|
|
8
|
+
dimmed: string;
|
|
9
|
+
disclosure: string;
|
|
10
|
+
empty: string;
|
|
11
|
+
fill: string;
|
|
12
|
+
hint: string;
|
|
13
|
+
inspection: string;
|
|
14
|
+
kicker: string;
|
|
15
|
+
label: string;
|
|
16
|
+
marker: string;
|
|
17
|
+
node: string;
|
|
18
|
+
overlay: string;
|
|
19
|
+
primary: string;
|
|
20
|
+
root: string;
|
|
21
|
+
selected: string;
|
|
22
|
+
zoom: string;
|
|
23
23
|
}
|
|
24
24
|
export const cssExports: CssExports;
|
|
25
25
|
export default cssExports;
|
|
@@ -65,11 +65,12 @@ export function useMapBaseRenderer(
|
|
|
65
65
|
|
|
66
66
|
let worker: Worker;
|
|
67
67
|
try {
|
|
68
|
-
// Bundlers (
|
|
68
|
+
// Bundlers (Vite docs, webpack, Next) resolve this worker entry.
|
|
69
69
|
// Published Rollup output may keep a .ts URL — paint then falls back
|
|
70
70
|
// to the main-thread path below.
|
|
71
71
|
worker = new Worker(
|
|
72
72
|
new URL('./SupplyChainMap.render.worker.ts', import.meta.url),
|
|
73
|
+
{ type: 'module' },
|
|
73
74
|
);
|
|
74
75
|
} catch {
|
|
75
76
|
forceMainRef.current = true;
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
// Icon mapping based on category
|
|
26
26
|
export const getCategoryIcon = (category: string | undefined | null) => {
|
|
27
27
|
if (!category) {
|
|
28
|
-
return <ChartBarIcon
|
|
28
|
+
return <ChartBarIcon size="100%" />;
|
|
29
29
|
}
|
|
30
30
|
const categoryLower = category.toLowerCase();
|
|
31
31
|
|
|
@@ -36,7 +36,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
36
36
|
categoryLower.includes('residential') ||
|
|
37
37
|
categoryLower.includes('property')
|
|
38
38
|
)
|
|
39
|
-
return <HouseIcon
|
|
39
|
+
return <HouseIcon size="100%" />;
|
|
40
40
|
|
|
41
41
|
// Construction & Infrastructure
|
|
42
42
|
if (
|
|
@@ -47,7 +47,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
47
47
|
categoryLower.includes('engineering') ||
|
|
48
48
|
categoryLower.includes('contracting')
|
|
49
49
|
)
|
|
50
|
-
return <HardHatIcon
|
|
50
|
+
return <HardHatIcon size="100%" />;
|
|
51
51
|
|
|
52
52
|
// Climate & Environment
|
|
53
53
|
if (
|
|
@@ -60,7 +60,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
60
60
|
categoryLower.includes('sustainability') ||
|
|
61
61
|
categoryLower.includes('green')
|
|
62
62
|
)
|
|
63
|
-
return <ThermometerIcon
|
|
63
|
+
return <ThermometerIcon size="100%" />;
|
|
64
64
|
|
|
65
65
|
// Supply Chain & Trade
|
|
66
66
|
if (
|
|
@@ -69,7 +69,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
69
69
|
categoryLower.includes('logistics') ||
|
|
70
70
|
categoryLower.includes('transport')
|
|
71
71
|
)
|
|
72
|
-
return <TruckIcon
|
|
72
|
+
return <TruckIcon size="100%" />;
|
|
73
73
|
|
|
74
74
|
// Energy & Power
|
|
75
75
|
if (
|
|
@@ -77,7 +77,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
77
77
|
categoryLower.includes('power') ||
|
|
78
78
|
categoryLower.includes('electricity')
|
|
79
79
|
)
|
|
80
|
-
return <LightningIcon
|
|
80
|
+
return <LightningIcon size="100%" />;
|
|
81
81
|
|
|
82
82
|
// Labor Market & Employment
|
|
83
83
|
if (
|
|
@@ -91,7 +91,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
91
91
|
categoryLower.includes('job market') ||
|
|
92
92
|
categoryLower.includes('workforce')
|
|
93
93
|
)
|
|
94
|
-
return <IdentificationCardIcon
|
|
94
|
+
return <IdentificationCardIcon size="100%" />;
|
|
95
95
|
|
|
96
96
|
// Workforce & Human Resources
|
|
97
97
|
if (
|
|
@@ -103,7 +103,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
103
103
|
categoryLower.includes('talent') ||
|
|
104
104
|
categoryLower.includes('recruitment')
|
|
105
105
|
)
|
|
106
|
-
return <UsersIcon
|
|
106
|
+
return <UsersIcon size="100%" />;
|
|
107
107
|
|
|
108
108
|
// Manufacturing & Production
|
|
109
109
|
if (
|
|
@@ -112,7 +112,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
112
112
|
categoryLower.includes('manufacturing') ||
|
|
113
113
|
categoryLower.includes('industry')
|
|
114
114
|
)
|
|
115
|
-
return <FactoryIcon
|
|
115
|
+
return <FactoryIcon size="100%" />;
|
|
116
116
|
|
|
117
117
|
// Finance & Economics
|
|
118
118
|
if (
|
|
@@ -122,7 +122,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
122
122
|
categoryLower.includes('economy') ||
|
|
123
123
|
categoryLower.includes('gdp')
|
|
124
124
|
)
|
|
125
|
-
return <CurrencyDollarIcon
|
|
125
|
+
return <CurrencyDollarIcon size="100%" />;
|
|
126
126
|
|
|
127
127
|
// Data & Analytics
|
|
128
128
|
if (
|
|
@@ -130,7 +130,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
130
130
|
categoryLower.includes('analytics') ||
|
|
131
131
|
categoryLower.includes('statistics')
|
|
132
132
|
)
|
|
133
|
-
return <DatabaseIcon
|
|
133
|
+
return <DatabaseIcon size="100%" />;
|
|
134
134
|
|
|
135
135
|
// Global & International
|
|
136
136
|
if (
|
|
@@ -138,7 +138,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
138
138
|
categoryLower.includes('international') ||
|
|
139
139
|
categoryLower.includes('world')
|
|
140
140
|
)
|
|
141
|
-
return <GlobeIcon
|
|
141
|
+
return <GlobeIcon size="100%" />;
|
|
142
142
|
|
|
143
143
|
// Chemicals & Pharmaceuticals
|
|
144
144
|
if (
|
|
@@ -148,7 +148,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
148
148
|
categoryLower.includes('drug') ||
|
|
149
149
|
categoryLower.includes('compound')
|
|
150
150
|
)
|
|
151
|
-
return <FlaskIcon
|
|
151
|
+
return <FlaskIcon size="100%" />;
|
|
152
152
|
|
|
153
153
|
// Food & Agriculture
|
|
154
154
|
if (
|
|
@@ -161,7 +161,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
161
161
|
categoryLower.includes('dairy') ||
|
|
162
162
|
categoryLower.includes('meat')
|
|
163
163
|
)
|
|
164
|
-
return <ForkKnifeIcon
|
|
164
|
+
return <ForkKnifeIcon size="100%" />;
|
|
165
165
|
|
|
166
166
|
// Income & Wealth
|
|
167
167
|
if (
|
|
@@ -172,7 +172,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
172
172
|
categoryLower.includes('earnings') ||
|
|
173
173
|
categoryLower.includes('revenue')
|
|
174
174
|
)
|
|
175
|
-
return <WalletIcon
|
|
175
|
+
return <WalletIcon size="100%" />;
|
|
176
176
|
|
|
177
177
|
// Consumption & Retail
|
|
178
178
|
if (
|
|
@@ -183,7 +183,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
183
183
|
categoryLower.includes('purchases') ||
|
|
184
184
|
categoryLower.includes('demand')
|
|
185
185
|
)
|
|
186
|
-
return <ShoppingCartIcon
|
|
186
|
+
return <ShoppingCartIcon size="100%" />;
|
|
187
187
|
|
|
188
188
|
// Living Conditions & Quality of Life
|
|
189
189
|
if (
|
|
@@ -195,7 +195,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
195
195
|
categoryLower.includes('welfare') ||
|
|
196
196
|
categoryLower.includes('happiness')
|
|
197
197
|
)
|
|
198
|
-
return <HeartIcon
|
|
198
|
+
return <HeartIcon size="100%" />;
|
|
199
199
|
|
|
200
200
|
// Minerals & Mining
|
|
201
201
|
if (
|
|
@@ -210,7 +210,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
210
210
|
categoryLower.includes('aluminum') ||
|
|
211
211
|
categoryLower.includes('lithium')
|
|
212
212
|
)
|
|
213
|
-
return <TreeIcon
|
|
213
|
+
return <TreeIcon size="100%" />;
|
|
214
214
|
|
|
215
215
|
// Textiles & Fibers
|
|
216
216
|
if (
|
|
@@ -225,7 +225,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
225
225
|
categoryLower.includes('garment') ||
|
|
226
226
|
categoryLower.includes('apparel')
|
|
227
227
|
)
|
|
228
|
-
return <TShirtIcon
|
|
228
|
+
return <TShirtIcon size="100%" />;
|
|
229
229
|
|
|
230
230
|
// Crafts & Artisan
|
|
231
231
|
if (
|
|
@@ -239,7 +239,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
239
239
|
categoryLower.includes('woodwork') ||
|
|
240
240
|
categoryLower.includes('jewelry')
|
|
241
241
|
)
|
|
242
|
-
return <WrenchIcon
|
|
242
|
+
return <WrenchIcon size="100%" />;
|
|
243
243
|
|
|
244
244
|
// Population & Demographics
|
|
245
245
|
if (
|
|
@@ -254,7 +254,7 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
254
254
|
categoryLower.includes('gender') ||
|
|
255
255
|
categoryLower.includes('ethnicity')
|
|
256
256
|
)
|
|
257
|
-
return <UsersIcon
|
|
257
|
+
return <UsersIcon size="100%" />;
|
|
258
258
|
|
|
259
259
|
// Market Indices & Trading
|
|
260
260
|
if (
|
|
@@ -270,8 +270,8 @@ export const getCategoryIcon = (category: string | undefined | null) => {
|
|
|
270
270
|
categoryLower.includes('ftse') ||
|
|
271
271
|
categoryLower.includes('candlestick')
|
|
272
272
|
)
|
|
273
|
-
return <ChartLineIcon
|
|
273
|
+
return <ChartLineIcon size="100%" />;
|
|
274
274
|
|
|
275
275
|
// Default fallback
|
|
276
|
-
return <ChartBarIcon
|
|
276
|
+
return <ChartBarIcon size="100%" />;
|
|
277
277
|
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import react from '@vitejs/plugin-react-swc';
|
|
2
|
+
import { createHash } from 'crypto';
|
|
3
|
+
import { copyFileSync, existsSync, readFileSync, writeFileSync } from 'fs';
|
|
4
|
+
import { basename, resolve as pathResolve, relative } from 'path';
|
|
5
|
+
import postcssPresetEnv from 'postcss-preset-env';
|
|
6
|
+
import { type Plugin, defineConfig, loadEnv } from 'vite';
|
|
7
|
+
import svgr from 'vite-plugin-svgr';
|
|
8
|
+
|
|
9
|
+
import pkg from '../../../package.json';
|
|
10
|
+
import paths from './paths';
|
|
11
|
+
|
|
12
|
+
/** Favicon rasterization has no CSS context; currentColor in logo.svg renders black. */
|
|
13
|
+
const faviconLogoSvgPath = pathResolve(paths.assets, 'logo-favicon.svg');
|
|
14
|
+
const themeStyl = pathResolve(paths.src, 'theme.styl');
|
|
15
|
+
|
|
16
|
+
/** GitHub Pages project sites live at /<repo>/; set PUBLIC_PATH=/repo-name/ for production deploy. */
|
|
17
|
+
function normalizePublicPath(raw: string | undefined) {
|
|
18
|
+
const v = (raw && String(raw).trim()) || '/';
|
|
19
|
+
if (v === '/') {
|
|
20
|
+
return '/';
|
|
21
|
+
}
|
|
22
|
+
const withLeading = v.startsWith('/') ? v : `/${v}`;
|
|
23
|
+
return withLeading.endsWith('/') ? withLeading : `${withLeading}/`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function routerBasenameFromPublicPath(publicPath: string) {
|
|
27
|
+
if (publicPath === '/') {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
return publicPath.replace(/\/$/, '');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const STYL_MODULE_QUERY = '?.module.styl';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Every `.styl` file is a CSS module (no `.module.styl` suffix), but Vite only
|
|
37
|
+
* treats `*.module.*` ids as modules. Tag resolved `.styl` imports with a query
|
|
38
|
+
* ending in `.module.styl` so Vite's CSS-modules check matches while the id
|
|
39
|
+
* still points at the real file (HMR and file reads use the path before `?`).
|
|
40
|
+
*/
|
|
41
|
+
function stylusModules(): Plugin {
|
|
42
|
+
return {
|
|
43
|
+
name: 'uilib:stylus-modules',
|
|
44
|
+
enforce: 'pre',
|
|
45
|
+
async resolveId(source, importer, options) {
|
|
46
|
+
if (!importer || !/\.styl$/.test(source)) return null;
|
|
47
|
+
const resolved = await this.resolve(source, importer, {
|
|
48
|
+
...options,
|
|
49
|
+
skipSelf: true,
|
|
50
|
+
});
|
|
51
|
+
if (!resolved || resolved.external || resolved.id.includes('?')) {
|
|
52
|
+
return resolved;
|
|
53
|
+
}
|
|
54
|
+
return { ...resolved, id: `${resolved.id}${STYL_MODULE_QUERY}` };
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** `import text from './AGENT.md'` → file contents as a string (webpack `asset/source`). */
|
|
60
|
+
function rawMarkdown(): Plugin {
|
|
61
|
+
return {
|
|
62
|
+
name: 'uilib:raw-md',
|
|
63
|
+
enforce: 'pre',
|
|
64
|
+
load(id) {
|
|
65
|
+
if (!id.endsWith('.md')) return null;
|
|
66
|
+
return `export default ${JSON.stringify(readFileSync(id, 'utf8'))};`;
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** `[name]__[local]___[hash:base64:5]`, as css-loader produced it under webpack. */
|
|
72
|
+
function scopedName(local: string, filename: string) {
|
|
73
|
+
const file = filename.split('?')[0];
|
|
74
|
+
const name = basename(file).replace(/\.[^.]+$/, '');
|
|
75
|
+
const hash = createHash('md5')
|
|
76
|
+
.update(`${relative(paths.src, file)}\0${local}`)
|
|
77
|
+
.digest('base64url')
|
|
78
|
+
.slice(0, 5);
|
|
79
|
+
return `${name}__${local}___${hash}`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Keep `Foo.styl.d.ts` class typings in sync (what css-modules-typescript-loader
|
|
84
|
+
* did under webpack). Rewrites only when the set of class names changed, so
|
|
85
|
+
* files formatted by prettier are left alone.
|
|
86
|
+
*/
|
|
87
|
+
function writeStylTypings(cssFileName: string, json: Record<string, string>) {
|
|
88
|
+
const dts = `${cssFileName.split('?')[0]}.d.ts`;
|
|
89
|
+
const keys = Object.keys(json).sort();
|
|
90
|
+
const existing = existsSync(dts)
|
|
91
|
+
? [...readFileSync(dts, 'utf8').matchAll(/^\s+'?([^':\s]+)'?: string;$/gm)]
|
|
92
|
+
.map(m => m[1])
|
|
93
|
+
.sort()
|
|
94
|
+
: null;
|
|
95
|
+
if (existing && existing.join('\n') === keys.join('\n')) return;
|
|
96
|
+
writeFileSync(
|
|
97
|
+
dts,
|
|
98
|
+
[
|
|
99
|
+
'// This file is automatically generated.',
|
|
100
|
+
'// Please do not change this file!',
|
|
101
|
+
'interface CssExports {',
|
|
102
|
+
...keys.map(k => ` '${k}': string;`),
|
|
103
|
+
'}',
|
|
104
|
+
'export const cssExports: CssExports;',
|
|
105
|
+
'export default cssExports;',
|
|
106
|
+
'',
|
|
107
|
+
].join('\n'),
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Build only: rasterize favicons + web manifest and inject their tags. */
|
|
112
|
+
function favicons(base: string): Plugin {
|
|
113
|
+
const prefix = 'favicons/';
|
|
114
|
+
let response: {
|
|
115
|
+
images: { name: string; contents: Buffer }[];
|
|
116
|
+
files: { name: string; contents: string }[];
|
|
117
|
+
html: string[];
|
|
118
|
+
} | null = null;
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
name: 'uilib:favicons',
|
|
122
|
+
apply: 'build',
|
|
123
|
+
async buildStart() {
|
|
124
|
+
if (!existsSync(faviconLogoSvgPath)) return;
|
|
125
|
+
const { favicons: generate } = await import('favicons');
|
|
126
|
+
response = await generate(faviconLogoSvgPath, {
|
|
127
|
+
path: `${base}${prefix}`,
|
|
128
|
+
appName: 'Sybilion Design System',
|
|
129
|
+
developerName: 'Sybilion',
|
|
130
|
+
developerURL: null,
|
|
131
|
+
background: '#fff',
|
|
132
|
+
theme_color: '#1a1a1a',
|
|
133
|
+
display: 'standalone',
|
|
134
|
+
icons: {
|
|
135
|
+
android: true,
|
|
136
|
+
appleIcon: true,
|
|
137
|
+
appleStartup: false,
|
|
138
|
+
favicons: true,
|
|
139
|
+
windows: true,
|
|
140
|
+
yandex: false,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
generateBundle() {
|
|
145
|
+
if (!response) return;
|
|
146
|
+
for (const { name, contents } of [
|
|
147
|
+
...response.images,
|
|
148
|
+
...response.files,
|
|
149
|
+
]) {
|
|
150
|
+
this.emitFile({
|
|
151
|
+
type: 'asset',
|
|
152
|
+
fileName: `${prefix}${name}`,
|
|
153
|
+
source: contents,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
transformIndexHtml(html) {
|
|
158
|
+
if (!response) return html;
|
|
159
|
+
return html.replace('</head>', `${response.html.join('')}</head>`);
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** GitHub Pages serves 404.html for missing paths; same shell as index.html so SPA routes work. */
|
|
165
|
+
function spaFallback404(): Plugin {
|
|
166
|
+
let outDir = '';
|
|
167
|
+
return {
|
|
168
|
+
name: 'uilib:spa-404',
|
|
169
|
+
apply: 'build',
|
|
170
|
+
configResolved(config) {
|
|
171
|
+
outDir = config.build.outDir;
|
|
172
|
+
},
|
|
173
|
+
closeBundle() {
|
|
174
|
+
copyFileSync(
|
|
175
|
+
pathResolve(outDir, 'index.html'),
|
|
176
|
+
pathResolve(outDir, '404.html'),
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export default defineConfig(({ mode }) => {
|
|
183
|
+
const isDev = mode === 'development';
|
|
184
|
+
const env = loadEnv(mode, process.cwd(), '');
|
|
185
|
+
const publicPath = normalizePublicPath(env.PUBLIC_PATH);
|
|
186
|
+
|
|
187
|
+
const alias: Record<string, string> = {
|
|
188
|
+
'#uilib': paths.src,
|
|
189
|
+
uilib: paths.src,
|
|
190
|
+
'docs/components': `${paths.docs}/components`,
|
|
191
|
+
};
|
|
192
|
+
if (existsSync(themeStyl)) {
|
|
193
|
+
alias.theme = themeStyl;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
base: publicPath,
|
|
198
|
+
publicDir: paths.assets,
|
|
199
|
+
|
|
200
|
+
resolve: { alias },
|
|
201
|
+
|
|
202
|
+
define: {
|
|
203
|
+
isDEV: JSON.stringify(isDev),
|
|
204
|
+
VERSION: JSON.stringify(pkg.version),
|
|
205
|
+
DOCS_ROUTER_BASENAME: JSON.stringify(
|
|
206
|
+
routerBasenameFromPublicPath(publicPath),
|
|
207
|
+
),
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
css: {
|
|
211
|
+
modules: {
|
|
212
|
+
generateScopedName: scopedName,
|
|
213
|
+
getJSON: isDev ? writeStylTypings : undefined,
|
|
214
|
+
},
|
|
215
|
+
preprocessorOptions: {
|
|
216
|
+
// `@import 'lib/theme.styl'` resolves against src/ (webpack resolve.modules).
|
|
217
|
+
// Vite looks options up by file extension, so `.styl` reads `styl`.
|
|
218
|
+
styl: { paths: [paths.src, paths.docs] },
|
|
219
|
+
},
|
|
220
|
+
postcss: {
|
|
221
|
+
// Autoprefixer is on by default in postcss-preset-env.
|
|
222
|
+
plugins: [postcssPresetEnv({ stage: 3 })],
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
plugins: [
|
|
227
|
+
stylusModules(),
|
|
228
|
+
rawMarkdown(),
|
|
229
|
+
svgr({
|
|
230
|
+
include: '**/*.svg',
|
|
231
|
+
// Rendered as <img>/background: keep the default URL import.
|
|
232
|
+
exclude: '**/components/ui/WorldMap/map.svg',
|
|
233
|
+
svgrOptions: { icon: true },
|
|
234
|
+
}),
|
|
235
|
+
react(),
|
|
236
|
+
favicons(publicPath),
|
|
237
|
+
spaFallback404(),
|
|
238
|
+
],
|
|
239
|
+
|
|
240
|
+
server: {
|
|
241
|
+
port: Number(env.PORT) || 8181,
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
build: {
|
|
245
|
+
outDir: paths.build,
|
|
246
|
+
emptyOutDir: true,
|
|
247
|
+
sourcemap: false,
|
|
248
|
+
// Internal docs site: the main bundle and lazy pages (icons, pdfjs, xlsx)
|
|
249
|
+
// are large by design; keep the warning for real regressions only.
|
|
250
|
+
chunkSizeWarningLimit: 1500,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
});
|
|
@@ -6,7 +6,7 @@ import { DocsGuidance } from '../components/DocsGuidance/DocsGuidance';
|
|
|
6
6
|
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
7
7
|
import S from './SpacingPage.styl';
|
|
8
8
|
|
|
9
|
-
/** Steps defined in
|
|
9
|
+
/** Steps defined in assets/tokens.css; each step is 4px. */
|
|
10
10
|
const STEPS = [
|
|
11
11
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 23, 24,
|
|
12
12
|
];
|
package/src/lib/theme.styl
CHANGED
|
@@ -21,8 +21,10 @@ focus-outline-style()
|
|
|
21
21
|
outline var(--focus-outline-width, 2px) solid var(--focus-outline-color, var(--ring))
|
|
22
22
|
outline-offset var(--focus-outline-offset, 2px)
|
|
23
23
|
|
|
24
|
+
// Not excluded: [aria-disabled]. Such an element stays in the tab order (that is
|
|
25
|
+
// why it is not `disabled`, e.g. a busy button), so focus must still be visible.
|
|
24
26
|
focus-outline-target()
|
|
25
|
-
&:not(:disabled):not([
|
|
27
|
+
&:not(:disabled):not([data-disabled])
|
|
26
28
|
focus-outline-style()
|
|
27
29
|
|
|
28
30
|
focus-outline()
|
package/assets/index.html
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="<%= htmlWebpackPlugin.options.lang %>">
|
|
3
|
-
<head>
|
|
4
|
-
<base href="<%= htmlWebpackPlugin.options.baseUrl %>" />
|
|
5
|
-
<title>UILIB</title>
|
|
6
|
-
<meta charset="UTF-8" />
|
|
7
|
-
<meta
|
|
8
|
-
name="viewport"
|
|
9
|
-
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
|
|
10
|
-
/>
|
|
11
|
-
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
12
|
-
<link rel="stylesheet" href="assets/globals.css" />
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<div id="app-root"></div>
|
|
16
|
-
<div id="app-modal"></div>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|