@feugene/granularity 0.20.0 → 0.22.0
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/chunks/{config-BJ7Bv_G2.js → config-BC8d_smz.js} +10 -2
- package/dist/chunks/config-BC8d_smz.js.map +1 -0
- package/dist/chunks/config-BDfTXHo1.js.map +1 -0
- package/dist/chunks/config-BEVBsvni2.js.map +1 -0
- package/dist/chunks/config-BTCOJO5z2.js.map +1 -0
- package/dist/chunks/config-B_qi4Fma.js +92 -0
- package/dist/chunks/config-B_qi4Fma.js.map +1 -0
- package/dist/chunks/{config-gwro_7yn.js → config-Bm_Sovla.js} +6 -2
- package/dist/chunks/config-Bm_Sovla.js.map +1 -0
- package/dist/chunks/{config-BKvX0q10.js → config-C5mO5DYZ.js} +10 -1
- package/dist/chunks/config-C5mO5DYZ.js.map +1 -0
- package/dist/chunks/config-CIcynHGr.js +96 -0
- package/dist/chunks/config-CIcynHGr.js.map +1 -0
- package/dist/chunks/{config-BsuDM3Hb.js → config-CKULiuvc.js} +15 -1
- package/dist/chunks/config-CKULiuvc.js.map +1 -0
- package/dist/chunks/config-COpuWGr_.js.map +1 -0
- package/dist/chunks/config-DBQQT-WP.js +66 -0
- package/dist/chunks/config-DBQQT-WP.js.map +1 -0
- package/dist/chunks/config-DU2DNSRx.js.map +1 -0
- package/dist/chunks/config-QJ54_fcM.js +61 -0
- package/dist/chunks/config-QJ54_fcM.js.map +1 -0
- package/dist/chunks/config-ScuvHw6k.js.map +1 -0
- package/dist/chunks/config-eXB87DOi.js.map +1 -0
- package/dist/chunks/config-jyZq8XKL.js +58 -0
- package/dist/chunks/config-jyZq8XKL.js.map +1 -0
- package/dist/chunks/copy-DChChcq-.js +29 -0
- package/dist/chunks/copy-DChChcq-.js.map +1 -0
- package/dist/chunks/{en-COdzxgAX.js → en-DCCFP4qu.js} +18 -2
- package/dist/chunks/{en-COdzxgAX.js.map → en-DCCFP4qu.js.map} +1 -1
- package/dist/chunks/{es-ClqJ-4hr.js → es-CT34HBVM.js} +18 -2
- package/dist/chunks/{es-ClqJ-4hr.js.map → es-CT34HBVM.js.map} +1 -1
- package/dist/chunks/{es-DGMHwknJ.js → es-DdJsxlUr.js} +3 -3
- package/dist/chunks/{es-DGMHwknJ.js.map → es-DdJsxlUr.js.map} +1 -1
- package/dist/chunks/{generated-BRkbhyxk.js → generated-CiCrGDQO.js} +147 -0
- package/dist/chunks/{generated-BRkbhyxk.js.map → generated-CiCrGDQO.js.map} +1 -1
- package/dist/chunks/{granular-provider-CZYm70Pm.js → granular-provider-CYroWMjO.js} +21 -11
- package/dist/chunks/granular-provider-CYroWMjO.js.map +1 -0
- package/dist/chunks/{ru-9z8ix45c.js → ru-CLiAMwrx.js} +18 -2
- package/dist/chunks/{ru-9z8ix45c.js.map → ru-CLiAMwrx.js.map} +1 -1
- package/dist/chunks/trending-up-Bf9AQmoq.js +42 -0
- package/dist/chunks/trending-up-Bf9AQmoq.js.map +1 -0
- package/dist/components/GrCard/chunks/GrCard-Bc7nRfbe.js +144 -0
- package/dist/components/GrCard/chunks/GrCard-Bc7nRfbe.js.map +1 -0
- package/dist/components/GrCard/index.js +2 -2
- package/dist/components/GrCodeBlock/chunks/GrCodeBlock-BmXCLgLS.js +315 -0
- package/dist/components/GrCodeBlock/chunks/GrCodeBlock-BmXCLgLS.js.map +1 -0
- package/dist/components/GrCodeBlock/index.js +3 -0
- package/dist/components/GrCodeBlock/styles.css +1 -0
- package/dist/components/GrCollapse/chunks/{GrCollapse-KFcrji1L.js → GrCollapse-C1rCfbc0.js} +2 -2
- package/dist/components/GrCollapse/chunks/{GrCollapse-KFcrji1L.js.map → GrCollapse-C1rCfbc0.js.map} +1 -1
- package/dist/components/GrCollapse/index.js +2 -2
- package/dist/components/GrDataTable/chunks/{GrDataTable-CNvZg2HZ.js → GrDataTable-B5MmZFUg.js} +67 -5
- package/dist/components/GrDataTable/chunks/GrDataTable-B5MmZFUg.js.map +1 -0
- package/dist/components/GrDataTable/index.js +2 -2
- package/dist/components/GrDelta/chunks/GrDelta-BMmpYz8K.js +0 -0
- package/dist/components/GrDelta/chunks/GrDelta-BMmpYz8K.js.map +1 -0
- package/dist/components/GrDelta/index.js +3 -0
- package/dist/components/GrDescriptionList/chunks/GrDescriptionList-pXh1LZEe.js +103 -0
- package/dist/components/GrDescriptionList/chunks/GrDescriptionList-pXh1LZEe.js.map +1 -0
- package/dist/components/GrDescriptionList/index.js +3 -0
- package/dist/components/GrDropdownMenu/chunks/{GrDropdownMenu-LOaFSCyd.js → GrDropdownMenu-DyS6dWDp.js} +2 -2
- package/dist/components/GrDropdownMenu/chunks/{GrDropdownMenu-LOaFSCyd.js.map → GrDropdownMenu-DyS6dWDp.js.map} +1 -1
- package/dist/components/GrDropdownMenu/index.js +2 -2
- package/dist/components/GrFilePreview/chunks/GrFilePreview-rbE3zL9w.js +315 -0
- package/dist/components/GrFilePreview/chunks/GrFilePreview-rbE3zL9w.js.map +1 -0
- package/dist/components/GrFilePreview/index.js +3 -0
- package/dist/components/GrForm/chunks/{GrForm-DdJw23Pz.js → GrForm-B_Qq_13k.js} +14 -7
- package/dist/components/GrForm/chunks/GrForm-B_Qq_13k.js.map +1 -0
- package/dist/components/GrForm/index.js +1 -1
- package/dist/components/GrImageViewer/chunks/{GrImageViewer-CMO10TS7.js.map → GrImageViewer-ng7el4wn.js.map} +1 -1
- package/dist/components/GrImageViewer/index.js +1 -1
- package/dist/components/GrInputTag/chunks/{GrInputTag-Dghhg03-.js.map → GrInputTag-C7QVPijj.js.map} +1 -1
- package/dist/components/GrInputTag/index.js +1 -1
- package/dist/components/GrJsonViewer/chunks/GrJsonViewer-DFUppRNb.js +389 -0
- package/dist/components/GrJsonViewer/chunks/GrJsonViewer-DFUppRNb.js.map +1 -0
- package/dist/components/GrJsonViewer/index.js +3 -0
- package/dist/components/GrList/chunks/{GrList-CHibO0xA.js → GrList-BRYhpqIe.js} +4 -4
- package/dist/components/GrList/chunks/GrList-BRYhpqIe.js.map +1 -0
- package/dist/components/GrList/index.js +2 -2
- package/dist/components/GrList/styles.css +1 -1
- package/dist/components/GrRadio/index.js +1 -1
- package/dist/components/GrSegmented/chunks/{GrSegmented-DP9WMAbm.js → GrSegmented-D1mjxF_O.js} +1 -1
- package/dist/components/GrSegmented/chunks/GrSegmented-D1mjxF_O.js.map +1 -0
- package/dist/components/GrSegmented/index.js +2 -2
- package/dist/components/GrSidebar/chunks/{GrSidebar-DG_t4aPE.js → GrSidebar-D7WxRtIu.js} +7 -1
- package/dist/components/GrSidebar/chunks/{GrSidebar-DG_t4aPE.js.map → GrSidebar-D7WxRtIu.js.map} +1 -1
- package/dist/components/GrSidebar/index.js +1 -1
- package/dist/components/GrSortableList/chunks/{GrSortableList-DJFPdUVv.js → GrSortableList-DPjxilmN.js} +1 -1
- package/dist/components/GrSortableList/chunks/{GrSortableList-DJFPdUVv.js.map → GrSortableList-DPjxilmN.js.map} +1 -1
- package/dist/components/GrSortableList/index.js +1 -1
- package/dist/components/GrStatistic/chunks/{GrStatistic-C3VpykHo.js → GrStatistic-DkzWUAw1.js} +8 -41
- package/dist/components/GrStatistic/chunks/GrStatistic-DkzWUAw1.js.map +1 -0
- package/dist/components/GrStatistic/index.js +1 -1
- package/dist/components/GrTabPanels/index.js +1 -1
- package/dist/components/GrTextarea/index.js +1 -1
- package/dist/components/GrTimeline/chunks/{GrTimeline-DlTraRn5.js → GrTimeline-Ch9sHzwL.js} +1 -1
- package/dist/components/GrTimeline/chunks/GrTimeline-Ch9sHzwL.js.map +1 -0
- package/dist/components/GrTimeline/index.js +2 -2
- package/dist/components/GrTimeline/styles.css +1 -1
- package/dist/components/GrToaster/chunks/{GrToaster-Db2NgrXu.js → GrToaster-DJUzx3sR.js} +1 -1
- package/dist/components/GrToaster/chunks/{GrToaster-Db2NgrXu.js.map → GrToaster-DJUzx3sR.js.map} +1 -1
- package/dist/components/GrToaster/index.js +2 -2
- package/dist/composables/useToast.js +14 -2
- package/dist/composables/useToast.js.map +1 -1
- package/dist/granular-provider-node.js +1 -1
- package/dist/granular-provider.js +1 -1
- package/dist/i18n/all.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.js +38 -28
- package/dist/theme.js +1 -1
- package/dist/tokens.js +1 -1
- package/dist/types/components/GrButton/GrButton.vue.d.ts +1 -1
- package/dist/types/components/GrCard/GrCard.vue.d.ts +25 -6
- package/dist/types/components/GrCard/defaults.d.ts +2 -1
- package/dist/types/components/GrCard/grCardStyles.d.ts +8 -0
- package/dist/types/components/GrCard/index.d.ts +1 -1
- package/dist/types/components/GrCodeBlock/GrCodeBlock.vue.d.ts +79 -0
- package/dist/types/components/GrCodeBlock/config.d.ts +1 -0
- package/dist/types/components/GrCodeBlock/defaults.d.ts +21 -0
- package/dist/types/components/GrCodeBlock/grCodeBlockStyles.d.ts +53 -0
- package/dist/types/components/GrCodeBlock/index.d.ts +6 -0
- package/dist/types/components/GrCodeBlock/safelist.d.ts +1 -0
- package/dist/types/components/GrCodeBlock/serializeCode.d.ts +19 -0
- package/dist/types/components/GrCodeBlock/tokenizeJson.d.ts +24 -0
- package/dist/types/components/GrCollapse/GrCollapse.vue.d.ts +2 -2
- package/dist/types/components/GrCommandPalette/GrCommandPalette.vue.d.ts +2 -2
- package/dist/types/components/GrDataTable/GrDataTable.vue.d.ts +38 -1
- package/dist/types/components/GrDataTable/grDataTableStyles.d.ts +7 -0
- package/dist/types/components/GrDataTable/index.d.ts +1 -1
- package/dist/types/components/GrDelta/GrDelta.vue.d.ts +84 -0
- package/dist/types/components/GrDelta/config.d.ts +1 -0
- package/dist/types/components/GrDelta/defaults.d.ts +22 -0
- package/dist/types/components/GrDelta/deltaTone.d.ts +24 -0
- package/dist/types/components/GrDelta/grDeltaStyles.d.ts +38 -0
- package/dist/types/components/GrDelta/index.d.ts +6 -0
- package/dist/types/components/GrDelta/safelist.d.ts +1 -0
- package/dist/types/components/GrDescriptionList/GrDescriptionList.vue.d.ts +107 -0
- package/dist/types/components/GrDescriptionList/config.d.ts +1 -0
- package/dist/types/components/GrDescriptionList/defaults.d.ts +21 -0
- package/dist/types/components/GrDescriptionList/grDescriptionListStyles.d.ts +25 -0
- package/dist/types/components/GrDescriptionList/index.d.ts +6 -0
- package/dist/types/components/GrDescriptionList/safelist.d.ts +1 -0
- package/dist/types/components/GrDropdownMenu/GrDropdownMenu.vue.d.ts +1 -1
- package/dist/types/components/GrDropdownMenu/grDropdownMenuStyles.d.ts +10 -1
- package/dist/types/components/GrFilePreview/GrFilePreview.vue.d.ts +100 -0
- package/dist/types/components/GrFilePreview/config.d.ts +1 -0
- package/dist/types/components/GrFilePreview/defaults.d.ts +20 -0
- package/dist/types/components/GrFilePreview/fileKindOf.d.ts +14 -0
- package/dist/types/components/GrFilePreview/grFilePreviewStyles.d.ts +37 -0
- package/dist/types/components/GrFilePreview/index.d.ts +6 -0
- package/dist/types/components/GrFilePreview/safelist.d.ts +1 -0
- package/dist/types/components/GrForm/GrForm.vue.d.ts +47 -86
- package/dist/types/components/GrFormField/GrFormField.vue.d.ts +2 -2
- package/dist/types/components/GrImageViewer/GrImageViewer.vue.d.ts +1 -1
- package/dist/types/components/GrInput/GrInput.vue.d.ts +1 -1
- package/dist/types/components/GrInputTag/GrInputTag.vue.d.ts +1 -1
- package/dist/types/components/GrJsonViewer/GrJsonViewer.vue.d.ts +129 -0
- package/dist/types/components/GrJsonViewer/config.d.ts +1 -0
- package/dist/types/components/GrJsonViewer/defaults.d.ts +23 -0
- package/dist/types/components/GrJsonViewer/grJsonViewerStyles.d.ts +57 -0
- package/dist/types/components/GrJsonViewer/index.d.ts +9 -0
- package/dist/types/components/GrJsonViewer/jsonToNodes.d.ts +47 -0
- package/dist/types/components/GrJsonViewer/safelist.d.ts +1 -0
- package/dist/types/components/GrList/grListStyles.d.ts +13 -0
- package/dist/types/components/GrNumberInput/GrNumberInput.vue.d.ts +1 -1
- package/dist/types/components/GrRating/GrRating.vue.d.ts +1 -1
- package/dist/types/components/GrSegmented/GrSegmented.vue.d.ts +1 -1
- package/dist/types/components/GrStatistic/GrStatistic.vue.d.ts +2 -2
- package/dist/types/components/GrSwitch/GrSwitch.vue.d.ts +1 -1
- package/dist/types/components/GrTable/GrTable.vue.d.ts +2 -2
- package/dist/types/components/GrTabs/GrTabs.vue.d.ts +1 -1
- package/dist/types/components/GrTimeline/GrTimelineItem.vue.d.ts +3 -3
- package/dist/types/components/shared/sizes.d.ts +5 -1
- package/dist/types/composables/useToast.d.ts +11 -0
- package/dist/types/granular-provider/shared.d.ts +5 -0
- package/dist/types/i18n/messages/en.d.ts +28 -0
- package/dist/types/i18n/messages/es.d.ts +28 -0
- package/dist/types/i18n/messages/ru.d.ts +28 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/web-types.json +661 -124
- package/package.json +22 -1
- package/dist/chunks/config-BDfTXHo12.js.map +0 -1
- package/dist/chunks/config-BEVBsvni.js.map +0 -1
- package/dist/chunks/config-BJ7Bv_G2.js.map +0 -1
- package/dist/chunks/config-BKvX0q10.js.map +0 -1
- package/dist/chunks/config-BTCOJO5z.js.map +0 -1
- package/dist/chunks/config-BsuDM3Hb.js.map +0 -1
- package/dist/chunks/config-COpuWGr_2.js.map +0 -1
- package/dist/chunks/config-DU2DNSRx2.js.map +0 -1
- package/dist/chunks/config-ScuvHw6k2.js.map +0 -1
- package/dist/chunks/config-eXB87DOi2.js.map +0 -1
- package/dist/chunks/config-gwro_7yn.js.map +0 -1
- package/dist/chunks/granular-provider-CZYm70Pm.js.map +0 -1
- package/dist/components/GrCard/chunks/GrCard-DfIZOP5N.js +0 -89
- package/dist/components/GrCard/chunks/GrCard-DfIZOP5N.js.map +0 -1
- package/dist/components/GrDataTable/chunks/GrDataTable-CNvZg2HZ.js.map +0 -1
- package/dist/components/GrForm/chunks/GrForm-DdJw23Pz.js.map +0 -1
- package/dist/components/GrList/chunks/GrList-CHibO0xA.js.map +0 -1
- package/dist/components/GrSegmented/chunks/GrSegmented-DP9WMAbm.js.map +0 -1
- package/dist/components/GrStatistic/chunks/GrStatistic-C3VpykHo.js.map +0 -1
- package/dist/components/GrTimeline/chunks/GrTimeline-DlTraRn5.js.map +0 -1
- package/dist/chunks/{config-BDfTXHo12.js → config-BDfTXHo1.js} +0 -0
- package/dist/chunks/{config-BEVBsvni.js → config-BEVBsvni2.js} +0 -0
- package/dist/chunks/{config-BTCOJO5z.js → config-BTCOJO5z2.js} +0 -0
- package/dist/chunks/{config-COpuWGr_2.js → config-COpuWGr_.js} +0 -0
- package/dist/chunks/{config-DU2DNSRx2.js → config-DU2DNSRx.js} +0 -0
- package/dist/chunks/{config-ScuvHw6k2.js → config-ScuvHw6k.js} +0 -0
- package/dist/chunks/{config-eXB87DOi2.js → config-eXB87DOi.js} +0 -0
- package/dist/components/GrImageViewer/chunks/{GrImageViewer-CMO10TS7.js → GrImageViewer-ng7el4wn.js} +1 -1
- package/dist/components/GrInputTag/chunks/{GrInputTag-Dghhg03-.js → GrInputTag-C7QVPijj.js} +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { GrComponentSize } from '../shared/sizes';
|
|
2
|
+
/**
|
|
3
|
+
* Классы `GrFilePreview`.
|
|
4
|
+
*
|
|
5
|
+
* Ступени размера перечислены целиком, по литералу на ветку: UnoCSS сканирует
|
|
6
|
+
* исходный текст файла, и собранное шаблонной строкой имя уехало бы в CSS
|
|
7
|
+
* литералом.
|
|
8
|
+
*/
|
|
9
|
+
/** Соотношение сторон плитки. */
|
|
10
|
+
export type GrFilePreviewRatio = '1:1' | '4:3' | '16:9';
|
|
11
|
+
/** `relative` — точка отсчёта для картинки, ждущей загрузки вне потока. */
|
|
12
|
+
export declare const filePreviewRootClass = "relative inline-flex overflow-hidden rounded-[var(--gr-file-preview-radius,var(--gr-radius-md))] bg-[var(--gr-file-preview-bg,var(--gr-muted))]";
|
|
13
|
+
/** Интерактивная плитка получает курсор и кольцо фокуса — как любой контрол. */
|
|
14
|
+
export declare const filePreviewInteractiveClass = "cursor-pointer transition-colors duration-[var(--gr-duration-fast)] hover:bg-[var(--gr-secondary)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--gr-ring)]";
|
|
15
|
+
/**
|
|
16
|
+
* Ширина плитки по канонической шкале: высоту задаёт соотношение сторон.
|
|
17
|
+
* Своего кортежа размеров компонент не заводит — иначе `GrConfigProvider`
|
|
18
|
+
* перестал бы до него доставать (гейт `sizeScale.test.ts`).
|
|
19
|
+
*/
|
|
20
|
+
export declare const filePreviewTileWidths: Record<GrComponentSize, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Соотношение сторон держит место до загрузки: без него ряд плиток прыгает,
|
|
23
|
+
* когда картинки доезжают вразнобой.
|
|
24
|
+
*/
|
|
25
|
+
export declare const filePreviewRatioClass: Record<GrFilePreviewRatio, string>;
|
|
26
|
+
export declare const filePreviewMediaClass = "h-full w-full object-cover";
|
|
27
|
+
/**
|
|
28
|
+
* Картинка на время загрузки: `visibility`, а не `display`, — иначе браузер
|
|
29
|
+
* отменил бы саму загрузку. Вне потока, чтобы скелет занял плитку целиком, а
|
|
30
|
+
* не поделил её с картинкой как второй flex-элемент.
|
|
31
|
+
*/
|
|
32
|
+
export declare const filePreviewMediaLoadingClass = "invisible absolute";
|
|
33
|
+
/** Заглушка: иконка по центру, подпись под ней. */
|
|
34
|
+
export declare const filePreviewFallbackClass = "h-full w-full flex flex-col items-center justify-center gap-1 p-1 text-center text-[var(--gr-file-preview-icon,var(--gr-muted-fg))]";
|
|
35
|
+
export declare const filePreviewIconClass = "block h-6 w-6 shrink-0";
|
|
36
|
+
/** Подпись под иконкой: имя файла в одну строку. */
|
|
37
|
+
export declare const filePreviewLabelClass = "w-full truncate text-[length:var(--gr-control-text-3xs)] leading-[var(--gr-leading-xs)]";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default } from './GrFilePreview.vue';
|
|
2
|
+
export { default as GrFilePreview } from './GrFilePreview.vue';
|
|
3
|
+
export { grFilePreviewConfig } from './config';
|
|
4
|
+
export type { GrFileKind, GrFilePreviewEmits, GrFilePreviewProps, GrFilePreviewRatio, } from './GrFilePreview.vue';
|
|
5
|
+
export type { GrFilePreviewConfigurableProps } from './defaults';
|
|
6
|
+
export { grFilePreviewSafelist } from './safelist';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const grFilePreviewSafelist: string[];
|
|
@@ -9,9 +9,17 @@ export type { GrFormFileRule, GrFormRule, GrFormRules, GrFormTrigger, GrFormVali
|
|
|
9
9
|
* template ref (`validate` / `validateField` / `clearValidate` / `resetFields` /
|
|
10
10
|
* `scrollToField`).
|
|
11
11
|
*/
|
|
12
|
-
export interface GrFormProps {
|
|
13
|
-
/**
|
|
14
|
-
|
|
12
|
+
export interface GrFormProps<TModel extends object = Record<string, unknown>> {
|
|
13
|
+
/**
|
|
14
|
+
* Реактивный объект данных формы. Поля адресуются по `name` (`GrFormField`),
|
|
15
|
+
* в т.ч. dot-path.
|
|
16
|
+
*
|
|
17
|
+
* Тип дженерик, а не `Record<string, unknown>`: моделью бывает объект чужой
|
|
18
|
+
* библиотеки (`useForm` Inertia, стор), у которого рядом с полями лежат
|
|
19
|
+
* собственные методы. Под словарь он не подходит, и потребителю пришлось бы
|
|
20
|
+
* приводить его через `as unknown as` в каждой форме.
|
|
21
|
+
*/
|
|
22
|
+
model: TModel;
|
|
15
23
|
/** Правила валидации по имени поля: `{ email: [{ required: true, type: 'email' }] }`. */
|
|
16
24
|
rules?: GrFormRules;
|
|
17
25
|
/** Валидировать поле при потере фокуса. */
|
|
@@ -27,9 +35,9 @@ export interface GrFormProps {
|
|
|
27
35
|
*/
|
|
28
36
|
disabled?: boolean;
|
|
29
37
|
}
|
|
30
|
-
export interface GrFormEmits {
|
|
38
|
+
export interface GrFormEmits<TModel extends object = Record<string, unknown>> {
|
|
31
39
|
/** Форма прошла валидацию по submit. Отдаёт `model`. */
|
|
32
|
-
(e: 'submit', model:
|
|
40
|
+
(e: 'submit', model: TModel): void;
|
|
33
41
|
/** Результат валидации одного поля. */
|
|
34
42
|
(e: 'validate', name: string, valid: boolean, message: string | undefined): void;
|
|
35
43
|
/**
|
|
@@ -38,90 +46,43 @@ export interface GrFormEmits {
|
|
|
38
46
|
*/
|
|
39
47
|
(e: 'invalid', errors: Record<string, string>): void;
|
|
40
48
|
}
|
|
41
|
-
declare
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
declare const __VLS_export: <TModel extends object = Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
50
|
+
props: import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & __VLS_PrettifyLocal<GrFormProps<TModel> & {
|
|
51
|
+
onSubmit?: ((model: TModel) => any) | undefined;
|
|
52
|
+
onInvalid?: ((errors: Record<string, string>) => any) | undefined;
|
|
53
|
+
onValidate?: ((name: string, valid: boolean, message: string | undefined) => any) | undefined;
|
|
54
|
+
}> & (typeof globalThis extends {
|
|
55
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
56
|
+
} ? P : {});
|
|
57
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
58
|
+
validate: () => Promise<boolean>;
|
|
59
|
+
validateField: (name: string, trigger?: GrFormTrigger) => Promise<boolean>;
|
|
60
|
+
clearValidate: (names?: string | string[]) => void;
|
|
61
|
+
resetFields: (names?: string | string[]) => void;
|
|
62
|
+
scrollToField: (name: string) => void;
|
|
63
|
+
setSnapshot: (model?: Record<string, unknown>) => void;
|
|
64
|
+
isDirty: import("vue").ComputedRef<boolean>;
|
|
65
|
+
isValid: import("vue").ComputedRef<boolean>;
|
|
66
|
+
validatingFields: import("vue").ComputedRef<Set<string> & Omit<Set<string>, keyof Set<any>>>;
|
|
67
|
+
}>) => void;
|
|
68
|
+
attrs: any;
|
|
69
|
+
slots: {
|
|
70
|
+
default?: (props: {
|
|
71
|
+
validate: () => Promise<boolean>;
|
|
72
|
+
errors: Record<string, string | undefined>;
|
|
73
|
+
isDirty: boolean;
|
|
74
|
+
isValid: boolean;
|
|
75
|
+
validatingFields: Set<string> & Omit<Set<string>, keyof Set<any>>;
|
|
76
|
+
resetFields: (names?: string | string[]) => void;
|
|
77
|
+
setSnapshot: (model?: Record<string, unknown>) => void;
|
|
78
|
+
}) => any;
|
|
79
|
+
};
|
|
80
|
+
emit: GrFormEmits<TModel>;
|
|
81
|
+
}>) => import("vue").VNode & {
|
|
82
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
63
83
|
};
|
|
64
|
-
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<GrFormProps>, {
|
|
65
|
-
rules: undefined;
|
|
66
|
-
validateOnBlur: boolean;
|
|
67
|
-
validateOnChange: boolean;
|
|
68
|
-
scrollToError: boolean;
|
|
69
|
-
scrollBehavior: string;
|
|
70
|
-
disabled: boolean;
|
|
71
|
-
}>>, {
|
|
72
|
-
validate: typeof validate;
|
|
73
|
-
validateField: typeof validateField;
|
|
74
|
-
clearValidate: typeof clearValidate;
|
|
75
|
-
resetFields: typeof resetFields;
|
|
76
|
-
scrollToField: typeof scrollToField;
|
|
77
|
-
setSnapshot: typeof setSnapshot;
|
|
78
|
-
isDirty: import("vue").ComputedRef<boolean>;
|
|
79
|
-
isValid: import("vue").ComputedRef<boolean>;
|
|
80
|
-
validatingFields: import("vue").ComputedRef<Set<string> & Omit<Set<string>, keyof Set<any>>>;
|
|
81
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
82
|
-
submit: (model: Record<string, unknown>) => void;
|
|
83
|
-
validate: (name: string, valid: boolean, message: string | undefined) => void;
|
|
84
|
-
invalid: (errors: Record<string, string>) => void;
|
|
85
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<GrFormProps>, {
|
|
86
|
-
rules: undefined;
|
|
87
|
-
validateOnBlur: boolean;
|
|
88
|
-
validateOnChange: boolean;
|
|
89
|
-
scrollToError: boolean;
|
|
90
|
-
scrollBehavior: string;
|
|
91
|
-
disabled: boolean;
|
|
92
|
-
}>>> & Readonly<{
|
|
93
|
-
onSubmit?: ((model: Record<string, unknown>) => any) | undefined;
|
|
94
|
-
onInvalid?: ((errors: Record<string, string>) => any) | undefined;
|
|
95
|
-
onValidate?: ((name: string, valid: boolean, message: string | undefined) => any) | undefined;
|
|
96
|
-
}>, {
|
|
97
|
-
scrollBehavior: ScrollBehavior;
|
|
98
|
-
disabled: boolean;
|
|
99
|
-
rules: GrFormRules;
|
|
100
|
-
validateOnBlur: boolean;
|
|
101
|
-
validateOnChange: boolean;
|
|
102
|
-
scrollToError: boolean;
|
|
103
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
104
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
105
84
|
declare const _default: typeof __VLS_export;
|
|
106
85
|
export default _default;
|
|
107
|
-
type __VLS_TypePropsToOption<T> = {
|
|
108
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
109
|
-
type: import('vue').PropType<Required<T>[K]>;
|
|
110
|
-
} : {
|
|
111
|
-
type: import('vue').PropType<T[K]>;
|
|
112
|
-
required: true;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
type __VLS_WithDefaults<P, D> = {
|
|
116
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
117
|
-
default: D[K];
|
|
118
|
-
}> : P[K];
|
|
119
|
-
};
|
|
120
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
121
|
-
new (): {
|
|
122
|
-
$slots: S;
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
86
|
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
126
87
|
[K in keyof T]: T[K];
|
|
127
88
|
} : {
|
|
@@ -81,6 +81,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
81
81
|
labelClass: undefined;
|
|
82
82
|
}>>> & Readonly<{}>, {
|
|
83
83
|
size: GrFormFieldSize;
|
|
84
|
+
labelWidth: string | number;
|
|
84
85
|
labelPosition: GrFormFieldLabelPosition;
|
|
85
86
|
readonly: boolean;
|
|
86
87
|
label: string;
|
|
@@ -88,11 +89,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
88
89
|
error: string | string[];
|
|
89
90
|
disabled: boolean;
|
|
90
91
|
required: boolean;
|
|
92
|
+
labelClass: LabelClass;
|
|
91
93
|
forId: string;
|
|
92
94
|
hint: string;
|
|
93
95
|
showMessage: boolean;
|
|
94
|
-
labelWidth: string | number;
|
|
95
|
-
labelClass: LabelClass;
|
|
96
96
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
97
97
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
98
98
|
declare const _default: typeof __VLS_export;
|
|
@@ -218,9 +218,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
218
218
|
index: number;
|
|
219
219
|
}) => any) | undefined;
|
|
220
220
|
}>, {
|
|
221
|
+
emptyText: string;
|
|
221
222
|
zIndexVar: string;
|
|
222
223
|
ariaLabel: string;
|
|
223
|
-
emptyText: string;
|
|
224
224
|
closeLabel: string;
|
|
225
225
|
showProgress: boolean;
|
|
226
226
|
initialIndex: number;
|
|
@@ -152,12 +152,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
152
152
|
}>, {
|
|
153
153
|
size: GrInputSize;
|
|
154
154
|
clearable: boolean;
|
|
155
|
+
loading: boolean;
|
|
155
156
|
readonly: boolean;
|
|
156
157
|
type: "text" | "email" | "password" | "number" | "search" | "tel" | "url";
|
|
157
158
|
name: string;
|
|
158
159
|
invalid: boolean;
|
|
159
160
|
id: string;
|
|
160
|
-
loading: boolean;
|
|
161
161
|
textAlign: GrInputTextAlign;
|
|
162
162
|
disabled: boolean;
|
|
163
163
|
required: boolean;
|
|
@@ -164,12 +164,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
164
164
|
}>, {
|
|
165
165
|
size: GrInputTagSize;
|
|
166
166
|
clearable: boolean;
|
|
167
|
+
loading: boolean;
|
|
167
168
|
trim: boolean;
|
|
168
169
|
readonly: boolean;
|
|
169
170
|
name: string;
|
|
170
171
|
invalid: boolean;
|
|
171
172
|
max: number;
|
|
172
|
-
loading: boolean;
|
|
173
173
|
disabled: boolean;
|
|
174
174
|
tagTone: GrBadgeTone;
|
|
175
175
|
tagDark: boolean;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { type GrJsonNode } from './jsonToNodes';
|
|
2
|
+
import type { GrComponentSize } from '../shared/sizes';
|
|
3
|
+
export type { GrJsonNode, GrJsonNodeKind } from './jsonToNodes';
|
|
4
|
+
/**
|
|
5
|
+
* JSON со свёрткой по узлам, поиском по ключу и значению и копированием узла.
|
|
6
|
+
*
|
|
7
|
+
* Дерево, клавиатуру и виртуализацию несёт `GrTree`; здесь — разбор `unknown` в
|
|
8
|
+
* узлы и разметка строки. Плоский текст целиком, который копируют в тикет, —
|
|
9
|
+
* `GrCodeBlock`.
|
|
10
|
+
*/
|
|
11
|
+
export interface GrJsonViewerProps {
|
|
12
|
+
/** Показываемое значение. `unknown`, потому что приходит из БД или чужого сервиса. */
|
|
13
|
+
value: unknown;
|
|
14
|
+
/** Подпись корня. По умолчанию `$` — так адресуют путь JSONPath и dev-tools. */
|
|
15
|
+
rootLabel?: string;
|
|
16
|
+
/** Сколько уровней раскрыто изначально. */
|
|
17
|
+
defaultExpandDepth?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Длина строкового значения, после которой показ обрезается.
|
|
20
|
+
*
|
|
21
|
+
* Не косметика: запрос к модели с картинкой в base64 — это один лист на
|
|
22
|
+
* сотни тысяч символов, и ни свёртка, ни виртуализация по строкам его не
|
|
23
|
+
* берут. Копирование при этом отдаёт значение целиком.
|
|
24
|
+
*/
|
|
25
|
+
maxStringLength?: number;
|
|
26
|
+
/** Сколько элементов массива разбирать до заглушки «ещё N». */
|
|
27
|
+
maxArrayItems?: number;
|
|
28
|
+
/** Поле поиска над деревом. Выключено — поиск остаётся на `filter()` из `defineExpose`. */
|
|
29
|
+
searchable?: boolean;
|
|
30
|
+
/** Кнопка копирования узла в строке. */
|
|
31
|
+
copyable?: boolean;
|
|
32
|
+
/** Оставлять в DOM только окно вокруг вьюпорта. Требует `maxHeight`. */
|
|
33
|
+
virtual?: boolean;
|
|
34
|
+
/** Высота области просмотра: число — пиксели, строка — как есть. */
|
|
35
|
+
maxHeight?: string | number;
|
|
36
|
+
/** Имя области для скринридера. Безымянное дерево объявляется просто «дерево». */
|
|
37
|
+
ariaLabel?: string;
|
|
38
|
+
size?: GrComponentSize;
|
|
39
|
+
}
|
|
40
|
+
export interface GrJsonViewerEmits {
|
|
41
|
+
/** Узел скопирован: путь для тикета и полное значение. */
|
|
42
|
+
(e: 'copy', payload: {
|
|
43
|
+
path: string;
|
|
44
|
+
value: unknown;
|
|
45
|
+
}): void;
|
|
46
|
+
}
|
|
47
|
+
type __VLS_Slots = {
|
|
48
|
+
/** Значение листа: ссылка, дата, денежная сумма — оформление знает приложение. */
|
|
49
|
+
leaf?: (props: {
|
|
50
|
+
node: GrJsonNode;
|
|
51
|
+
}) => unknown;
|
|
52
|
+
};
|
|
53
|
+
declare function expandAll(): void;
|
|
54
|
+
declare function collapseAll(): void;
|
|
55
|
+
declare function filter(value: string): void;
|
|
56
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<GrJsonViewerProps>, {
|
|
57
|
+
rootLabel: undefined;
|
|
58
|
+
defaultExpandDepth: undefined;
|
|
59
|
+
maxStringLength: undefined;
|
|
60
|
+
maxArrayItems: undefined;
|
|
61
|
+
searchable: undefined;
|
|
62
|
+
copyable: undefined;
|
|
63
|
+
virtual: boolean;
|
|
64
|
+
maxHeight: undefined;
|
|
65
|
+
ariaLabel: undefined;
|
|
66
|
+
size: undefined;
|
|
67
|
+
}>>, {
|
|
68
|
+
filter: typeof filter;
|
|
69
|
+
expandAll: typeof expandAll;
|
|
70
|
+
collapseAll: typeof collapseAll;
|
|
71
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
72
|
+
copy: (payload: {
|
|
73
|
+
path: string;
|
|
74
|
+
value: unknown;
|
|
75
|
+
}) => void;
|
|
76
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<GrJsonViewerProps>, {
|
|
77
|
+
rootLabel: undefined;
|
|
78
|
+
defaultExpandDepth: undefined;
|
|
79
|
+
maxStringLength: undefined;
|
|
80
|
+
maxArrayItems: undefined;
|
|
81
|
+
searchable: undefined;
|
|
82
|
+
copyable: undefined;
|
|
83
|
+
virtual: boolean;
|
|
84
|
+
maxHeight: undefined;
|
|
85
|
+
ariaLabel: undefined;
|
|
86
|
+
size: undefined;
|
|
87
|
+
}>>> & Readonly<{
|
|
88
|
+
onCopy?: ((payload: {
|
|
89
|
+
path: string;
|
|
90
|
+
value: unknown;
|
|
91
|
+
}) => any) | undefined;
|
|
92
|
+
}>, {
|
|
93
|
+
size: GrComponentSize;
|
|
94
|
+
copyable: boolean;
|
|
95
|
+
defaultExpandDepth: number;
|
|
96
|
+
maxStringLength: number;
|
|
97
|
+
maxArrayItems: number;
|
|
98
|
+
searchable: boolean;
|
|
99
|
+
maxHeight: string | number;
|
|
100
|
+
ariaLabel: string;
|
|
101
|
+
virtual: boolean;
|
|
102
|
+
rootLabel: string;
|
|
103
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
104
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
105
|
+
declare const _default: typeof __VLS_export;
|
|
106
|
+
export default _default;
|
|
107
|
+
type __VLS_TypePropsToOption<T> = {
|
|
108
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
109
|
+
type: import('vue').PropType<Required<T>[K]>;
|
|
110
|
+
} : {
|
|
111
|
+
type: import('vue').PropType<T[K]>;
|
|
112
|
+
required: true;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
type __VLS_WithDefaults<P, D> = {
|
|
116
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
117
|
+
default: D[K];
|
|
118
|
+
}> : P[K];
|
|
119
|
+
};
|
|
120
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
121
|
+
new (): {
|
|
122
|
+
$slots: S;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
126
|
+
[K in keyof T]: T[K];
|
|
127
|
+
} : {
|
|
128
|
+
[K in keyof T as K]: T[K];
|
|
129
|
+
}) & {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const grJsonViewerConfig: import("@feugene/unocss-preset-granular/contract").GranularComponentDescriptor<"GrJsonViewer">;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GrComponentSize } from '../shared/sizes';
|
|
2
|
+
/**
|
|
3
|
+
* Пропы `GrJsonViewer`, настраиваемые глобально через
|
|
4
|
+
* `<GrConfigProvider :component-defaults="{ GrJsonViewer: { … } }">`.
|
|
5
|
+
*
|
|
6
|
+
* Пороги обрезки здесь наравне с оформлением не случайно: «сколько показывать»
|
|
7
|
+
* — решение приложения, а не экрана. У админки с ответами модели и у панели с
|
|
8
|
+
* конфигами оно разное, и повторять его на каждом просмотрщике значит однажды
|
|
9
|
+
* забыть.
|
|
10
|
+
*/
|
|
11
|
+
export interface GrJsonViewerConfigurableProps {
|
|
12
|
+
size: GrComponentSize;
|
|
13
|
+
defaultExpandDepth: number;
|
|
14
|
+
maxStringLength: number;
|
|
15
|
+
maxArrayItems: number;
|
|
16
|
+
searchable: boolean;
|
|
17
|
+
copyable: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare module '../../composables/useGrComponentConfig' {
|
|
20
|
+
interface GrComponentDefaultsRegistry {
|
|
21
|
+
GrJsonViewer: GrJsonViewerConfigurableProps;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { GrJsonNodeKind } from './jsonToNodes';
|
|
2
|
+
/**
|
|
3
|
+
* Классы `GrJsonViewer`.
|
|
4
|
+
*
|
|
5
|
+
* Роли перечислены целиком, по литералу на ветку: UnoCSS сканирует исходный
|
|
6
|
+
* текст файла, и собранное шаблонной строкой имя уехало бы в CSS литералом.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* `min-w-0` и клип — не украшение: глубокая ветка шире контейнера, и без них
|
|
10
|
+
* панель растягивает раскладку страницы, вместо того чтобы прокручиваться
|
|
11
|
+
* внутри себя. Горизонтальный скролл остаётся у самого дерева.
|
|
12
|
+
*/
|
|
13
|
+
export declare const jsonViewerRootClass = "min-w-0 overflow-hidden rounded-[var(--gr-radius-md)] bg-[var(--gr-json-viewer-bg,var(--gr-muted))] text-[var(--gr-fg)]";
|
|
14
|
+
/** Шапка с поиском и кнопками свёртки. Отбивается от дерева, а не от края. */
|
|
15
|
+
export declare const jsonViewerToolbarClass = "flex items-center gap-2 border-b border-[var(--gr-brd)] p-2";
|
|
16
|
+
export declare const jsonViewerSearchClass = "min-w-0 flex-1";
|
|
17
|
+
/** Строка узла моноширинная: значения выравниваются по разрядам, как в блоке кода. */
|
|
18
|
+
export declare const jsonViewerRowClass = "relative flex min-w-0 items-center gap-1 font-[var(--gr-font-mono)]";
|
|
19
|
+
/** Область узла не даёт значению растянуть строку шире панели. */
|
|
20
|
+
export declare const jsonViewerContentClass = "min-w-0";
|
|
21
|
+
export declare const jsonViewerKeyClass = "shrink-0 text-[var(--gr-json-viewer-key,var(--gr-primary-text))]";
|
|
22
|
+
export declare const jsonViewerPunctuationClass = "shrink-0 text-[var(--gr-json-viewer-punctuation,var(--gr-fg))]";
|
|
23
|
+
/**
|
|
24
|
+
* Значение обрезается по ширине строки, а не переносится: перенос превратил бы
|
|
25
|
+
* дерево в простыню и сломал бы оценку высоты строки у виртуализации.
|
|
26
|
+
*/
|
|
27
|
+
export declare const jsonViewerValueClass = "min-w-0 truncate";
|
|
28
|
+
/** Счётчик у свёрнутой ветки и служебные подписи — тише значения. */
|
|
29
|
+
export declare const jsonViewerMutedClass = "shrink-0 text-[var(--gr-json-viewer-muted,var(--gr-muted-fg))]";
|
|
30
|
+
/**
|
|
31
|
+
* Кнопка копирования узла: появляется по наведению и по фокусу внутри строки.
|
|
32
|
+
*
|
|
33
|
+
* Стоит в потоке сразу за значением, а не прижата к правому краю строки:
|
|
34
|
+
* прижать её не к чему — область узла у `GrTree` сжата по содержимому
|
|
35
|
+
* (`flex: 0 1 auto`) собственным scoped-правилом, а утилитой снаружи оно не
|
|
36
|
+
* перебивается: оба класса равной специфичности, и победителя выбирает порядок
|
|
37
|
+
* правил в CSS. Цена потока — 4 px высоты строки, и она дешевле этой лотереи.
|
|
38
|
+
*/
|
|
39
|
+
export declare const jsonViewerCopyClass = "ml-2 shrink-0 opacity-0 focus-visible:opacity-100 group-hover:opacity-100";
|
|
40
|
+
/**
|
|
41
|
+
* Зацепка варианта `group-hover` у кнопки копирования. В safelist не идёт: CSS
|
|
42
|
+
* из неё не порождается — правило пишет сам вариант, а гейт справедливо считал
|
|
43
|
+
* бы такую запись мёртвой.
|
|
44
|
+
*/
|
|
45
|
+
export declare const jsonViewerGroupClass = "group";
|
|
46
|
+
/**
|
|
47
|
+
* Цвет значения по виду.
|
|
48
|
+
*
|
|
49
|
+
* Дефолты — ссылки на `-text`-роли темы, те же, что у `GrCodeBlock`: роли
|
|
50
|
+
* переключаются вместе с темой, поэтому подсветка работает в обеих без своего
|
|
51
|
+
* theme-слоя, а два компонента остаются согласованными через роль, а не через
|
|
52
|
+
* общую константу — импорт чужой мапы притащил бы потребителю весь CSS донора.
|
|
53
|
+
*
|
|
54
|
+
* Число взято от `azure`, а не от `info`: `info` — синий в двух шагах от индиго
|
|
55
|
+
* `primary`, и пара «ключ ↔ число» стояла бы в одной строке неразличимой.
|
|
56
|
+
*/
|
|
57
|
+
export declare const jsonValueClass: Record<GrJsonNodeKind, string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentExposed } from '../shared/instance';
|
|
2
|
+
import type GrJsonViewerComponent from './GrJsonViewer.vue';
|
|
3
|
+
export { default } from './GrJsonViewer.vue';
|
|
4
|
+
export { default as GrJsonViewer } from './GrJsonViewer.vue';
|
|
5
|
+
export { grJsonViewerConfig } from './config';
|
|
6
|
+
export type { GrJsonViewerConfigurableProps } from './defaults';
|
|
7
|
+
export type { GrJsonNode, GrJsonNodeKind, GrJsonViewerEmits, GrJsonViewerProps, } from './GrJsonViewer.vue';
|
|
8
|
+
export { grJsonViewerSafelist } from './safelist';
|
|
9
|
+
export type GrJsonViewerInstance = ComponentExposed<typeof GrJsonViewerComponent>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Разбор произвольного значения в узлы дерева.
|
|
3
|
+
*
|
|
4
|
+
* Компонент показывает данные из БД и от чужих сервисов, поэтому обход обязан
|
|
5
|
+
* пережить всё: цикл, `BigInt`, функцию в поле, массив на десять тысяч записей,
|
|
6
|
+
* строку в миллион символов. Уронить страницу он права не имеет.
|
|
7
|
+
*/
|
|
8
|
+
/** Что за значение в узле. Решает и цвет, и то, раскрывается ли узел. */
|
|
9
|
+
export type GrJsonNodeKind = 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null'
|
|
10
|
+
/** Значения, которых в JSON не бывает: функция, символ, `undefined`. */
|
|
11
|
+
| 'unsupported'
|
|
12
|
+
/** Хвост обрезанного массива — «ещё N элементов». Своего значения не имеет. */
|
|
13
|
+
| 'truncation';
|
|
14
|
+
export type GrJsonNode = {
|
|
15
|
+
/** Читаемый адрес узла (`$.items[3].name`). Он же ключ для `GrTree`. */
|
|
16
|
+
path: string;
|
|
17
|
+
/** Имя ключа или индекс. Показывается слева от двоеточия. */
|
|
18
|
+
label: string;
|
|
19
|
+
kind: GrJsonNodeKind;
|
|
20
|
+
/** Что видно в строке. У ветки — счётчик, у листа — значение, возможно обрезанное. */
|
|
21
|
+
preview: string;
|
|
22
|
+
/** Полное значение. Копирование берёт его, а не `preview`. */
|
|
23
|
+
value: unknown;
|
|
24
|
+
/** Показ обрезан: копирование всё равно отдаёт целое. */
|
|
25
|
+
truncated: boolean;
|
|
26
|
+
isLeaf: boolean;
|
|
27
|
+
children?: GrJsonNode[];
|
|
28
|
+
};
|
|
29
|
+
export type GrJsonToNodesOptions = {
|
|
30
|
+
/** Подпись корня. */
|
|
31
|
+
rootLabel?: string;
|
|
32
|
+
/** Длина строки, после которой значение обрезается в показе. */
|
|
33
|
+
maxStringLength?: number;
|
|
34
|
+
/** Сколько элементов массива разбирать до заглушки «ещё N». */
|
|
35
|
+
maxArrayItems?: number;
|
|
36
|
+
};
|
|
37
|
+
/** Маркер ветки, которая уже встречалась выше по этой же цепочке предков. */
|
|
38
|
+
export declare const CIRCULAR_MARKER = "[Circular]";
|
|
39
|
+
/**
|
|
40
|
+
* Значение → узлы дерева. Корень всегда один: даже скаляр на входе — это узел,
|
|
41
|
+
* иначе дерево пришлось бы то показывать, то нет.
|
|
42
|
+
*/
|
|
43
|
+
export declare function jsonToNodes(value: unknown, options?: GrJsonToNodesOptions): GrJsonNode[];
|
|
44
|
+
/** Пути всех узлов до заданной глубины — ими задаётся начальная свёртка. */
|
|
45
|
+
export declare function pathsToDepth(nodes: GrJsonNode[], depth: number, level?: number): string[];
|
|
46
|
+
/** Пути всех веток — для «раскрыть всё». */
|
|
47
|
+
export declare function branchPaths(nodes: GrJsonNode[]): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const grJsonViewerSafelist: string[];
|
|
@@ -7,6 +7,19 @@ export type GrListItemDensity = 'compact' | 'regular';
|
|
|
7
7
|
* и разойтись они могли молча.
|
|
8
8
|
*/
|
|
9
9
|
export declare const densityPadding: Record<GrListItemDensity, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Список обрезается по радиусу карточки под ним.
|
|
12
|
+
*
|
|
13
|
+
* Своего радиуса у строки нет и не нужно: строки идут вплотную, и скруглённая
|
|
14
|
+
* подсветка посреди сплошного списка читалась бы как случайная. Но поля у
|
|
15
|
+
* `GrCard` по умолчанию нет, строка лежит вплотную к скруглению, и без клипа
|
|
16
|
+
* фон первой и последней заливает углы — постоянно при `disabled` и по
|
|
17
|
+
* наведению при кликабельной строке.
|
|
18
|
+
*
|
|
19
|
+
* `inherit`, а не повтор `--gr-radius-lg`: значение принадлежит `GrCard`, и
|
|
20
|
+
* копия разошлась бы с ним молча.
|
|
21
|
+
*/
|
|
22
|
+
export declare const listSurfaceClass = "overflow-hidden rounded-[inherit]";
|
|
10
23
|
export declare const itemLayoutClass = "flex items-start justify-between gap-4";
|
|
11
24
|
/** Интерактивная строка занимает всю ширину пункта — кликабельна вся, а не текст. */
|
|
12
25
|
export declare const itemInteractiveClass = "w-full text-left transition-colors duration-[var(--gr-duration-fast)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--gr-ring)] focus-visible:ring-inset";
|
|
@@ -187,8 +187,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
187
187
|
inputmode: "search" | "text" | "none" | "email" | "tel" | "url" | "numeric" | "decimal";
|
|
188
188
|
state: GrNumberInputState;
|
|
189
189
|
locale: string;
|
|
190
|
-
decimalSeparator: string;
|
|
191
190
|
precision: number;
|
|
191
|
+
decimalSeparator: string;
|
|
192
192
|
useGrouping: boolean;
|
|
193
193
|
controls: boolean;
|
|
194
194
|
controlsDirection: GrNumberInputControlsDirection;
|
|
@@ -136,12 +136,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
136
136
|
tone: GrRatingTone;
|
|
137
137
|
size: GrRatingSize;
|
|
138
138
|
clearable: boolean;
|
|
139
|
+
compact: boolean;
|
|
139
140
|
icon: string | Component;
|
|
140
141
|
readonly: boolean;
|
|
141
142
|
name: string;
|
|
142
143
|
invalid: boolean;
|
|
143
144
|
max: number;
|
|
144
|
-
compact: boolean;
|
|
145
145
|
disabled: boolean;
|
|
146
146
|
required: boolean;
|
|
147
147
|
ariaLabel: string;
|
|
@@ -23,7 +23,7 @@ export interface GrSegmentedProps {
|
|
|
23
23
|
invalid?: boolean;
|
|
24
24
|
/** Обязательное поле (`aria-required`). */
|
|
25
25
|
required?: boolean;
|
|
26
|
-
/** Имя
|
|
26
|
+
/** Имя скрытого поля, которым выбранное значение уходит в нативную форму. */
|
|
27
27
|
name?: string;
|
|
28
28
|
ariaLabel?: string;
|
|
29
29
|
}
|
|
@@ -123,18 +123,18 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
123
123
|
}>, {
|
|
124
124
|
tone: GrStatisticTone;
|
|
125
125
|
size: GrStatisticSize;
|
|
126
|
+
loading: boolean;
|
|
126
127
|
title: string;
|
|
127
128
|
icon: string | Component;
|
|
128
129
|
animate: boolean;
|
|
129
130
|
href: string;
|
|
130
|
-
loading: boolean;
|
|
131
131
|
prefix: string;
|
|
132
132
|
suffix: string;
|
|
133
133
|
as: string | Component;
|
|
134
134
|
clickable: boolean;
|
|
135
135
|
locale: string;
|
|
136
|
-
decimalSeparator: string;
|
|
137
136
|
precision: number;
|
|
137
|
+
decimalSeparator: string;
|
|
138
138
|
groupSeparator: string;
|
|
139
139
|
trend: GrStatisticTrend;
|
|
140
140
|
trendText: string;
|
|
@@ -89,12 +89,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
89
89
|
}>, {
|
|
90
90
|
size: GrSwitchSize;
|
|
91
91
|
labelPosition: GrSwitchLabelPosition;
|
|
92
|
+
loading: boolean;
|
|
92
93
|
value: string;
|
|
93
94
|
readonly: boolean;
|
|
94
95
|
form: string;
|
|
95
96
|
name: string;
|
|
96
97
|
invalid: boolean;
|
|
97
|
-
loading: boolean;
|
|
98
98
|
disabled: boolean;
|
|
99
99
|
required: boolean;
|
|
100
100
|
ariaLabel: string;
|