@daisu-ui/ui 0.0.0-stage → 0.1.0-beta.3
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/CHANGELOG.md +58 -0
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/THIRD_PARTY_NOTICES.md +19 -0
- package/dist/ActionSheet.d.ts +45 -0
- package/dist/ActionSheet.jsx +37 -0
- package/dist/AnchoredBubble.d.ts +36 -0
- package/dist/AnchoredBubble.jsx +120 -0
- package/dist/Avatar.d.ts +35 -0
- package/dist/Avatar.jsx +29 -0
- package/dist/Backtop.d.ts +22 -0
- package/dist/Backtop.jsx +18 -0
- package/dist/Badge.d.ts +19 -0
- package/dist/Badge.jsx +11 -0
- package/dist/BarCode.d.ts +20 -0
- package/dist/BarCode.jsx +38 -0
- package/dist/Button.d.ts +21 -0
- package/dist/Button.jsx +19 -0
- package/dist/Calendar.d.ts +90 -0
- package/dist/Calendar.jsx +164 -0
- package/dist/CalendarView.d.ts +51 -0
- package/dist/CalendarView.jsx +136 -0
- package/dist/Card.d.ts +21 -0
- package/dist/Card.jsx +21 -0
- package/dist/Cascader.d.ts +75 -0
- package/dist/Cascader.jsx +212 -0
- package/dist/Cell.d.ts +34 -0
- package/dist/Cell.jsx +37 -0
- package/dist/Checkbox.d.ts +50 -0
- package/dist/Checkbox.jsx +74 -0
- package/dist/Circle.d.ts +19 -0
- package/dist/Circle.jsx +35 -0
- package/dist/Collapse.d.ts +31 -0
- package/dist/Collapse.jsx +61 -0
- package/dist/ConfigProvider.d.ts +15 -0
- package/dist/ConfigProvider.jsx +20 -0
- package/dist/CountDown.d.ts +20 -0
- package/dist/CountDown.jsx +15 -0
- package/dist/CountTo.d.ts +28 -0
- package/dist/CountTo.jsx +27 -0
- package/dist/Curtain.d.ts +29 -0
- package/dist/Curtain.jsx +51 -0
- package/dist/DatetimePicker.d.ts +46 -0
- package/dist/DatetimePicker.jsx +138 -0
- package/dist/DatetimePickerView.d.ts +38 -0
- package/dist/DatetimePickerView.jsx +36 -0
- package/dist/Dialog.d.ts +64 -0
- package/dist/Dialog.jsx +105 -0
- package/dist/Divider.d.ts +16 -0
- package/dist/Divider.jsx +9 -0
- package/dist/DropMenu.d.ts +55 -0
- package/dist/DropMenu.jsx +210 -0
- package/dist/Empty.d.ts +14 -0
- package/dist/Empty.jsx +14 -0
- package/dist/EmptyState.d.ts +6 -0
- package/dist/EmptyState.jsx +9 -0
- package/dist/Fab.d.ts +30 -0
- package/dist/Fab.jsx +127 -0
- package/dist/FloatingPanel.d.ts +21 -0
- package/dist/FloatingPanel.jsx +102 -0
- package/dist/Form.d.ts +63 -0
- package/dist/Form.jsx +108 -0
- package/dist/FormFieldRow.d.ts +56 -0
- package/dist/FormFieldRow.jsx +63 -0
- package/dist/Gap.d.ts +10 -0
- package/dist/Gap.jsx +14 -0
- package/dist/Grid.d.ts +47 -0
- package/dist/Grid.jsx +31 -0
- package/dist/Icon.d.ts +11 -0
- package/dist/Icon.jsx +12 -0
- package/dist/ImagePreview.d.ts +62 -0
- package/dist/ImagePreview.jsx +78 -0
- package/dist/Img.d.ts +28 -0
- package/dist/Img.jsx +59 -0
- package/dist/ImgCropper.d.ts +74 -0
- package/dist/ImgCropper.jsx +114 -0
- package/dist/IndexBar.d.ts +36 -0
- package/dist/IndexBar.jsx +149 -0
- package/dist/Input.d.ts +11 -0
- package/dist/Input.jsx +3 -0
- package/dist/InputNumber.d.ts +32 -0
- package/dist/InputNumber.jsx +165 -0
- package/dist/Keyboard.d.ts +37 -0
- package/dist/Keyboard.jsx +130 -0
- package/dist/Layout.d.ts +31 -0
- package/dist/Layout.jsx +14 -0
- package/dist/Loading.d.ts +18 -0
- package/dist/Loading.jsx +15 -0
- package/dist/Loadmore.d.ts +18 -0
- package/dist/Loadmore.jsx +16 -0
- package/dist/Navbar.d.ts +35 -0
- package/dist/Navbar.jsx +50 -0
- package/dist/NoticeBar.d.ts +30 -0
- package/dist/NoticeBar.jsx +86 -0
- package/dist/Notify.d.ts +34 -0
- package/dist/Notify.jsx +52 -0
- package/dist/NumberStepper.d.ts +11 -0
- package/dist/NumberStepper.jsx +41 -0
- package/dist/Overlay.d.ts +16 -0
- package/dist/Overlay.jsx +12 -0
- package/dist/PagedList.d.ts +13 -0
- package/dist/PagedList.jsx +36 -0
- package/dist/Pagination.d.ts +29 -0
- package/dist/Pagination.jsx +33 -0
- package/dist/PasswordInput.d.ts +16 -0
- package/dist/PasswordInput.jsx +20 -0
- package/dist/Picker.d.ts +61 -0
- package/dist/Picker.jsx +80 -0
- package/dist/PickerView.d.ts +43 -0
- package/dist/PickerView.jsx +142 -0
- package/dist/Popover.d.ts +23 -0
- package/dist/Popover.jsx +35 -0
- package/dist/Popup.d.ts +30 -0
- package/dist/Popup.jsx +32 -0
- package/dist/Progress.d.ts +17 -0
- package/dist/Progress.jsx +45 -0
- package/dist/QrCode.d.ts +46 -0
- package/dist/QrCode.jsx +67 -0
- package/dist/Radio.d.ts +21 -0
- package/dist/Radio.jsx +34 -0
- package/dist/Rate.d.ts +25 -0
- package/dist/Rate.jsx +39 -0
- package/dist/Resize.d.ts +17 -0
- package/dist/Resize.jsx +17 -0
- package/dist/RichText.d.ts +133 -0
- package/dist/RichText.jsx +288 -0
- package/dist/RootPortal.d.ts +11 -0
- package/dist/RootPortal.jsx +19 -0
- package/dist/Search.d.ts +39 -0
- package/dist/Search.jsx +94 -0
- package/dist/Segmented.d.ts +18 -0
- package/dist/Segmented.jsx +35 -0
- package/dist/SelectPicker.d.ts +54 -0
- package/dist/SelectPicker.jsx +136 -0
- package/dist/Sidebar.d.ts +34 -0
- package/dist/Sidebar.jsx +43 -0
- package/dist/Signature.d.ts +46 -0
- package/dist/Signature.jsx +203 -0
- package/dist/Skeleton.d.ts +27 -0
- package/dist/Skeleton.jsx +29 -0
- package/dist/SlideVerify.d.ts +27 -0
- package/dist/SlideVerify.jsx +138 -0
- package/dist/Slider.d.ts +21 -0
- package/dist/Slider.jsx +131 -0
- package/dist/SortButton.d.ts +16 -0
- package/dist/SortButton.jsx +19 -0
- package/dist/Steps.d.ts +23 -0
- package/dist/Steps.jsx +25 -0
- package/dist/Sticky.d.ts +17 -0
- package/dist/Sticky.jsx +69 -0
- package/dist/SwipeAction.d.ts +27 -0
- package/dist/SwipeAction.jsx +187 -0
- package/dist/Swiper.d.ts +54 -0
- package/dist/Swiper.jsx +94 -0
- package/dist/SwiperNav.d.ts +18 -0
- package/dist/SwiperNav.jsx +10 -0
- package/dist/Switch.d.ts +31 -0
- package/dist/Switch.jsx +46 -0
- package/dist/SyncedInput.d.ts +12 -0
- package/dist/SyncedInput.jsx +18 -0
- package/dist/SyncedTextarea.d.ts +11 -0
- package/dist/SyncedTextarea.jsx +18 -0
- package/dist/Tabbar.d.ts +37 -0
- package/dist/Tabbar.jsx +46 -0
- package/dist/Table.d.ts +51 -0
- package/dist/Table.jsx +125 -0
- package/dist/Tabs.d.ts +65 -0
- package/dist/Tabs.jsx +132 -0
- package/dist/Tag.d.ts +33 -0
- package/dist/Tag.jsx +63 -0
- package/dist/Text.d.ts +19 -0
- package/dist/Text.jsx +7 -0
- package/dist/TextField.d.ts +89 -0
- package/dist/TextField.jsx +149 -0
- package/dist/Textarea.d.ts +22 -0
- package/dist/Textarea.jsx +3 -0
- package/dist/Toast.d.ts +36 -0
- package/dist/Toast.jsx +30 -0
- package/dist/Tooltip.d.ts +8 -0
- package/dist/Tooltip.jsx +5 -0
- package/dist/Tour.d.ts +85 -0
- package/dist/Tour.jsx +150 -0
- package/dist/Transition.d.ts +32 -0
- package/dist/Transition.jsx +43 -0
- package/dist/Upload.d.ts +64 -0
- package/dist/Upload.jsx +163 -0
- package/dist/VideoPreview.d.ts +47 -0
- package/dist/VideoPreview.jsx +59 -0
- package/dist/Watermark.d.ts +36 -0
- package/dist/Watermark.jsx +18 -0
- package/dist/action-sheet.css +19 -0
- package/dist/avatar.css +23 -0
- package/dist/avatarModel.d.ts +8 -0
- package/dist/avatarModel.js +17 -0
- package/dist/backtop.css +6 -0
- package/dist/badge.css +15 -0
- package/dist/badgeModel.d.ts +2 -0
- package/dist/badgeModel.js +18 -0
- package/dist/bar-code.css +5 -0
- package/dist/barCodeModel.d.ts +80 -0
- package/dist/barCodeModel.js +99 -0
- package/dist/bubble.css +14 -0
- package/dist/bubblePosition.d.ts +19 -0
- package/dist/bubblePosition.js +41 -0
- package/dist/button.css +56 -0
- package/dist/calendar.css +56 -0
- package/dist/calendarModel.d.ts +62 -0
- package/dist/calendarModel.js +141 -0
- package/dist/card.css +8 -0
- package/dist/cascader.css +16 -0
- package/dist/cascaderModel.d.ts +21 -0
- package/dist/cascaderModel.js +32 -0
- package/dist/cell.css +41 -0
- package/dist/choice.css +27 -0
- package/dist/choice.d.ts +28 -0
- package/dist/choice.jsx +16 -0
- package/dist/circle.css +4 -0
- package/dist/circleModel.d.ts +15 -0
- package/dist/circleModel.js +31 -0
- package/dist/config-provider.css +2 -0
- package/dist/configContext.d.ts +23 -0
- package/dist/configContext.js +24 -0
- package/dist/configTheme.d.ts +3 -0
- package/dist/configTheme.js +22 -0
- package/dist/count-down.css +2 -0
- package/dist/count-to.css +8 -0
- package/dist/countDownModel.d.ts +11 -0
- package/dist/countDownModel.js +7 -0
- package/dist/countToModel.d.ts +3 -0
- package/dist/countToModel.js +3 -0
- package/dist/curtain.css +10 -0
- package/dist/datetime-picker.css +11 -0
- package/dist/datetimePickerModel.d.ts +47 -0
- package/dist/datetimePickerModel.js +128 -0
- package/dist/dialog.css +23 -0
- package/dist/divider.css +14 -0
- package/dist/drop-menu.css +28 -0
- package/dist/empty.css +7 -0
- package/dist/fab.css +23 -0
- package/dist/fabModel.d.ts +26 -0
- package/dist/fabModel.js +16 -0
- package/dist/floating-panel.css +6 -0
- package/dist/floatingPanelModel.d.ts +3 -0
- package/dist/floatingPanelModel.js +10 -0
- package/dist/form.css +10 -0
- package/dist/formContext.d.ts +7 -0
- package/dist/formContext.js +2 -0
- package/dist/formModel.d.ts +38 -0
- package/dist/formModel.js +16 -0
- package/dist/gap.css +1 -0
- package/dist/grid.css +17 -0
- package/dist/icon.css +8 -0
- package/dist/icons/LICENSE.tabler +21 -0
- package/dist/icons/paths.d.ts +309 -0
- package/dist/icons/paths.js +310 -0
- package/dist/icons/render.d.ts +2 -0
- package/dist/icons/render.js +5 -0
- package/dist/image-preview.css +8 -0
- package/dist/img-cropper.css +1 -0
- package/dist/img.css +5 -0
- package/dist/imgCropperModel.d.ts +55 -0
- package/dist/imgCropperModel.js +41 -0
- package/dist/imgModel.d.ts +13 -0
- package/dist/imgModel.js +22 -0
- package/dist/index-bar.css +12 -0
- package/dist/index.d.ts +200 -0
- package/dist/index.js +99 -0
- package/dist/indexBarModel.d.ts +19 -0
- package/dist/indexBarModel.js +37 -0
- package/dist/input-number.css +24 -0
- package/dist/inputNumberModel.d.ts +23 -0
- package/dist/inputNumberModel.js +40 -0
- package/dist/keyboard.css +26 -0
- package/dist/keyboardModel.d.ts +11 -0
- package/dist/keyboardModel.js +34 -0
- package/dist/layout.css +2 -0
- package/dist/legacy/RadioGroup.d.ts +13 -0
- package/dist/legacy/RadioGroup.jsx +13 -0
- package/dist/legacy-controls.css +87 -0
- package/dist/loading.css +31 -0
- package/dist/loadingModel.d.ts +2 -0
- package/dist/loadingModel.js +21 -0
- package/dist/loadmore.css +5 -0
- package/dist/navbar.css +16 -0
- package/dist/notice-bar.css +19 -0
- package/dist/notify.css +14 -0
- package/dist/overlay.css +2 -0
- package/dist/pagination.css +12 -0
- package/dist/paginationModel.d.ts +6 -0
- package/dist/paginationModel.js +7 -0
- package/dist/password-input.css +14 -0
- package/dist/passwordInputModel.d.ts +6 -0
- package/dist/passwordInputModel.js +11 -0
- package/dist/picker.css +42 -0
- package/dist/pickerModel.d.ts +32 -0
- package/dist/pickerModel.js +49 -0
- package/dist/popover.css +5 -0
- package/dist/popup.css +17 -0
- package/dist/progress.css +16 -0
- package/dist/progressModel.d.ts +12 -0
- package/dist/progressModel.js +19 -0
- package/dist/qr-code.css +4 -0
- package/dist/qrCodeModel.d.ts +36 -0
- package/dist/qrCodeModel.js +61 -0
- package/dist/rate.css +20 -0
- package/dist/rateModel.d.ts +4 -0
- package/dist/rateModel.js +38 -0
- package/dist/resize.css +2 -0
- package/dist/rich-text.css +19 -0
- package/dist/richTextMedia.d.ts +28 -0
- package/dist/richTextMedia.js +3 -0
- package/dist/richTextModel.d.ts +52 -0
- package/dist/richTextModel.js +195 -0
- package/dist/root-portal.css +1 -0
- package/dist/router/RouterView.d.ts +21 -0
- package/dist/router/RouterView.jsx +120 -0
- package/dist/router/core.d.ts +85 -0
- package/dist/router/core.js +255 -0
- package/dist/router/hooks.d.ts +17 -0
- package/dist/router/hooks.jsx +71 -0
- package/dist/router/index.d.ts +5 -0
- package/dist/router/index.js +3 -0
- package/dist/router/location.d.ts +8 -0
- package/dist/router/location.js +46 -0
- package/dist/router/router.css +7 -0
- package/dist/router/runtime.d.ts +1 -0
- package/dist/router/runtime.js +25 -0
- package/dist/search.css +23 -0
- package/dist/segmented.css +19 -0
- package/dist/segmentedModel.d.ts +10 -0
- package/dist/segmentedModel.js +8 -0
- package/dist/sidebar.css +18 -0
- package/dist/sidebarModel.d.ts +8 -0
- package/dist/sidebarModel.js +27 -0
- package/dist/signature.css +5 -0
- package/dist/signatureModel.d.ts +23 -0
- package/dist/signatureModel.js +80 -0
- package/dist/skeleton.css +16 -0
- package/dist/slide-verify.css +7 -0
- package/dist/slider.css +49 -0
- package/dist/sliderModel.d.ts +10 -0
- package/dist/sliderModel.js +27 -0
- package/dist/sort-button.css +12 -0
- package/dist/steps.css +35 -0
- package/dist/sticky.css +7 -0
- package/dist/styles.css +136 -0
- package/dist/styles.d.ts +1 -0
- package/dist/swipe-action.css +6 -0
- package/dist/swiper.css +27 -0
- package/dist/swiperAnimation.d.ts +3 -0
- package/dist/swiperAnimation.js +6 -0
- package/dist/swiperModel.d.ts +2 -0
- package/dist/swiperModel.js +3 -0
- package/dist/switch.css +12 -0
- package/dist/tabbar.css +17 -0
- package/dist/tabbarModel.d.ts +8 -0
- package/dist/tabbarModel.js +27 -0
- package/dist/table.css +21 -0
- package/dist/tableModel.d.ts +10 -0
- package/dist/tableModel.js +17 -0
- package/dist/tabs.css +31 -0
- package/dist/tabsModel.d.ts +7 -0
- package/dist/tabsModel.js +14 -0
- package/dist/tag.css +66 -0
- package/dist/text-field.css +15 -0
- package/dist/text.css +7 -0
- package/dist/textModel.d.ts +3 -0
- package/dist/textModel.js +24 -0
- package/dist/toast.css +13 -0
- package/dist/tokens.d.ts +34 -0
- package/dist/tokens.js +10 -0
- package/dist/tour.css +8 -0
- package/dist/transition.css +12 -0
- package/dist/upload.css +11 -0
- package/dist/useCountDown.d.ts +14 -0
- package/dist/useCountDown.js +73 -0
- package/dist/useDialog.d.ts +9 -0
- package/dist/useDialog.js +33 -0
- package/dist/useImagePreview.d.ts +7 -0
- package/dist/useImagePreview.js +17 -0
- package/dist/useNotify.d.ts +9 -0
- package/dist/useNotify.js +26 -0
- package/dist/usePressState.d.ts +6 -0
- package/dist/usePressState.js +17 -0
- package/dist/useToast.d.ts +11 -0
- package/dist/useToast.js +23 -0
- package/dist/useVideoPreview.d.ts +7 -0
- package/dist/useVideoPreview.js +17 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +4 -0
- package/dist/video-preview.css +7 -0
- package/dist/watermark.css +6 -0
- package/dist/web/imgCropperElement.d.ts +2 -0
- package/dist/web/imgCropperElement.js +309 -0
- package/dist/web/index.d.ts +6 -0
- package/dist/web/index.js +6 -0
- package/dist/web/qrCodeExportElement.d.ts +4 -0
- package/dist/web/qrCodeExportElement.js +70 -0
- package/dist/web/richTextMediaElement.d.ts +2 -0
- package/dist/web/richTextMediaElement.js +276 -0
- package/package.json +98 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Confirmation is invalidated by another tap, new props or unmounting. */
|
|
2
|
+
export function createSidebarGuard() {
|
|
3
|
+
let sequence = 0;
|
|
4
|
+
return {
|
|
5
|
+
cancel() {
|
|
6
|
+
'background only';
|
|
7
|
+
sequence++;
|
|
8
|
+
},
|
|
9
|
+
async request(value, before, commit) {
|
|
10
|
+
'background only';
|
|
11
|
+
const request = ++sequence;
|
|
12
|
+
try {
|
|
13
|
+
const result = before ? before(value) : true;
|
|
14
|
+
const allowed = typeof result === 'boolean' ? result : await result;
|
|
15
|
+
if (allowed === true && request === sequence)
|
|
16
|
+
commit();
|
|
17
|
+
}
|
|
18
|
+
catch { /* Rejected confirmations leave the selection unchanged. */ }
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function sidebarBadge(value, max = 99) {
|
|
23
|
+
if (value === undefined || value === '')
|
|
24
|
+
return '';
|
|
25
|
+
const ceiling = Number.isFinite(max) ? Math.max(0, max) : 99;
|
|
26
|
+
return Number.isFinite(Number(value)) && Number(value) > ceiling ? `${ceiling}+` : String(value);
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
.ui-signature{display:flex;flex-direction:column;}
|
|
2
|
+
.ui-signature-content{display:flex;justify-content:center;align-items:center;overflow:hidden;border-radius:4px;border:1px solid var(--cso-ui-line);background-color:var(--cso-ui-signature-background,#fff);}
|
|
3
|
+
.ui-signature-board{width:100%;position:relative;flex-shrink:0;}
|
|
4
|
+
.ui-signature-svg{position:absolute;left:0;top:0;pointer-events:none;}
|
|
5
|
+
.ui-signature-footer{margin-top:8px;display:flex;flex-direction:row;justify-content:flex-end;gap:8px;}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SignaturePoint = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
time: number;
|
|
5
|
+
width: number;
|
|
6
|
+
};
|
|
7
|
+
export type SignatureStroke = {
|
|
8
|
+
color: string;
|
|
9
|
+
points: SignaturePoint[];
|
|
10
|
+
};
|
|
11
|
+
export type SignatureResult = {
|
|
12
|
+
success: boolean;
|
|
13
|
+
dataUrl: string;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
error?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const signatureNumber: (value: number, fallback: number, min?: number) => number;
|
|
19
|
+
export declare function signatureWidth(speed: number, previous: number, min: number, max: number, threshold: number): number;
|
|
20
|
+
export declare function signatureColor(value: string): [number, number, number, number];
|
|
21
|
+
export declare function signatureSvg(strokes: readonly SignatureStroke[], width: number, height: number, background?: string): string;
|
|
22
|
+
/** Portable PNG export from the same vector samples; no Canvas, DOM, Buffer or native file path. */
|
|
23
|
+
export declare function signaturePng(strokes: readonly SignatureStroke[], width: number, height: number, scale?: number, background?: string): SignatureResult;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { zlibSync } from 'fflate';
|
|
2
|
+
export const signatureNumber = (value, fallback, min = 0) => Number.isFinite(value) ? Math.max(min, value) : fallback;
|
|
3
|
+
export function signatureWidth(speed, previous, min, max, threshold) {
|
|
4
|
+
const low = signatureNumber(min, 2, .1), high = Math.max(low, signatureNumber(max, 6, .1)), limit = signatureNumber(threshold, 1.5, .01);
|
|
5
|
+
const target = Math.max(low, high - (high - low) * Math.max(0, speed - limit) / limit);
|
|
6
|
+
return Math.max(low, Math.min(high, Math.max(previous * .8, Math.min(previous * 1.2, target))));
|
|
7
|
+
}
|
|
8
|
+
export function signatureColor(value) {
|
|
9
|
+
const names = { black: '#000000', white: '#ffffff', red: '#ff0000', blue: '#0000ff', green: '#008000', transparent: '#00000000' };
|
|
10
|
+
const input = names[value.toLowerCase()] ?? value;
|
|
11
|
+
const hex = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(input);
|
|
12
|
+
if (hex) {
|
|
13
|
+
let h = hex[1];
|
|
14
|
+
if (h.length < 5)
|
|
15
|
+
h = [...h].map(c => c + c).join('');
|
|
16
|
+
return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16), h.length === 8 ? parseInt(h.slice(6), 16) : 255];
|
|
17
|
+
}
|
|
18
|
+
const rgb = /^rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i.exec(input);
|
|
19
|
+
if (rgb)
|
|
20
|
+
return [1, 2, 3].map(i => Math.round(Math.min(255, Number(rgb[i])))).concat(Math.round(Math.min(1, Number(rgb[4] ?? 1)) * 255));
|
|
21
|
+
throw new Error('PNG 导出颜色请使用十六进制、rgb/rgba、black/white/red/blue/green/transparent');
|
|
22
|
+
}
|
|
23
|
+
export function signatureSvg(strokes, width, height, background = 'transparent') {
|
|
24
|
+
const fmt = (n) => Number(n.toFixed(2));
|
|
25
|
+
const color = (value) => value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
|
26
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}"><rect width="100%" height="100%" fill="${color(background)}"/>${strokes.map(stroke => `<g fill="${color(stroke.color)}">${stroke.points.map((p, i) => { const prev = stroke.points[i - 1]; if (!prev)
|
|
27
|
+
return `<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(p.width / 2)}"/>`; const dx = p.x - prev.x, dy = p.y - prev.y, len = Math.hypot(dx, dy); if (!len)
|
|
28
|
+
return ''; const nx = -dy / len, ny = dx / len; return `<polygon points="${fmt(prev.x + nx * prev.width / 2)},${fmt(prev.y + ny * prev.width / 2)} ${fmt(p.x + nx * p.width / 2)},${fmt(p.y + ny * p.width / 2)} ${fmt(p.x - nx * p.width / 2)},${fmt(p.y - ny * p.width / 2)} ${fmt(prev.x - nx * prev.width / 2)},${fmt(prev.y - ny * prev.width / 2)}"/><circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(p.width / 2)}"/>`; }).join('')}</g>`).join('')}</svg>`;
|
|
29
|
+
}
|
|
30
|
+
function crc32(bytes) { let crc = 0xffffffff; for (const byte of bytes) {
|
|
31
|
+
crc ^= byte;
|
|
32
|
+
for (let bit = 0; bit < 8; bit++)
|
|
33
|
+
crc = crc & 1 ? 0xedb88320 ^ (crc >>> 1) : crc >>> 1;
|
|
34
|
+
} return (crc ^ 0xffffffff) >>> 0; }
|
|
35
|
+
function u32(value) { return [value >>> 24, (value >>> 16) & 255, (value >>> 8) & 255, value & 255]; }
|
|
36
|
+
function chunk(name, data) { const body = new Uint8Array(4 + data.length); body.set([...name].map(c => c.charCodeAt(0))); body.set(data, 4); return new Uint8Array([...u32(data.length), ...body, ...u32(crc32(body))]); }
|
|
37
|
+
function base64(data) { const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; let result = ''; for (let i = 0; i < data.length; i += 3) {
|
|
38
|
+
const n = (data[i] << 16) | ((data[i + 1] ?? 0) << 8) | (data[i + 2] ?? 0);
|
|
39
|
+
result += alphabet[(n >>> 18) & 63] + alphabet[(n >>> 12) & 63] + (i + 1 < data.length ? alphabet[(n >>> 6) & 63] : '=') + (i + 2 < data.length ? alphabet[n & 63] : '=');
|
|
40
|
+
} return result; }
|
|
41
|
+
/** Portable PNG export from the same vector samples; no Canvas, DOM, Buffer or native file path. */
|
|
42
|
+
export function signaturePng(strokes, width, height, scale = 1, background = 'transparent') {
|
|
43
|
+
const w = Math.round(width * scale), h = Math.round(height * scale);
|
|
44
|
+
if (!Number.isFinite(scale) || scale <= 0 || w < 1 || h < 1 || w > 4096 || h > 4096 || w * h > 4_000_000)
|
|
45
|
+
throw new Error('导出尺寸须在 4096px/边、400万像素以内');
|
|
46
|
+
const bg = signatureColor(background), pixels = new Uint8Array(w * h * 4);
|
|
47
|
+
for (let i = 0; i < pixels.length; i += 4)
|
|
48
|
+
pixels.set(bg, i);
|
|
49
|
+
for (const stroke of strokes) {
|
|
50
|
+
const ink = signatureColor(stroke.color), coverage = new Uint8Array(w * h);
|
|
51
|
+
stroke.points.forEach((p, index) => {
|
|
52
|
+
const prev = stroke.points[index - 1] ?? p, x1 = prev.x * scale, y1 = prev.y * scale, x2 = p.x * scale, y2 = p.y * scale, r1 = prev.width * scale / 2, r2 = p.width * scale / 2, r = Math.max(r1, r2) + 1, dx = x2 - x1, dy = y2 - y1, length2 = dx * dx + dy * dy;
|
|
53
|
+
for (let y = Math.max(0, Math.floor(Math.min(y1, y2) - r)); y < Math.min(h, Math.ceil(Math.max(y1, y2) + r)); y++)
|
|
54
|
+
for (let x = Math.max(0, Math.floor(Math.min(x1, x2) - r)); x < Math.min(w, Math.ceil(Math.max(x1, x2) + r)); x++) {
|
|
55
|
+
const t = length2 ? Math.max(0, Math.min(1, ((x + .5 - x1) * dx + (y + .5 - y1) * dy) / length2)) : 0;
|
|
56
|
+
const distance = Math.hypot(x + .5 - (x1 + t * dx), y + .5 - (y1 + t * dy)), alpha = Math.round(Math.max(0, Math.min(1, r1 + (r2 - r1) * t + .5 - distance)) * 255), at = y * w + x;
|
|
57
|
+
coverage[at] = Math.max(coverage[at], alpha);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
for (let at = 0; at < coverage.length; at++) {
|
|
61
|
+
if (!coverage[at])
|
|
62
|
+
continue;
|
|
63
|
+
const i = at * 4, sa = ink[3] / 255 * coverage[at] / 255, da = pixels[i + 3] / 255, alpha = sa + da * (1 - sa);
|
|
64
|
+
for (let c = 0; c < 3; c++)
|
|
65
|
+
pixels[i + c] = Math.round((ink[c] * sa + pixels[i + c] * da * (1 - sa)) / alpha);
|
|
66
|
+
pixels[i + 3] = Math.round(alpha * 255);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const raw = new Uint8Array(h * (w * 4 + 1));
|
|
70
|
+
for (let y = 0; y < h; y++)
|
|
71
|
+
raw.set(pixels.subarray(y * w * 4, (y + 1) * w * 4), y * (w * 4 + 1) + 1);
|
|
72
|
+
const parts = [new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]), chunk('IHDR', new Uint8Array([...u32(w), ...u32(h), 8, 6, 0, 0, 0])), chunk('IDAT', zlibSync(raw)), chunk('IEND', new Uint8Array())];
|
|
73
|
+
const png = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
74
|
+
let offset = 0;
|
|
75
|
+
for (const part of parts) {
|
|
76
|
+
png.set(part, offset);
|
|
77
|
+
offset += part.length;
|
|
78
|
+
}
|
|
79
|
+
return { success: true, dataUrl: `data:image/png;base64,${base64(png)}`, width: w, height: h };
|
|
80
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.ui-skeleton{box-sizing:border-box;--ui-skeleton-highlight:#f7f8fa;}
|
|
2
|
+
.theme-dark .ui-skeleton{--ui-skeleton-highlight:#1d1f29;}
|
|
3
|
+
.ui-skeleton-content{width:100%;}
|
|
4
|
+
.ui-skeleton-row{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:12px;}
|
|
5
|
+
.ui-skeleton-row-last{margin-bottom:0;}
|
|
6
|
+
.ui-skeleton-col{position:relative;display:flex;align-items:center;justify-content:center;background-color:var(--cso-ui-skeleton-bg,#e5e6eb);border-radius:2px;flex-shrink:1;}
|
|
7
|
+
.theme-dark .ui-skeleton-col{background-color:var(--cso-ui-skeleton-bg,#4e5369);}
|
|
8
|
+
.ui-skeleton-text{width:100%;height:16px;}
|
|
9
|
+
.ui-skeleton-rect{width:100%;height:16px;border-radius:4px;}
|
|
10
|
+
.ui-skeleton-circle{width:48px;height:48px;border-radius:9999px;flex-shrink:0;}
|
|
11
|
+
.ui-skeleton-animation-gradient{overflow:hidden;}
|
|
12
|
+
.ui-skeleton-shimmer{position:absolute;top:0;left:0;width:100%;height:100%;background-image:linear-gradient(90deg,transparent,var(--cso-ui-skeleton-highlight,var(--ui-skeleton-highlight)),transparent);animation:ui-skeleton-gradient 1.5s linear infinite;}
|
|
13
|
+
.theme-dark .ui-skeleton-shimmer{background-image:linear-gradient(90deg,transparent,var(--cso-ui-skeleton-highlight,#1d1f29),transparent);}
|
|
14
|
+
.ui-skeleton-animation-flashed{animation:ui-skeleton-flashed 2s linear infinite;}
|
|
15
|
+
@keyframes ui-skeleton-gradient{from{transform:translateX(-100%) skewX(-15deg);}to{transform:translateX(100%) skewX(-15deg);}}
|
|
16
|
+
@keyframes ui-skeleton-flashed{0%,100%{opacity:1;}50%{opacity:.3;background-color:var(--cso-ui-skeleton-highlight,var(--ui-skeleton-highlight));}}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
.ui-slide-verify{position:relative;width:100%;height:40px;display:flex;align-items:center;justify-content:center;overflow:hidden;background-color:var(--cso-ui-canvas);border-radius:8px;}
|
|
2
|
+
.ui-slide-verify-copy text,.ui-slide-verify-success-copy text{font-size:12px;line-height:18px;color:var(--cso-ui-text);}
|
|
3
|
+
.ui-slide-verify-track{position:absolute;left:0;top:0;height:100%;background-color:var(--cso-ui-success);border-radius:8px;overflow:hidden;transition:width 300ms ease;}
|
|
4
|
+
.ui-slide-verify-success-copy{position:absolute;left:0;top:0;height:100%;display:flex;align-items:center;justify-content:center;pointer-events:none;}
|
|
5
|
+
.ui-slide-verify-success-copy text{color:#fff;white-space:nowrap;}
|
|
6
|
+
.ui-slide-verify-button{position:absolute;left:0;top:0;display:flex;align-items:center;justify-content:center;border:1px solid var(--cso-ui-surface-muted);border-radius:8px;background-color:var(--cso-ui-surface);box-shadow:0 2px 8px rgba(0,0,0,.15);transition:transform 300ms ease;}
|
|
7
|
+
.ui-slide-verify-disabled{opacity:.4;}
|
package/dist/slider.css
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.ui-slider { position: relative; display: flex; align-items: center; }
|
|
2
|
+
.ui-slider-horizontal { width: 100%; flex-direction: row; }
|
|
3
|
+
.ui-slider-rail { position: relative; flex: 1; height: 22px; min-width: 0; }
|
|
4
|
+
.ui-slider-track { position: absolute; top: 10px; left: 0; right: 0; height: 2px; border-radius: 9999px; background-color: var(--cso-ui-line); }
|
|
5
|
+
.ui-slider-fill { position: absolute; top: 0; height: 100%; border-radius: 9999px; background-color: var(--cso-ui-primary); }
|
|
6
|
+
.ui-slider-thumb { position: absolute; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%); z-index: 2; }
|
|
7
|
+
.ui-slider-handle { width: 24px; height: 24px; border-radius: 12px; background-color: var(--cso-ui-control-surface, var(--cso-ui-surface)); box-shadow: 0 2px 8px rgba(0,0,0,.1); display: flex; flex-direction: row; align-items: center; justify-content: center; }
|
|
8
|
+
.ui-slider-grip { width: 4px; height: 4px; border-left-width: 1px; border-left-style: solid; border-left-color: var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); }
|
|
9
|
+
.ui-slider-grip-left { transform: rotate(45deg); margin-right: 3px; }
|
|
10
|
+
.ui-slider-grip-right { transform: rotate(225deg); }
|
|
11
|
+
.ui-slider-tooltip { position: absolute; bottom: 27px; left: 50%; display: flex; flex-direction: column; align-items: center; opacity: 0; transform: translateX(-50%) scale(0); transform-origin: center bottom; transition: opacity 300ms ease, transform 300ms ease; }
|
|
12
|
+
.ui-slider-tooltip text { padding: 6px 12px; border-radius: 4px; background-color: rgba(0,0,0,.75); font-size: 14px; line-height: 20px; color: #fff; }
|
|
13
|
+
.ui-slider-tooltip-arrow { width: 0; height: 0; border-left-width: 6px; border-left-style: solid; border-left-color: transparent; border-right-width: 6px; border-right-style: solid; border-right-color: transparent; border-top-width: 6px; border-top-style: solid; border-top-color: rgba(0,0,0,.75); }
|
|
14
|
+
.ui-slider-thumb-active { z-index: 3; }
|
|
15
|
+
.ui-slider-thumb-active .ui-slider-tooltip { opacity: 1; transform: translateX(-50%) scale(1); transition: opacity 200ms cubic-bezier(.34,1.56,.64,1), transform 200ms cubic-bezier(.34,1.56,.64,1); }
|
|
16
|
+
.ui-slider-extreme { font-size: 14px; line-height: 20px; color: var(--cso-ui-text-muted); flex-shrink: 0; }
|
|
17
|
+
.ui-slider-horizontal.ui-slider-extremes .ui-slider-rail { margin: 0 12px; }
|
|
18
|
+
.ui-slider-capsule .ui-slider-rail { height: 24px; border-radius: 9999px; background-color: var(--cso-ui-line); }
|
|
19
|
+
.ui-slider-capsule .ui-slider-track { top: 3px; left: 3px; right: 3px; height: 18px; background-color: transparent; }
|
|
20
|
+
.ui-slider-disabled { opacity: .4; }
|
|
21
|
+
.ui-slider-disabled .ui-slider-fill { opacity: .4; }
|
|
22
|
+
.ui-slider-disabled .ui-slider-handle { opacity: .4; transform: scale(.5); }
|
|
23
|
+
.ui-slider-mark { position: absolute; top: 50%; width: 6px; height: 6px; border-radius: 3px; background-color: var(--cso-ui-line); transform: translate(-50%,-50%); }
|
|
24
|
+
.ui-slider-mark-selected { background-color: var(--cso-ui-primary); }
|
|
25
|
+
.ui-slider-mark-label { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 14px; line-height: 20px; color: var(--cso-ui-text); white-space: nowrap; }
|
|
26
|
+
.ui-slider-horizontal.ui-slider-marked { padding-bottom: 20px; }
|
|
27
|
+
.ui-slider-capsule .ui-slider-mark { top: -3px; width: 2px; height: 24px; border-radius: 0; transform: translateX(-50%); background-color: var(--cso-ui-line); }
|
|
28
|
+
.ui-slider-capsule .ui-slider-mark-edge { background-color: transparent; }
|
|
29
|
+
.ui-slider-capsule .ui-slider-mark-label { top: 28px; }
|
|
30
|
+
.ui-slider-horizontal.ui-slider-capsule.ui-slider-marked { padding-bottom: 24px; }
|
|
31
|
+
.ui-slider-vertical { flex-direction: column; width: 26px; flex-shrink: 0; }
|
|
32
|
+
.ui-slider-vertical .ui-slider-rail { width: 2px; height: auto; min-height: 0; margin: 0 12px; }
|
|
33
|
+
.ui-slider-vertical .ui-slider-track { top: 0; bottom: 0; left: 0; right: 0; height: auto; }
|
|
34
|
+
.ui-slider-vertical .ui-slider-fill { left: 0; width: 100%; }
|
|
35
|
+
.ui-slider-vertical .ui-slider-thumb { left: 50%; }
|
|
36
|
+
.ui-slider-vertical .ui-slider-handle { transform: rotate(90deg); }
|
|
37
|
+
.ui-slider-vertical.ui-slider-extremes .ui-slider-rail { margin-top: 12px; margin-bottom: 12px; }
|
|
38
|
+
.ui-slider-vertical .ui-slider-tooltip { bottom: auto; top: 50%; left: 27px; flex-direction: row-reverse; transform: translateY(-50%) scale(0); transform-origin: left center; }
|
|
39
|
+
.ui-slider-vertical .ui-slider-thumb-active .ui-slider-tooltip { transform: translateY(-50%) scale(1); }
|
|
40
|
+
.ui-slider-vertical .ui-slider-tooltip-arrow { border-left-width: 0; border-right-color: rgba(0,0,0,.75); border-top-color: transparent; border-bottom-width: 6px; border-bottom-style: solid; border-bottom-color: transparent; }
|
|
41
|
+
.ui-slider-vertical.ui-slider-capsule { width: 24px; }
|
|
42
|
+
.ui-slider-vertical.ui-slider-capsule .ui-slider-rail { width: 24px; margin-left: 0; margin-right: 0; }
|
|
43
|
+
.ui-slider-vertical.ui-slider-capsule .ui-slider-track { left: 3px; right: 3px; top: 3px; bottom: 3px; height: auto; }
|
|
44
|
+
.ui-slider-vertical .ui-slider-mark { left: 50%; }
|
|
45
|
+
.ui-slider-vertical .ui-slider-mark-label { top: 50%; left: auto; right: 20px; transform: translateY(-50%); text-align: right; }
|
|
46
|
+
.ui-slider-vertical.ui-slider-marked { width: 46px; padding-left: 20px; }
|
|
47
|
+
.ui-slider-vertical.ui-slider-capsule.ui-slider-marked { width: 48px; padding-left: 24px; }
|
|
48
|
+
.ui-slider-vertical.ui-slider-capsule .ui-slider-mark { left: -3px; width: 24px; height: 2px; transform: translateY(-50%); }
|
|
49
|
+
.ui-slider-vertical.ui-slider-capsule .ui-slider-mark-label { right: 28px; }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SliderValue = number | readonly [number, number];
|
|
2
|
+
export declare function sliderBounds(min: number, max: number, step: number): {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
step: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function snapSliderValue(value: number, min: number, max: number, step: number): number;
|
|
8
|
+
export declare function normalizeSliderValue(value: SliderValue, min: number, max: number, step: number): SliderValue;
|
|
9
|
+
export declare function moveSliderValue(value: SliderValue, candidate: number, index: number, min: number, max: number, step: number): SliderValue;
|
|
10
|
+
export declare function sameSliderValue(first: SliderValue, second: SliderValue): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function sliderBounds(min, max, step) {
|
|
2
|
+
const lower = Number.isFinite(min) ? min : 0;
|
|
3
|
+
return { min: lower, max: Number.isFinite(max) && max > lower ? max : lower + 100, step: Number.isFinite(step) && step > 0 ? step : 1 };
|
|
4
|
+
}
|
|
5
|
+
export function snapSliderValue(value, min, max, step) {
|
|
6
|
+
if (!Number.isFinite(value) || value <= min)
|
|
7
|
+
return min;
|
|
8
|
+
if (value >= max)
|
|
9
|
+
return max;
|
|
10
|
+
return Math.min(max, Math.max(min, Number((min + Math.round((value - min) / step) * step).toFixed(10))));
|
|
11
|
+
}
|
|
12
|
+
export function normalizeSliderValue(value, min, max, step) {
|
|
13
|
+
const snap = (item) => snapSliderValue(item, min, max, step);
|
|
14
|
+
if (typeof value === 'number')
|
|
15
|
+
return snap(value);
|
|
16
|
+
const first = snap(value[0]), second = snap(value[1]);
|
|
17
|
+
return first <= second ? [first, second] : [second, first];
|
|
18
|
+
}
|
|
19
|
+
export function moveSliderValue(value, candidate, index, min, max, step) {
|
|
20
|
+
const next = snapSliderValue(candidate, min, max, step);
|
|
21
|
+
if (typeof value === 'number')
|
|
22
|
+
return next;
|
|
23
|
+
return index === 0 ? [Math.min(next, value[1]), value[1]] : [value[0], Math.max(next, value[0])];
|
|
24
|
+
}
|
|
25
|
+
export function sameSliderValue(first, second) {
|
|
26
|
+
return typeof first === 'number' || typeof second === 'number' ? first === second : first[0] === second[0] && first[1] === second[1];
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.ui-sort-button { position: relative; align-self: flex-start; height: 48px; display: flex; flex-direction: row; align-items: center; justify-content: center; }
|
|
2
|
+
.ui-sort-button-title { font-size: 14px; line-height: 20px; color: var(--cso-ui-text-secondary, var(--cso-ui-text-muted)); }
|
|
3
|
+
.ui-sort-button-arrows { position: relative; margin-left: 6px; width: 16px; height: 16px; }
|
|
4
|
+
.ui-sort-button-arrow { position: absolute; left: 2px; top: -1px; width: 12px; height: 12px; }
|
|
5
|
+
.ui-sort-button-arrow + .ui-sort-button-arrow { top: 5px; }
|
|
6
|
+
.ui-sort-button-caret { position: absolute; left: 2.5px; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; }
|
|
7
|
+
.ui-sort-button-caret-up { top: 3px; border-bottom: 5px solid var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); }
|
|
8
|
+
.ui-sort-button-caret-down { top: 4px; border-top: 5px solid var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); }
|
|
9
|
+
.ui-sort-button-arrow-active .ui-sort-button-caret-up { border-bottom-color: var(--cso-ui-primary); }
|
|
10
|
+
.ui-sort-button-arrow-active .ui-sort-button-caret-down { border-top-color: var(--cso-ui-primary); }
|
|
11
|
+
.ui-sort-button-active .ui-sort-button-title { color: var(--cso-ui-primary); }
|
|
12
|
+
.ui-sort-button-indicator { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background-color: var(--cso-ui-primary); }
|
package/dist/steps.css
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.ui-steps{display:flex;flex-direction:row;width:100%;}
|
|
2
|
+
.ui-steps-vertical{flex-direction:column;}
|
|
3
|
+
.ui-step{position:relative;flex-shrink:0;}
|
|
4
|
+
.ui-step-header{position:relative;height:18px;display:flex;flex-direction:row;align-items:flex-start;}
|
|
5
|
+
.ui-step-indicator{position:relative;z-index:1;display:flex;align-items:center;justify-content:center;}
|
|
6
|
+
.ui-step-circle{width:18px;height:18px;border-radius:9999px;display:flex;align-items:center;justify-content:center;box-sizing:border-box;}
|
|
7
|
+
.ui-step-number{font-size:12px;line-height:18px;font-weight:600;color:var(--cso-ui-text-muted);}
|
|
8
|
+
.ui-step-line{position:absolute;left:26px;top:50%;height:1px;width:calc(100% - 34px);background:var(--cso-ui-line);}
|
|
9
|
+
.ui-step-dot{width:10px;height:10px;border-radius:50%;box-sizing:border-box;background:var(--cso-ui-line);}
|
|
10
|
+
.ui-step-content{margin-top:4px;display:flex;flex-direction:column;}
|
|
11
|
+
.ui-step-title-text{font-size:14px;line-height:20px;font-weight:400;color:var(--cso-ui-text-muted);}
|
|
12
|
+
.ui-step-description{margin-top:4px;padding:0 2px;}
|
|
13
|
+
.ui-step-description-text{font-size:12px;line-height:18px;color:var(--cso-ui-text-muted);}
|
|
14
|
+
.ui-step-process .ui-step-circle{background:var(--cso-ui-primary);}
|
|
15
|
+
.ui-step-process .ui-step-number{color:#fff;}
|
|
16
|
+
.ui-step-process .ui-step-title-text{color:var(--cso-ui-primary);}
|
|
17
|
+
.ui-step-finished .ui-step-circle{background:var(--cso-ui-step-finished-bg,#f5f8ff);border:1px solid var(--cso-ui-primary);}
|
|
18
|
+
.ui-step-finished .ui-step-line{background:var(--cso-ui-primary);}
|
|
19
|
+
.ui-step-wait .ui-step-circle{background:var(--cso-ui-line);}
|
|
20
|
+
.ui-step-error .ui-step-circle,.ui-step-error .ui-step-dot{background:var(--cso-ui-danger);}
|
|
21
|
+
.ui-step-error .ui-step-title-text{color:var(--cso-ui-danger);}
|
|
22
|
+
.ui-step-finished .ui-step-dot{background:var(--cso-ui-step-dot-finished-bg,#b8cfff);border:1px solid var(--cso-ui-primary);}
|
|
23
|
+
.ui-step-process .ui-step-dot{background:var(--cso-ui-primary);border:1px solid var(--cso-ui-step-dot-finished-bg,#b8cfff);}
|
|
24
|
+
.ui-step-center .ui-step-header{justify-content:center;}
|
|
25
|
+
.ui-step-center .ui-step-title-text,.ui-step-center .ui-step-description-text{text-align:center;}
|
|
26
|
+
.ui-step-center .ui-step-line{left:calc(50% + 17px);}
|
|
27
|
+
.ui-step-dotted .ui-step-header{height:10px;}
|
|
28
|
+
.ui-step-dotted .ui-step-line{left:18px;width:calc(100% - 26px);}
|
|
29
|
+
.ui-step-dotted.ui-step-center .ui-step-line{left:calc(50% + 13px);}
|
|
30
|
+
.ui-step-vertical .ui-step-header{position:absolute;left:0;top:0;width:18px;height:100%;}
|
|
31
|
+
.ui-step-vertical .ui-step-content{margin-left:32px;margin-top:0;padding-bottom:20px;min-height:18px;}
|
|
32
|
+
.ui-step-vertical .ui-step-line{top:26px;left:50%;width:1px;height:calc(100% - 34px);transform:scaleX(.5);}
|
|
33
|
+
.ui-step-vertical.ui-step-dotted .ui-step-header{top:6px;}
|
|
34
|
+
.ui-step-vertical.ui-step-dotted .ui-step-indicator{width:18px;}
|
|
35
|
+
.ui-step-vertical.ui-step-dotted .ui-step-line{top:18px;left:50%;height:calc(100% - 26px);}
|
package/dist/sticky.css
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
.ui-sticky{position:relative;display:flex;flex-direction:column;align-self:flex-start;align-items:flex-start;min-width:1px;min-height:1px;flex-shrink:0;}
|
|
2
|
+
.ui-sticky-container,.ui-sticky-content{display:flex;flex-direction:column;align-items:flex-start;align-self:flex-start;flex-shrink:0;min-width:1px;min-height:1px;}
|
|
3
|
+
.ui-sticky-box{position:relative;display:flex;flex-direction:column;}
|
|
4
|
+
|
|
5
|
+
.ui-sticky,.ui-sticky-box{overflow:visible;}
|
|
6
|
+
/* A prefix ending at the anchor bottom catches jumps across the whole viewport. */
|
|
7
|
+
.ui-sticky-sentinel{position:absolute;left:0;top:calc(100% - 1000000px);width:1px;height:1000000px;pointer-events:none;}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
@import './config-provider.css';
|
|
2
|
+
@import './button.css';
|
|
3
|
+
@import './keyboard.css';
|
|
4
|
+
@import './password-input.css';
|
|
5
|
+
@import './cell.css';
|
|
6
|
+
@import './slider.css';
|
|
7
|
+
@import './text.css';
|
|
8
|
+
@import './layout.css';
|
|
9
|
+
@import './icon.css';
|
|
10
|
+
@import './resize.css';
|
|
11
|
+
@import './transition.css';
|
|
12
|
+
|
|
13
|
+
:root { --cso-ui-canvas:#f5f7fa; --cso-ui-surface:#fff; --cso-ui-surface-muted:#f8fafc; --cso-ui-text:#17212e; --cso-ui-text-muted:#697586; --cso-ui-line:#e6eaf0; --cso-ui-primary:#f86100; --cso-ui-on-primary:#fff; --cso-ui-success:#1f9d67; --cso-ui-info:#236fd4; --cso-ui-warning:#b86b00; --cso-ui-danger:#d63b47; --cso-ui-hero:#17212e; --cso-ui-hero-text:#fff; --cso-ui-hero-muted:#d5dbe4; }
|
|
14
|
+
.theme-dark { --cso-ui-canvas:#10151c; --cso-ui-surface:#171e27; --cso-ui-surface-muted:#202936; --cso-ui-text:#f3f6fa; --cso-ui-text-muted:#aeb9c8; --cso-ui-line:#303b4a; --cso-ui-primary:#ff812e; --cso-ui-on-primary:#16110d; --cso-ui-success:#56c891; --cso-ui-info:#78aeff; --cso-ui-warning:#f0b450; --cso-ui-danger:#ff7f8a; --cso-ui-hero:#0c1117; --cso-ui-hero-text:#f7f9fc; --cso-ui-hero-muted:#b4c0d0; }
|
|
15
|
+
.ui-card{margin-bottom:12px;border-width:1px;border-style:solid;border-color:var(--cso-ui-line);border-radius:8px;background-color:var(--cso-ui-surface);overflow:hidden;}.ui-card-header{padding:16px 16px 0;display:flex;flex-direction:column;}.ui-card-title{font-size:16px;line-height:22px;font-weight:700;color:var(--cso-ui-text);}.ui-card-description{margin-top:4px;font-size:12px;line-height:18px;color:var(--cso-ui-text-muted);}.ui-card-body{padding:16px;}.ui-card-header + .ui-card-body{padding-top:12px;}.ui-card-footer{padding:12px 16px;border-top-width:1px;border-top-style:solid;border-top-color:var(--cso-ui-line);}.ui-section-title{margin:24px 0 12px;display:flex;flex-direction:column;}.ui-section-eyebrow{font-size:11px;line-height:16px;color:var(--cso-ui-primary);font-weight:700;}.ui-section-heading{margin-top:3px;font-size:20px;line-height:28px;color:var(--cso-ui-text);font-weight:700;}.ui-section-description{margin-top:4px;font-size:13px;line-height:20px;color:var(--cso-ui-text-muted);}
|
|
16
|
+
.ui-collapse{background-color:transparent;display:flex;flex-direction:column;}.ui-collapse-item{background-color:var(--cso-ui-surface);border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--cso-ui-line);}.ui-collapse-item-last{border-bottom-width:0;}.ui-collapse-header{min-height:56px;padding:0 16px;display:flex;flex-direction:row;align-items:center;}.ui-collapse-icon{width:26px;margin-right:7px;font-size:18px;line-height:22px;color:var(--cso-ui-primary);text-align:center;}.ui-collapse-title{flex:1;font-size:16px;line-height:24px;color:var(--cso-ui-text);font-weight:400;}.ui-collapse-chevron{margin-left:10px;font-size:15px;line-height:20px;color:var(--cso-ui-text-muted);transform:rotate(0deg);transition:transform 300ms ease;}.ui-collapse-item-expanded .ui-collapse-chevron{transform:rotate(-180deg);}.ui-collapse-region{height:0;overflow:hidden;transition:height 300ms ease-in-out;}.ui-collapse-body{width:100%;padding:12px 16px;display:flex;flex-direction:column;flex-shrink:0;}.ui-collapse-item-disabled{opacity:.45;}.ui-collapse-view-more{display:flex;flex-direction:column;}.ui-collapse-view-more-text{font-size:14px;line-height:22px;color:var(--cso-ui-text-muted);}.ui-collapse-view-more-action{align-self:flex-start;margin-top:8px;}.ui-collapse-view-more-action text{font-size:13px;line-height:19px;color:var(--cso-ui-primary);font-weight:600;}
|
|
17
|
+
.ui-empty-state{min-height:180px;padding:24px 16px;display:flex;flex-direction:column;align-items:center;justify-content:center;}.ui-empty-mark{width:54px;height:42px;border-width:2px;border-style:solid;border-color:var(--cso-ui-line);border-radius:7px;background-color:var(--cso-ui-surface-muted);display:flex;align-items:center;justify-content:center;}.ui-empty-mark-line{width:22px;height:3px;border-radius:2px;background-color:var(--cso-ui-line);}.ui-empty-title{margin-top:13px;font-size:15px;line-height:22px;color:var(--cso-ui-text);font-weight:600;}.ui-empty-description{margin-top:4px;font-size:12px;line-height:18px;color:var(--cso-ui-text-muted);text-align:center;}.ui-empty-action{margin-top:14px;}
|
|
18
|
+
.ui-tabs{height:40px;padding:3px;background-color:var(--cso-ui-surface-muted);border-radius:8px;display:flex;flex-direction:row;}.ui-tab{flex:1;display:flex;align-items:center;justify-content:center;border-radius:6px;}.ui-tab text{font-size:13px;line-height:18px;color:var(--cso-ui-text-muted);font-weight:600;}.ui-tab-active{background-color:var(--cso-ui-surface);}.ui-tab-active text{color:var(--cso-ui-primary);}.ui-tab-disabled{opacity:.42;}
|
|
19
|
+
@import './root-portal.css';
|
|
20
|
+
@import './fab.css';
|
|
21
|
+
@import './navbar.css';
|
|
22
|
+
@import './pagination.css';
|
|
23
|
+
@import './tabbar.css';
|
|
24
|
+
@import './segmented.css';
|
|
25
|
+
@import './sidebar.css';
|
|
26
|
+
@import './index-bar.css';
|
|
27
|
+
@import './backtop.css';
|
|
28
|
+
@import './divider.css';
|
|
29
|
+
@import './gap.css';
|
|
30
|
+
@import './badge.css';
|
|
31
|
+
@import './avatar.css';
|
|
32
|
+
@import './tag.css';
|
|
33
|
+
@import './loading.css';
|
|
34
|
+
|
|
35
|
+
@import './loadmore.css';
|
|
36
|
+
|
|
37
|
+
@import './overlay.css';
|
|
38
|
+
|
|
39
|
+
@import './popup.css';
|
|
40
|
+
|
|
41
|
+
@import './action-sheet.css';
|
|
42
|
+
|
|
43
|
+
@import './dialog.css';
|
|
44
|
+
|
|
45
|
+
@import './switch.css';
|
|
46
|
+
|
|
47
|
+
@import './rate.css';
|
|
48
|
+
|
|
49
|
+
@import './sort-button.css';
|
|
50
|
+
|
|
51
|
+
@import './drop-menu.css';
|
|
52
|
+
|
|
53
|
+
@import './bubble.css';
|
|
54
|
+
|
|
55
|
+
@import './toast.css';
|
|
56
|
+
|
|
57
|
+
@import './popover.css';
|
|
58
|
+
|
|
59
|
+
@import './floating-panel.css';
|
|
60
|
+
|
|
61
|
+
@import './swipe-action.css';
|
|
62
|
+
|
|
63
|
+
@import './tabs.css';
|
|
64
|
+
|
|
65
|
+
@import './tour.css';
|
|
66
|
+
|
|
67
|
+
@import './text-field.css';
|
|
68
|
+
|
|
69
|
+
@import './input-number.css';
|
|
70
|
+
|
|
71
|
+
@import './search.css';
|
|
72
|
+
|
|
73
|
+
@import './form.css';
|
|
74
|
+
|
|
75
|
+
@import './choice.css';
|
|
76
|
+
|
|
77
|
+
@import './picker.css';
|
|
78
|
+
|
|
79
|
+
@import './calendar.css';
|
|
80
|
+
|
|
81
|
+
@import './cascader.css';
|
|
82
|
+
|
|
83
|
+
@import './upload.css';
|
|
84
|
+
|
|
85
|
+
@import './slide-verify.css';
|
|
86
|
+
|
|
87
|
+
@import './datetime-picker.css';
|
|
88
|
+
|
|
89
|
+
@import './progress.css';
|
|
90
|
+
|
|
91
|
+
@import './circle.css';
|
|
92
|
+
|
|
93
|
+
@import './notify.css';
|
|
94
|
+
|
|
95
|
+
@import './signature.css';
|
|
96
|
+
|
|
97
|
+
@import './grid.css';
|
|
98
|
+
|
|
99
|
+
@import './count-down.css';
|
|
100
|
+
|
|
101
|
+
@import './count-to.css';
|
|
102
|
+
|
|
103
|
+
@import './img.css';
|
|
104
|
+
|
|
105
|
+
@import './empty.css';
|
|
106
|
+
|
|
107
|
+
@import './notice-bar.css';
|
|
108
|
+
|
|
109
|
+
@import './card.css';
|
|
110
|
+
|
|
111
|
+
@import './skeleton.css';
|
|
112
|
+
|
|
113
|
+
@import './steps.css';
|
|
114
|
+
|
|
115
|
+
@import './sticky.css';
|
|
116
|
+
|
|
117
|
+
@import './curtain.css';
|
|
118
|
+
|
|
119
|
+
@import './watermark.css';
|
|
120
|
+
|
|
121
|
+
@import './swiper.css';
|
|
122
|
+
|
|
123
|
+
@import './image-preview.css';
|
|
124
|
+
|
|
125
|
+
@import './table.css';
|
|
126
|
+
|
|
127
|
+
@import './bar-code.css';
|
|
128
|
+
|
|
129
|
+
@import './qr-code.css';
|
|
130
|
+
|
|
131
|
+
@import './rich-text.css';
|
|
132
|
+
|
|
133
|
+
@import './legacy-controls.css';
|
|
134
|
+
|
|
135
|
+
@import './video-preview.css';
|
|
136
|
+
@import './img-cropper.css';
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
.ui-swipe-action { width: 100%; overflow: hidden; }
|
|
2
|
+
.ui-swipe-track { position: relative; width: 100%; display: flex; flex-direction: column; transition-property: transform; transition-timing-function: cubic-bezier(.18,.89,.32,1); }
|
|
3
|
+
.ui-swipe-body { width: 100%; display: flex; flex-direction: column; }
|
|
4
|
+
.ui-swipe-side { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: row; }
|
|
5
|
+
.ui-swipe-left { left: 0; transform: translateX(-100%); }
|
|
6
|
+
.ui-swipe-right { right: 0; transform: translateX(100%); }
|
package/dist/swiper.css
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.ui-swiper{position:relative;width:100%;overflow:visible;flex-shrink:0;}
|
|
2
|
+
.ui-swiper-native{overflow:visible;}
|
|
3
|
+
.ui-swiper-item{position:relative;display:flex;align-items:center;justify-content:center;overflow:visible;box-sizing:border-box;}
|
|
4
|
+
.ui-swiper-title{position:absolute;top:12px;right:12px;font-size:14px;line-height:20px;color:#fff;text-shadow:0 0 4px #000;}
|
|
5
|
+
.ui-swiper-indicator{position:absolute;display:flex;flex-direction:row;align-items:center;z-index:2;}
|
|
6
|
+
.ui-swiper-indicator-left{left:8px;top:50%;transform:translateY(-50%);}
|
|
7
|
+
.ui-swiper-indicator-right{right:8px;top:50%;transform:translateY(-50%);}
|
|
8
|
+
.ui-swiper-indicator-top-left{top:8px;left:8px;}
|
|
9
|
+
.ui-swiper-indicator-top{left:50%;top:8px;transform:translateX(-50%);}
|
|
10
|
+
.ui-swiper-indicator-top-right{top:8px;right:8px;}
|
|
11
|
+
.ui-swiper-indicator-bottom-left{left:8px;bottom:8px;}
|
|
12
|
+
.ui-swiper-indicator-bottom{left:50%;bottom:8px;transform:translateX(-50%);}
|
|
13
|
+
.ui-swiper-indicator-bottom-right{right:8px;bottom:8px;}
|
|
14
|
+
.ui-swiper-dot{width:6px;height:6px;margin:0 4px;border-radius:9999px;background:var(--cso-ui-swiper-dot-color,#c9cbd4);transition:width 400ms ease-in,background-color 400ms ease-in;}
|
|
15
|
+
.ui-swiper-dot-active{background:var(--cso-ui-swiper-dot-active-color,#fff);}
|
|
16
|
+
.ui-swiper-dot-bar.ui-swiper-dot-active{width:15px;}
|
|
17
|
+
.ui-swiper-indicator-fraction{padding:2px 6px;background:rgba(0,0,0,.55);border-radius:4px;}
|
|
18
|
+
.ui-swiper-fraction{font-size:14px;line-height:18px;color:#fff;}
|
|
19
|
+
.ui-swiper-control{position:absolute;top:50%;transform:translateY(-50%);width:24px;height:24px;border-radius:9999px;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;z-index:2;}
|
|
20
|
+
.ui-swiper-control-prev{left:12px;}.ui-swiper-control-next{right:12px;}
|
|
21
|
+
|
|
22
|
+
.ui-swiper-clip{width:100%;height:100%;overflow:hidden;}
|
|
23
|
+
|
|
24
|
+
.ui-swiper-image{transition:height 300ms ease;}
|
|
25
|
+
|
|
26
|
+
.ui-swiper-measure{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;}
|
|
27
|
+
.ui-swiper-card-motion .ui-swiper-image{transition:none;}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Same pure calculation is used for the first frame and native offset updates. */
|
|
2
|
+
export function swiperCardFrame(value, height, neighborHeight) {
|
|
3
|
+
const weight = Math.max(0, 1 - Math.abs(Math.abs(value) - 1));
|
|
4
|
+
const size = height - (height - neighborHeight) * weight;
|
|
5
|
+
return { height: `${size}px`, transform: `translateY(${(height - size) / 2}px)` };
|
|
6
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export function swiperIndex(value, count, loop) { if (count <= 0)
|
|
2
|
+
return 0; const index = Number.isFinite(value) ? Math.trunc(value) : 0; return loop ? ((index % count) + count) % count : Math.max(0, Math.min(count - 1, index)); }
|
|
3
|
+
export function swiperNumber(value, fallback, min = 0, max = Infinity) { return typeof value === 'number' && Number.isFinite(value) ? Math.min(max, Math.max(min, value)) : fallback; }
|
package/dist/switch.css
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.ui-switch { --ui-switch-size: 26px; align-self: flex-start; position: relative; min-width: calc(var(--ui-switch-size) * 1.8 + 4px); height: calc(var(--ui-switch-size) + 4px); padding: 2px 8px 2px calc(var(--ui-switch-size) + 2px); background-color: var(--cso-ui-line-strong, #c9cbd4); display: flex; flex-direction: row; align-items: center; transition: background-color 200ms ease; }
|
|
2
|
+
.ui-switch-round { border-radius: 9999px; }
|
|
3
|
+
.ui-switch-square { border-radius: 2px; }
|
|
4
|
+
.ui-switch-active { background-color: var(--cso-ui-primary); padding-left: 8px; padding-right: calc(var(--ui-switch-size) + 2px); }
|
|
5
|
+
.ui-switch-label { min-width: 0; display: flex; flex-direction: row; align-items: center; margin-left: 4px; }
|
|
6
|
+
.ui-switch-active .ui-switch-label { margin-left: 0; margin-right: 4px; }
|
|
7
|
+
.ui-switch-label text { color: #fff; font-size: 14px; line-height: var(--ui-switch-size); }
|
|
8
|
+
.ui-switch-action { position: absolute; top: 2px; left: 2px; width: var(--ui-switch-size); height: var(--ui-switch-size); border-radius: 9999px; background-color: #fff; display: flex; flex-direction: row; align-items: center; justify-content: center; transition: left 200ms ease; }
|
|
9
|
+
.ui-switch-action .ui-loading { align-self: center; flex-shrink: 0; }
|
|
10
|
+
.ui-switch-active .ui-switch-action { left: calc(100% - var(--ui-switch-size) - 2px); }
|
|
11
|
+
.ui-switch-square .ui-switch-action { border-radius: 2px; }
|
|
12
|
+
.ui-switch-disabled { opacity: .4; }
|
package/dist/tabbar.css
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.ui-tabbar { position: relative; display: flex; flex-direction: row; align-items: center; flex-wrap: nowrap; flex-shrink: 0; background-color: var(--cso-ui-surface); box-sizing: border-box; }
|
|
2
|
+
.ui-tabbar-bordered { border-top: .5px solid var(--cso-ui-line); }
|
|
3
|
+
.ui-tabbar-round { margin-left: 16px; margin-right: 16px; border-radius: 999px; box-shadow: 0 5px 5px -3px rgba(0,0,0,.08), 0 8px 10px 1px rgba(0,0,0,.04), 0 3px 14px 2px rgba(0,0,0,.04); }
|
|
4
|
+
.ui-tabbar-fixed { position: fixed; left: 0; right: 0; }
|
|
5
|
+
.ui-tabbar-item { position: relative; flex: 1; height: 50px; display: flex; justify-content: center; align-items: center; }
|
|
6
|
+
.ui-tabbar-item-body { position: relative; display: flex; flex-direction: column; align-items: center; }
|
|
7
|
+
.ui-tabbar-item-icon { position: relative; height: 24px; display: flex; align-items: center; justify-content: center; }
|
|
8
|
+
.ui-tabbar-item-title { font-size: 10px; line-height: 16px; color: var(--cso-ui-text); text-align: center; }
|
|
9
|
+
.ui-tabbar-item-active .ui-tabbar-item-title { color: var(--cso-ui-primary); }
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
.ui-tabbar-placeholder { flex-shrink: 0; }
|
|
14
|
+
.ui-badge.ui-tabbar-item-icon { align-self: center; }
|
|
15
|
+
|
|
16
|
+
.ui-tabbar-icon-light{display:var(--cso-ui-light-display,flex);}
|
|
17
|
+
.ui-tabbar-icon-dark{display:var(--cso-ui-dark-display,none);}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type TabbarValue = string | number;
|
|
2
|
+
export type TabbarBeforeChange = (value: TabbarValue) => boolean | Promise<boolean>;
|
|
3
|
+
/** Only the latest request may commit; false, rejection and disposal cancel it. */
|
|
4
|
+
export declare function createTabbarGuard(): {
|
|
5
|
+
cancel(): void;
|
|
6
|
+
request(value: TabbarValue, before: TabbarBeforeChange | undefined, commit: () => void): Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare function tabbarBadge(value: string | number | undefined, max?: number): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Only the latest request may commit; false, rejection and disposal cancel it. */
|
|
2
|
+
export function createTabbarGuard() {
|
|
3
|
+
let sequence = 0;
|
|
4
|
+
return {
|
|
5
|
+
cancel() {
|
|
6
|
+
'background only';
|
|
7
|
+
sequence++;
|
|
8
|
+
},
|
|
9
|
+
async request(value, before, commit) {
|
|
10
|
+
'background only';
|
|
11
|
+
const request = ++sequence;
|
|
12
|
+
try {
|
|
13
|
+
const result = before ? before(value) : true;
|
|
14
|
+
const allowed = typeof result === 'boolean' ? result : await result;
|
|
15
|
+
if (allowed && request === sequence)
|
|
16
|
+
commit();
|
|
17
|
+
}
|
|
18
|
+
catch { /* A failed confirmation must leave the selection unchanged. */ }
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function tabbarBadge(value, max = 99) {
|
|
23
|
+
if (value === undefined || value === '')
|
|
24
|
+
return '';
|
|
25
|
+
const ceiling = Number.isFinite(max) ? Math.max(0, max) : 99;
|
|
26
|
+
return typeof value === 'number' && value > ceiling ? `${ceiling}+` : String(value);
|
|
27
|
+
}
|
package/dist/table.css
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.ui-table{position:relative;width:100%;overflow:hidden;background-color:var(--cso-ui-surface);}
|
|
2
|
+
.ui-table-border{border:1px solid var(--cso-ui-line);}
|
|
3
|
+
.ui-table-measures{position:relative;width:100%;pointer-events:none;}
|
|
4
|
+
.ui-table-measure{position:absolute;top:0;left:0;pointer-events:none;}
|
|
5
|
+
.ui-table-header,.ui-table-body{position:relative;width:100%;}
|
|
6
|
+
.ui-table-header{z-index:2;background-color:var(--cso-ui-surface);}
|
|
7
|
+
.ui-table-fixed{position:absolute;top:0;left:0;z-index:1;pointer-events:none;}
|
|
8
|
+
.ui-table-fixed .ui-table-cell{pointer-events:auto;}
|
|
9
|
+
.ui-table-cell{position:absolute;display:flex;flex-direction:row;align-items:center;padding:12px 16px;box-sizing:border-box;background-color:var(--cso-ui-surface);}
|
|
10
|
+
.ui-table-borders{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;border-right:1px solid var(--cso-ui-line);border-bottom:1px solid var(--cso-ui-line);box-sizing:border-box;}
|
|
11
|
+
.ui-table-last-column .ui-table-borders{border-right-width:0;}
|
|
12
|
+
.ui-table-last-row .ui-table-borders{border-bottom-width:0;}
|
|
13
|
+
.ui-table-stripe{background-color:var(--cso-ui-table-stripe-bg,var(--cso-ui-canvas));}
|
|
14
|
+
.ui-table-left{justify-content:flex-start;}
|
|
15
|
+
.ui-table-center{justify-content:center;}
|
|
16
|
+
.ui-table-right{justify-content:flex-end;}
|
|
17
|
+
.ui-table-content{flex-shrink:0;max-width:100%;}
|
|
18
|
+
.ui-table-value{font-size:14px;line-height:20px;color:var(--cso-ui-text);}
|
|
19
|
+
.ui-table-header-cell .ui-sort-button{height:20px;align-self:center;}
|
|
20
|
+
.ui-table-header-cell .ui-sort-button-title{color:var(--cso-ui-text);}
|
|
21
|
+
.ui-table-header-cell .ui-sort-button-active .ui-sort-button-title{color:var(--cso-ui-primary);}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type TableSpan = {
|
|
2
|
+
rowspan: number;
|
|
3
|
+
colspan: number;
|
|
4
|
+
};
|
|
5
|
+
export declare function tableSpan(value: TableSpan | readonly number[] | void, row: number, col: number, rows: number, cols: number): TableSpan;
|
|
6
|
+
export declare function tableRange(count: number, top: number, height: number, rowHeight: number, buffer: number): {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function tableOffsets(sizes: readonly number[]): number[];
|