@stndrds/constants 1.0.0-alpha.264 → 1.0.0-alpha.266
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/dist/index.d.mts +1 -15
- package/dist/index.d.ts +1 -15
- package/dist/index.js +45 -10
- package/dist/index.mjs +45 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1485,20 +1485,6 @@ declare const RECOMMENDED_MAX_SIZES: {
|
|
|
1485
1485
|
/** Large archives: 1 GB */
|
|
1486
1486
|
readonly ARCHIVE: number;
|
|
1487
1487
|
};
|
|
1488
|
-
/**
|
|
1489
|
-
* Format a byte count into a human-readable string
|
|
1490
|
-
*
|
|
1491
|
-
* @param bytes - Number of bytes
|
|
1492
|
-
* @param decimals - Number of decimal places (default: 2)
|
|
1493
|
-
* @returns Formatted string, e.g. "1.5 MB"
|
|
1494
|
-
*
|
|
1495
|
-
* @example
|
|
1496
|
-
* ```typescript
|
|
1497
|
-
* formatBytes(1048576) // "1 MB"
|
|
1498
|
-
* formatBytes(1500, 1) // "1.5 KB"
|
|
1499
|
-
* ```
|
|
1500
|
-
*/
|
|
1501
|
-
declare function formatBytes(bytes: number, decimals?: number): string;
|
|
1502
1488
|
/**
|
|
1503
1489
|
* Convert megabytes to bytes
|
|
1504
1490
|
*
|
|
@@ -1779,4 +1765,4 @@ type FormatPreset = {
|
|
|
1779
1765
|
};
|
|
1780
1766
|
declare const TEXT_FORMAT_PRESETS: readonly FormatPreset[];
|
|
1781
1767
|
|
|
1782
|
-
export { AI_CHAT_ACCEPTED_TYPES, AI_CHAT_MAX_FILES, AI_CHAT_MAX_FILE_SIZE, AI_CHAT_SUPPORTED_DOCUMENTS, AI_CHAT_SUPPORTED_IMAGES, AI_CHAT_SUPPORTED_MIME_TYPES, ALL_MIME_TYPES, ARCHIVES, ARCHIVE_MIME_TYPES, ARCHIVE_MIME_TYPES_ARRAY, AUDIO, AUDIO_MIME_TYPES, AUDIO_MIME_TYPES_ARRAY, type ArchiveMimeType, type AudioMimeType, BYTES, CODE, CODE_MIME_TYPES, CODE_MIME_TYPES_ARRAY, COLORS, COLOR_GROUPS, COUNTRIES, CURRENCIES, type CodeMimeType, type Color, type ColorBackground, type ColorBorder, type ColorGroup, type ColorGroupColors, type ColorIcon, type ColorId, type ColorText, type Country, type CountryIso2, type CountryIso3, type CountryName, type CountryNumericCode, type CountryPhoneCode, type Currency, type CurrencyCode, type CurrencyName, type CurrencySymbol, DEFAULT_ATTRIBUTE_ICONS, DEFAULT_TENANT_ID, DOCUMENTS, DOCUMENT_MIME_TYPES, DOCUMENT_MIME_TYPES_ARRAY, type DocumentMimeType, FILE_SIZE, FONTS, FONT_MIME_TYPES, FONT_MIME_TYPES_ARRAY, type FontMimeType, type FormatPreset, type FormatPresetGroup, GIGABYTES, ICONS, IMAGES, IMAGE_MIME_TYPES, IMAGE_MIME_TYPES_ARRAY, type IconName, type ImageMimeType, KILOBYTES, MEDIA, MEGABYTES, MEMORY_DESCRIPTION_MAX_LENGTH, MEMORY_NAME_MAX_LENGTH, type MimeType, OFFICE_DOCUMENTS, RECOMMENDED_MAX_SIZES, SKILL_DESCRIPTION_MAX_LENGTH, SKILL_NAME_MAX_LENGTH, STATUS_COLORS, type StatusColorGroup, TEXT_FORMAT_PRESETS, VIDEO, VIDEO_MIME_TYPES, VIDEO_MIME_TYPES_ARRAY, type VideoMimeType, WEB_IMAGES, bytesToGb, bytesToMb, cn,
|
|
1768
|
+
export { AI_CHAT_ACCEPTED_TYPES, AI_CHAT_MAX_FILES, AI_CHAT_MAX_FILE_SIZE, AI_CHAT_SUPPORTED_DOCUMENTS, AI_CHAT_SUPPORTED_IMAGES, AI_CHAT_SUPPORTED_MIME_TYPES, ALL_MIME_TYPES, ARCHIVES, ARCHIVE_MIME_TYPES, ARCHIVE_MIME_TYPES_ARRAY, AUDIO, AUDIO_MIME_TYPES, AUDIO_MIME_TYPES_ARRAY, type ArchiveMimeType, type AudioMimeType, BYTES, CODE, CODE_MIME_TYPES, CODE_MIME_TYPES_ARRAY, COLORS, COLOR_GROUPS, COUNTRIES, CURRENCIES, type CodeMimeType, type Color, type ColorBackground, type ColorBorder, type ColorGroup, type ColorGroupColors, type ColorIcon, type ColorId, type ColorText, type Country, type CountryIso2, type CountryIso3, type CountryName, type CountryNumericCode, type CountryPhoneCode, type Currency, type CurrencyCode, type CurrencyName, type CurrencySymbol, DEFAULT_ATTRIBUTE_ICONS, DEFAULT_TENANT_ID, DOCUMENTS, DOCUMENT_MIME_TYPES, DOCUMENT_MIME_TYPES_ARRAY, type DocumentMimeType, FILE_SIZE, FONTS, FONT_MIME_TYPES, FONT_MIME_TYPES_ARRAY, type FontMimeType, type FormatPreset, type FormatPresetGroup, GIGABYTES, ICONS, IMAGES, IMAGE_MIME_TYPES, IMAGE_MIME_TYPES_ARRAY, type IconName, type ImageMimeType, KILOBYTES, MEDIA, MEGABYTES, MEMORY_DESCRIPTION_MAX_LENGTH, MEMORY_NAME_MAX_LENGTH, type MimeType, OFFICE_DOCUMENTS, RECOMMENDED_MAX_SIZES, SKILL_DESCRIPTION_MAX_LENGTH, SKILL_NAME_MAX_LENGTH, STATUS_COLORS, type StatusColorGroup, TEXT_FORMAT_PRESETS, VIDEO, VIDEO_MIME_TYPES, VIDEO_MIME_TYPES_ARRAY, type VideoMimeType, WEB_IMAGES, bytesToGb, bytesToMb, cn, gbToBytes, getAllColors, getAllCountries, getAllCurrencies, getColor, getColorIds, getColorsByGroup, getCountryByIso2, getCountryByIso3, getCountryDisplayName, getCountryDisplayNameByIso3, getCurrency, getCurrencySymbol, getDefaultAttributeIcon, getPhoneMaxDigits, getPhoneTrunkPrefix, getSortedCountries, isArchiveMimeType, isAudioMimeType, isCodeMimeType, isDocumentMimeType, isImageMimeType, isValidColorId, isValidCurrencyCode, isValidIso2, isValidIso3, isVideoMimeType, isWithinSizeLimit, mbToBytes, stripTrunkPrefix };
|
package/dist/index.d.ts
CHANGED
|
@@ -1485,20 +1485,6 @@ declare const RECOMMENDED_MAX_SIZES: {
|
|
|
1485
1485
|
/** Large archives: 1 GB */
|
|
1486
1486
|
readonly ARCHIVE: number;
|
|
1487
1487
|
};
|
|
1488
|
-
/**
|
|
1489
|
-
* Format a byte count into a human-readable string
|
|
1490
|
-
*
|
|
1491
|
-
* @param bytes - Number of bytes
|
|
1492
|
-
* @param decimals - Number of decimal places (default: 2)
|
|
1493
|
-
* @returns Formatted string, e.g. "1.5 MB"
|
|
1494
|
-
*
|
|
1495
|
-
* @example
|
|
1496
|
-
* ```typescript
|
|
1497
|
-
* formatBytes(1048576) // "1 MB"
|
|
1498
|
-
* formatBytes(1500, 1) // "1.5 KB"
|
|
1499
|
-
* ```
|
|
1500
|
-
*/
|
|
1501
|
-
declare function formatBytes(bytes: number, decimals?: number): string;
|
|
1502
1488
|
/**
|
|
1503
1489
|
* Convert megabytes to bytes
|
|
1504
1490
|
*
|
|
@@ -1779,4 +1765,4 @@ type FormatPreset = {
|
|
|
1779
1765
|
};
|
|
1780
1766
|
declare const TEXT_FORMAT_PRESETS: readonly FormatPreset[];
|
|
1781
1767
|
|
|
1782
|
-
export { AI_CHAT_ACCEPTED_TYPES, AI_CHAT_MAX_FILES, AI_CHAT_MAX_FILE_SIZE, AI_CHAT_SUPPORTED_DOCUMENTS, AI_CHAT_SUPPORTED_IMAGES, AI_CHAT_SUPPORTED_MIME_TYPES, ALL_MIME_TYPES, ARCHIVES, ARCHIVE_MIME_TYPES, ARCHIVE_MIME_TYPES_ARRAY, AUDIO, AUDIO_MIME_TYPES, AUDIO_MIME_TYPES_ARRAY, type ArchiveMimeType, type AudioMimeType, BYTES, CODE, CODE_MIME_TYPES, CODE_MIME_TYPES_ARRAY, COLORS, COLOR_GROUPS, COUNTRIES, CURRENCIES, type CodeMimeType, type Color, type ColorBackground, type ColorBorder, type ColorGroup, type ColorGroupColors, type ColorIcon, type ColorId, type ColorText, type Country, type CountryIso2, type CountryIso3, type CountryName, type CountryNumericCode, type CountryPhoneCode, type Currency, type CurrencyCode, type CurrencyName, type CurrencySymbol, DEFAULT_ATTRIBUTE_ICONS, DEFAULT_TENANT_ID, DOCUMENTS, DOCUMENT_MIME_TYPES, DOCUMENT_MIME_TYPES_ARRAY, type DocumentMimeType, FILE_SIZE, FONTS, FONT_MIME_TYPES, FONT_MIME_TYPES_ARRAY, type FontMimeType, type FormatPreset, type FormatPresetGroup, GIGABYTES, ICONS, IMAGES, IMAGE_MIME_TYPES, IMAGE_MIME_TYPES_ARRAY, type IconName, type ImageMimeType, KILOBYTES, MEDIA, MEGABYTES, MEMORY_DESCRIPTION_MAX_LENGTH, MEMORY_NAME_MAX_LENGTH, type MimeType, OFFICE_DOCUMENTS, RECOMMENDED_MAX_SIZES, SKILL_DESCRIPTION_MAX_LENGTH, SKILL_NAME_MAX_LENGTH, STATUS_COLORS, type StatusColorGroup, TEXT_FORMAT_PRESETS, VIDEO, VIDEO_MIME_TYPES, VIDEO_MIME_TYPES_ARRAY, type VideoMimeType, WEB_IMAGES, bytesToGb, bytesToMb, cn,
|
|
1768
|
+
export { AI_CHAT_ACCEPTED_TYPES, AI_CHAT_MAX_FILES, AI_CHAT_MAX_FILE_SIZE, AI_CHAT_SUPPORTED_DOCUMENTS, AI_CHAT_SUPPORTED_IMAGES, AI_CHAT_SUPPORTED_MIME_TYPES, ALL_MIME_TYPES, ARCHIVES, ARCHIVE_MIME_TYPES, ARCHIVE_MIME_TYPES_ARRAY, AUDIO, AUDIO_MIME_TYPES, AUDIO_MIME_TYPES_ARRAY, type ArchiveMimeType, type AudioMimeType, BYTES, CODE, CODE_MIME_TYPES, CODE_MIME_TYPES_ARRAY, COLORS, COLOR_GROUPS, COUNTRIES, CURRENCIES, type CodeMimeType, type Color, type ColorBackground, type ColorBorder, type ColorGroup, type ColorGroupColors, type ColorIcon, type ColorId, type ColorText, type Country, type CountryIso2, type CountryIso3, type CountryName, type CountryNumericCode, type CountryPhoneCode, type Currency, type CurrencyCode, type CurrencyName, type CurrencySymbol, DEFAULT_ATTRIBUTE_ICONS, DEFAULT_TENANT_ID, DOCUMENTS, DOCUMENT_MIME_TYPES, DOCUMENT_MIME_TYPES_ARRAY, type DocumentMimeType, FILE_SIZE, FONTS, FONT_MIME_TYPES, FONT_MIME_TYPES_ARRAY, type FontMimeType, type FormatPreset, type FormatPresetGroup, GIGABYTES, ICONS, IMAGES, IMAGE_MIME_TYPES, IMAGE_MIME_TYPES_ARRAY, type IconName, type ImageMimeType, KILOBYTES, MEDIA, MEGABYTES, MEMORY_DESCRIPTION_MAX_LENGTH, MEMORY_NAME_MAX_LENGTH, type MimeType, OFFICE_DOCUMENTS, RECOMMENDED_MAX_SIZES, SKILL_DESCRIPTION_MAX_LENGTH, SKILL_NAME_MAX_LENGTH, STATUS_COLORS, type StatusColorGroup, TEXT_FORMAT_PRESETS, VIDEO, VIDEO_MIME_TYPES, VIDEO_MIME_TYPES_ARRAY, type VideoMimeType, WEB_IMAGES, bytesToGb, bytesToMb, cn, gbToBytes, getAllColors, getAllCountries, getAllCurrencies, getColor, getColorIds, getColorsByGroup, getCountryByIso2, getCountryByIso3, getCountryDisplayName, getCountryDisplayNameByIso3, getCurrency, getCurrencySymbol, getDefaultAttributeIcon, getPhoneMaxDigits, getPhoneTrunkPrefix, getSortedCountries, isArchiveMimeType, isAudioMimeType, isCodeMimeType, isDocumentMimeType, isImageMimeType, isValidColorId, isValidCurrencyCode, isValidIso2, isValidIso3, isVideoMimeType, isWithinSizeLimit, mbToBytes, stripTrunkPrefix };
|
package/dist/index.js
CHANGED
|
@@ -73,7 +73,6 @@ __export(index_exports, {
|
|
|
73
73
|
bytesToGb: () => bytesToGb,
|
|
74
74
|
bytesToMb: () => bytesToMb,
|
|
75
75
|
cn: () => cn,
|
|
76
|
-
formatBytes: () => formatBytes,
|
|
77
76
|
gbToBytes: () => gbToBytes,
|
|
78
77
|
getAllColors: () => getAllColors,
|
|
79
78
|
getAllCountries: () => getAllCountries,
|
|
@@ -295,8 +294,52 @@ function getDefaultAttributeIcon(type) {
|
|
|
295
294
|
// src/cn.ts
|
|
296
295
|
var import_clsx = require("clsx");
|
|
297
296
|
var import_tailwind_merge = require("tailwind-merge");
|
|
297
|
+
var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
|
|
298
|
+
extend: {
|
|
299
|
+
classGroups: {
|
|
300
|
+
/* Every text rung the design system ships, not a subset. The three
|
|
301
|
+
`control` rungs below were registered when this fix was written; the
|
|
302
|
+
six added since — `2xs` and `xs`, the whole `row` family, `metric` —
|
|
303
|
+
were not, so 199 call sites were still silently losing either their
|
|
304
|
+
size or their colour to the merge.
|
|
305
|
+
It fails the way the comment above describes and no louder: the class
|
|
306
|
+
is dropped, the element inherits the 16px root, and nothing warns.
|
|
307
|
+
Measured live on the records grid, the column header rendered at 16px
|
|
308
|
+
for exactly this reason. Any rung added to `theme.css` has to be added
|
|
309
|
+
here in the same change, or it is not really a rung. */
|
|
310
|
+
"font-size": [
|
|
311
|
+
"text-control-2xs",
|
|
312
|
+
"text-control-xs",
|
|
313
|
+
"text-control-sm",
|
|
314
|
+
"text-control-default",
|
|
315
|
+
"text-control-lg",
|
|
316
|
+
"text-row-sm",
|
|
317
|
+
"text-row-default",
|
|
318
|
+
"text-row-lg",
|
|
319
|
+
"text-metric"
|
|
320
|
+
],
|
|
321
|
+
h: [
|
|
322
|
+
"h-control-sm",
|
|
323
|
+
"h-control-default",
|
|
324
|
+
"h-control-lg",
|
|
325
|
+
"h-row-sm",
|
|
326
|
+
"h-row-default",
|
|
327
|
+
"h-row-lg"
|
|
328
|
+
],
|
|
329
|
+
w: ["w-control-sm", "w-control-default", "w-control-lg", "w-query-popover"],
|
|
330
|
+
size: ["size-control-sm", "size-control-default", "size-control-lg"],
|
|
331
|
+
/* `@stndrds/ds`'s `SURFACE_PADDING` rungs (`packages/ds/src/variants/surface.ts`).
|
|
332
|
+
`PopoverContent` bakes in `p-4`; a caller setting `p-surface-sm` on it
|
|
333
|
+
(e.g. `relation-filter-popover.tsx`) needs tailwind-merge to drop the
|
|
334
|
+
built-in `p-4` rather than keep both. All three rungs registered, not
|
|
335
|
+
just the one in use today, so the next call site doesn't rediscover
|
|
336
|
+
this. */
|
|
337
|
+
p: ["p-surface-sm", "p-surface-default", "p-surface-lg"]
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
});
|
|
298
341
|
function cn(...inputs) {
|
|
299
|
-
return
|
|
342
|
+
return twMerge((0, import_clsx.clsx)(inputs));
|
|
300
343
|
}
|
|
301
344
|
|
|
302
345
|
// src/colors.ts
|
|
@@ -1375,13 +1418,6 @@ var RECOMMENDED_MAX_SIZES = {
|
|
|
1375
1418
|
/** Large archives: 1 GB */
|
|
1376
1419
|
ARCHIVE: FILE_SIZE.GB_1
|
|
1377
1420
|
};
|
|
1378
|
-
function formatBytes(bytes, decimals = 2) {
|
|
1379
|
-
if (bytes === 0) return "0 Bytes";
|
|
1380
|
-
const k = 1024;
|
|
1381
|
-
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
|
|
1382
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1383
|
-
return `${Number.parseFloat((bytes / k ** i).toFixed(decimals))} ${sizes[i]}`;
|
|
1384
|
-
}
|
|
1385
1421
|
var mbToBytes = (mb) => {
|
|
1386
1422
|
return mb * 1024 * 1024;
|
|
1387
1423
|
};
|
|
@@ -2824,7 +2860,6 @@ var TEXT_FORMAT_PRESETS = [
|
|
|
2824
2860
|
bytesToGb,
|
|
2825
2861
|
bytesToMb,
|
|
2826
2862
|
cn,
|
|
2827
|
-
formatBytes,
|
|
2828
2863
|
gbToBytes,
|
|
2829
2864
|
getAllColors,
|
|
2830
2865
|
getAllCountries,
|
package/dist/index.mjs
CHANGED
|
@@ -185,7 +185,51 @@ function getDefaultAttributeIcon(type) {
|
|
|
185
185
|
|
|
186
186
|
// src/cn.ts
|
|
187
187
|
import { clsx } from "clsx";
|
|
188
|
-
import {
|
|
188
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
189
|
+
var twMerge = extendTailwindMerge({
|
|
190
|
+
extend: {
|
|
191
|
+
classGroups: {
|
|
192
|
+
/* Every text rung the design system ships, not a subset. The three
|
|
193
|
+
`control` rungs below were registered when this fix was written; the
|
|
194
|
+
six added since — `2xs` and `xs`, the whole `row` family, `metric` —
|
|
195
|
+
were not, so 199 call sites were still silently losing either their
|
|
196
|
+
size or their colour to the merge.
|
|
197
|
+
It fails the way the comment above describes and no louder: the class
|
|
198
|
+
is dropped, the element inherits the 16px root, and nothing warns.
|
|
199
|
+
Measured live on the records grid, the column header rendered at 16px
|
|
200
|
+
for exactly this reason. Any rung added to `theme.css` has to be added
|
|
201
|
+
here in the same change, or it is not really a rung. */
|
|
202
|
+
"font-size": [
|
|
203
|
+
"text-control-2xs",
|
|
204
|
+
"text-control-xs",
|
|
205
|
+
"text-control-sm",
|
|
206
|
+
"text-control-default",
|
|
207
|
+
"text-control-lg",
|
|
208
|
+
"text-row-sm",
|
|
209
|
+
"text-row-default",
|
|
210
|
+
"text-row-lg",
|
|
211
|
+
"text-metric"
|
|
212
|
+
],
|
|
213
|
+
h: [
|
|
214
|
+
"h-control-sm",
|
|
215
|
+
"h-control-default",
|
|
216
|
+
"h-control-lg",
|
|
217
|
+
"h-row-sm",
|
|
218
|
+
"h-row-default",
|
|
219
|
+
"h-row-lg"
|
|
220
|
+
],
|
|
221
|
+
w: ["w-control-sm", "w-control-default", "w-control-lg", "w-query-popover"],
|
|
222
|
+
size: ["size-control-sm", "size-control-default", "size-control-lg"],
|
|
223
|
+
/* `@stndrds/ds`'s `SURFACE_PADDING` rungs (`packages/ds/src/variants/surface.ts`).
|
|
224
|
+
`PopoverContent` bakes in `p-4`; a caller setting `p-surface-sm` on it
|
|
225
|
+
(e.g. `relation-filter-popover.tsx`) needs tailwind-merge to drop the
|
|
226
|
+
built-in `p-4` rather than keep both. All three rungs registered, not
|
|
227
|
+
just the one in use today, so the next call site doesn't rediscover
|
|
228
|
+
this. */
|
|
229
|
+
p: ["p-surface-sm", "p-surface-default", "p-surface-lg"]
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
189
233
|
function cn(...inputs) {
|
|
190
234
|
return twMerge(clsx(inputs));
|
|
191
235
|
}
|
|
@@ -1266,13 +1310,6 @@ var RECOMMENDED_MAX_SIZES = {
|
|
|
1266
1310
|
/** Large archives: 1 GB */
|
|
1267
1311
|
ARCHIVE: FILE_SIZE.GB_1
|
|
1268
1312
|
};
|
|
1269
|
-
function formatBytes(bytes, decimals = 2) {
|
|
1270
|
-
if (bytes === 0) return "0 Bytes";
|
|
1271
|
-
const k = 1024;
|
|
1272
|
-
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
|
|
1273
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1274
|
-
return `${Number.parseFloat((bytes / k ** i).toFixed(decimals))} ${sizes[i]}`;
|
|
1275
|
-
}
|
|
1276
1313
|
var mbToBytes = (mb) => {
|
|
1277
1314
|
return mb * 1024 * 1024;
|
|
1278
1315
|
};
|
|
@@ -2714,7 +2751,6 @@ export {
|
|
|
2714
2751
|
bytesToGb,
|
|
2715
2752
|
bytesToMb,
|
|
2716
2753
|
cn,
|
|
2717
|
-
formatBytes,
|
|
2718
2754
|
gbToBytes,
|
|
2719
2755
|
getAllColors,
|
|
2720
2756
|
getAllCountries,
|