@ceed/cds 0.0.186 → 0.0.187-treeshaking.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/_virtual/_commonjsHelpers.js +30 -0
- package/dist/_virtual/bind-all.js +3 -0
- package/dist/_virtual/bind.js +3 -0
- package/dist/_virtual/colorManipulator.js +5 -0
- package/dist/_virtual/colorManipulator2.js +3 -0
- package/dist/_virtual/createStyled.js +7 -0
- package/dist/_virtual/createStyled2.js +3 -0
- package/dist/_virtual/extends.js +3 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index10.js +6 -0
- package/dist/_virtual/index11.js +6 -0
- package/dist/_virtual/index12.js +6 -0
- package/dist/_virtual/index2.js +3 -0
- package/dist/_virtual/index3.js +7 -0
- package/dist/_virtual/index4.js +3 -0
- package/dist/_virtual/index5.js +6 -0
- package/dist/_virtual/index6.js +6 -0
- package/dist/_virtual/index7.js +6 -0
- package/dist/_virtual/index8.js +6 -0
- package/dist/_virtual/index9.js +6 -0
- package/dist/_virtual/interopRequireDefault.js +3 -0
- package/dist/_virtual/objectWithoutPropertiesLoose.js +3 -0
- package/dist/components/Accordions/Accordions.js +43 -0
- package/dist/components/Accordions/index.d.ts +2 -2
- package/dist/components/Autocomplete/Autocomplete.js +196 -0
- package/dist/components/Autocomplete/index.d.ts +2 -2
- package/dist/components/Autocomplete/index.js +5 -0
- package/dist/components/Avatar/Avatar.js +42 -0
- package/dist/components/Avatar/index.d.ts +2 -2
- package/dist/components/Box/Box.js +8 -0
- package/dist/components/Box/index.d.ts +2 -2
- package/dist/components/Box/index.js +5 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +47 -0
- package/dist/components/Breadcrumbs/index.d.ts +2 -2
- package/dist/components/Button/Button.js +20 -0
- package/dist/components/Button/index.d.ts +2 -2
- package/dist/components/Button/index.js +5 -0
- package/dist/components/Calendar/Calendar.d.ts +1 -1
- package/dist/components/Calendar/Calendar.js +333 -0
- package/dist/components/Calendar/hooks/use-calendar-props.d.ts +3 -3
- package/dist/components/Calendar/hooks/use-calendar-props.js +74 -0
- package/dist/components/Calendar/hooks/use-calendar.d.ts +1 -1
- package/dist/components/Calendar/hooks/use-calendar.js +247 -0
- package/dist/components/Calendar/index.d.ts +2 -2
- package/dist/components/Calendar/index.js +5 -0
- package/dist/components/Calendar/utils/index.js +74 -0
- package/dist/components/Card/Card.js +20 -0
- package/dist/components/Card/index.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.js +19 -0
- package/dist/components/Checkbox/index.d.ts +2 -2
- package/dist/components/Checkbox/index.js +5 -0
- package/dist/components/Chip/Chip.js +8 -0
- package/dist/components/Chip/index.d.ts +2 -2
- package/dist/components/Chip/index.js +5 -0
- package/dist/components/Container/Container.js +49 -0
- package/dist/components/Container/index.d.ts +2 -2
- package/dist/components/CurrencyInput/CurrencyInput.js +91 -0
- package/dist/components/CurrencyInput/hooks/use-currency-setting.js +167 -0
- package/dist/components/CurrencyInput/index.d.ts +2 -2
- package/dist/components/CurrencyInput/index.js +5 -0
- package/dist/components/DataTable/DataTable.d.ts +1 -1
- package/dist/components/DataTable/DataTable.js +568 -0
- package/dist/components/DataTable/index.d.ts +2 -2
- package/dist/components/DataTable/types.d.ts +7 -7
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.js +210 -0
- package/dist/components/DatePicker/index.d.ts +2 -2
- package/dist/components/DatePicker/index.js +5 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +213 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -2
- package/dist/components/DialogActions/DialogActions.js +14 -0
- package/dist/components/DialogActions/index.d.ts +2 -2
- package/dist/components/DialogActions/index.js +5 -0
- package/dist/components/DialogContent/DialogContent.js +11 -0
- package/dist/components/DialogContent/index.d.ts +2 -2
- package/dist/components/DialogContent/index.js +5 -0
- package/dist/components/DialogFrame/DialogFrame.d.ts +1 -1
- package/dist/components/DialogFrame/DialogFrame.js +31 -0
- package/dist/components/DialogFrame/index.d.ts +2 -2
- package/dist/components/DialogTitle/DialogTitle.js +11 -0
- package/dist/components/DialogTitle/index.d.ts +2 -2
- package/dist/components/DialogTitle/index.js +5 -0
- package/dist/components/Divider/Divider.js +19 -0
- package/dist/components/Divider/index.d.ts +2 -2
- package/dist/components/Drawer/Drawer.js +40 -0
- package/dist/components/Drawer/index.d.ts +2 -2
- package/dist/components/Dropdown/Dropdown.js +8 -0
- package/dist/components/Dropdown/index.d.ts +2 -2
- package/dist/components/Dropdown/index.js +5 -0
- package/dist/components/FormControl/FormControl.js +15 -0
- package/dist/components/FormControl/index.d.ts +2 -2
- package/dist/components/FormControl/index.js +5 -0
- package/dist/components/FormHelperText/FormHelperText.js +8 -0
- package/dist/components/FormHelperText/index.d.ts +2 -2
- package/dist/components/FormHelperText/index.js +5 -0
- package/dist/components/FormLabel/FormLabel.js +8 -0
- package/dist/components/FormLabel/index.d.ts +2 -2
- package/dist/components/FormLabel/index.js +5 -0
- package/dist/components/Grid/index.d.ts +2 -2
- package/dist/components/IconButton/IconButton.js +20 -0
- package/dist/components/IconButton/index.d.ts +2 -2
- package/dist/components/IconButton/index.js +5 -0
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +60 -0
- package/dist/components/Input/index.d.ts +2 -2
- package/dist/components/Input/index.js +5 -0
- package/dist/components/InsetDrawer/InsetDrawer.js +30 -0
- package/dist/components/InsetDrawer/index.d.ts +2 -2
- package/dist/components/Markdown/Markdown.d.ts +6 -22
- package/dist/components/Markdown/Markdown.js +36 -0
- package/dist/components/Markdown/index.d.ts +2 -2
- package/dist/components/Menu/Menu.js +43 -0
- package/dist/components/Menu/index.d.ts +2 -2
- package/dist/components/Menu/index.js +6 -0
- package/dist/components/MenuButton/MenuButton.js +26 -0
- package/dist/components/Modal/Modal.d.ts +4 -4
- package/dist/components/Modal/Modal.js +43 -0
- package/dist/components/Modal/index.d.ts +2 -2
- package/dist/components/MonthPicker/MonthPicker.d.ts +1 -1
- package/dist/components/MonthPicker/MonthPicker.js +162 -0
- package/dist/components/MonthPicker/index.d.ts +2 -2
- package/dist/components/MonthRangePicker/MonthRangePicker.d.ts +1 -1
- package/dist/components/MonthRangePicker/MonthRangePicker.js +172 -0
- package/dist/components/MonthRangePicker/index.d.ts +2 -2
- package/dist/components/NavigationGroup/NavigationGroup.js +42 -0
- package/dist/components/NavigationGroup/index.d.ts +2 -2
- package/dist/components/NavigationItem/NavigationItem.js +45 -0
- package/dist/components/NavigationItem/index.d.ts +2 -2
- package/dist/components/Navigator/Navigator.js +30 -0
- package/dist/components/Navigator/index.d.ts +2 -2
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/Pagination/Pagination.js +117 -0
- package/dist/components/Pagination/index.d.ts +2 -2
- package/dist/components/Pagination/index.js +5 -0
- package/dist/components/PercentageInput/PercentageInput.js +85 -0
- package/dist/components/PercentageInput/index.d.ts +2 -2
- package/dist/components/Radio/Radio.js +11 -0
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/RadioList/RadioList.d.ts +1 -1
- package/dist/components/RadioList/RadioList.js +18 -0
- package/dist/components/RadioList/index.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.js +56 -0
- package/dist/components/Select/index.d.ts +2 -2
- package/dist/components/Select/index.js +6 -0
- package/dist/components/Sheet/Sheet.js +8 -0
- package/dist/components/Sheet/index.d.ts +2 -2
- package/dist/components/Sheet/index.js +5 -0
- package/dist/components/Stack/index.d.ts +2 -2
- package/dist/components/Stack/index.js +2 -0
- package/dist/components/Stepper/Stepper.js +66 -0
- package/dist/components/Stepper/index.d.ts +2 -2
- package/dist/components/Switch/Switch.js +46 -0
- package/dist/components/Switch/index.d.ts +2 -2
- package/dist/components/Table/Table.js +64 -0
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/Tabs/Tabs.js +17 -0
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Textarea/Textarea.d.ts +3 -17
- package/dist/components/Textarea/Textarea.js +31 -0
- package/dist/components/Textarea/index.d.ts +2 -2
- package/dist/components/Textarea/index.js +5 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +7 -7
- package/dist/components/ThemeProvider/ThemeProvider.js +240 -0
- package/dist/components/ThemeProvider/index.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.js +19 -0
- package/dist/components/Tooltip/index.d.ts +2 -2
- package/dist/components/Tooltip/index.js +5 -0
- package/dist/components/Typography/Typography.js +19 -0
- package/dist/components/Typography/index.d.ts +2 -2
- package/dist/components/Typography/index.js +5 -0
- package/dist/components/Uploader/Uploader.d.ts +4 -3
- package/dist/components/Uploader/Uploader.js +402 -0
- package/dist/components/Uploader/index.d.ts +2 -2
- package/dist/components/index.d.ts +53 -53
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js +8 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/external-adapter.js +245 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/entry-point/combine.js +1 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/entry-point/external/adapter.js +1 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/entry-point/external/file.js +1 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/entry-point/prevent-unhandled.js +1 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js +19 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js +5 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js +7 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js +128 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js +340 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js +33 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js +60 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js +312 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js +96 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js +13 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/external/file.js +23 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js +18 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/prevent-unhandled.js +102 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js +10 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js +3 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js +123 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-entering-window.js +55 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js +18 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js +55 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js +49 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js +16 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js +15 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js +18 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js +8 -0
- package/dist/external/@babel/runtime/helpers/esm/extends.js +16 -0
- package/dist/external/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +14 -0
- package/dist/external/@babel/runtime/helpers/extends.js +28 -0
- package/dist/external/@babel/runtime/helpers/interopRequireDefault.js +19 -0
- package/dist/external/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +26 -0
- package/dist/external/@emotion/cache/dist/emotion-cache.esm.js +653 -0
- package/dist/external/@emotion/memoize/dist/emotion-memoize.esm.js +9 -0
- package/dist/external/@emotion/sheet/dist/emotion-sheet.esm.js +154 -0
- package/dist/external/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js +16 -0
- package/dist/external/@mui/icons-material/esm/ArrowUpwardRounded.js +8 -0
- package/dist/external/@mui/icons-material/esm/CalendarToday.js +8 -0
- package/dist/external/@mui/icons-material/esm/Check.js +8 -0
- package/dist/external/@mui/icons-material/esm/ChevronLeft.js +8 -0
- package/dist/external/@mui/icons-material/esm/ChevronRight.js +8 -0
- package/dist/external/@mui/icons-material/esm/ClearRounded.js +8 -0
- package/dist/external/@mui/icons-material/esm/Close.js +8 -0
- package/dist/external/@mui/icons-material/esm/CloudUploadRounded.js +8 -0
- package/dist/external/@mui/icons-material/esm/ExpandMore.js +8 -0
- package/dist/external/@mui/icons-material/esm/Info.js +8 -0
- package/dist/external/@mui/icons-material/esm/UploadFileRounded.js +8 -0
- package/dist/external/@mui/material/SvgIcon/SvgIcon.js +186 -0
- package/dist/external/@mui/material/SvgIcon/svgIconClasses.js +9 -0
- package/dist/external/@mui/material/colors/blue.js +18 -0
- package/dist/external/@mui/material/colors/common.js +6 -0
- package/dist/external/@mui/material/colors/green.js +18 -0
- package/dist/external/@mui/material/colors/grey.js +18 -0
- package/dist/external/@mui/material/colors/lightBlue.js +18 -0
- package/dist/external/@mui/material/colors/orange.js +18 -0
- package/dist/external/@mui/material/colors/purple.js +18 -0
- package/dist/external/@mui/material/colors/red.js +18 -0
- package/dist/external/@mui/material/styles/createMixins.js +19 -0
- package/dist/external/@mui/material/styles/createPalette.js +308 -0
- package/dist/external/@mui/material/styles/createTheme.js +82 -0
- package/dist/external/@mui/material/styles/createTransitions.js +91 -0
- package/dist/external/@mui/material/styles/createTypography.js +93 -0
- package/dist/external/@mui/material/styles/defaultTheme.js +5 -0
- package/dist/external/@mui/material/styles/identifier.js +3 -0
- package/dist/external/@mui/material/styles/rootShouldForwardProp.js +5 -0
- package/dist/external/@mui/material/styles/shadows.js +11 -0
- package/dist/external/@mui/material/styles/slotShouldForwardProp.js +6 -0
- package/dist/external/@mui/material/styles/styled.js +12 -0
- package/dist/external/@mui/material/styles/useThemeProps.js +17 -0
- package/dist/external/@mui/material/styles/zIndex.js +14 -0
- package/dist/external/@mui/material/utils/capitalize.js +5 -0
- package/dist/external/@mui/material/utils/createSvgIcon.js +24 -0
- package/dist/external/@mui/styled-engine/GlobalStyles/GlobalStyles.js +24 -0
- package/dist/external/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js +37 -0
- package/dist/external/@mui/styled-engine/index.js +38 -0
- package/dist/external/@mui/system/colorManipulator.js +385 -0
- package/dist/external/@mui/system/createStyled.js +270 -0
- package/dist/external/@mui/system/esm/borders.js +51 -0
- package/dist/external/@mui/system/esm/breakpoints.js +66 -0
- package/dist/external/@mui/system/esm/compose.js +26 -0
- package/dist/external/@mui/system/esm/createTheme/applyStyles.js +76 -0
- package/dist/external/@mui/system/esm/createTheme/createBreakpoints.js +82 -0
- package/dist/external/@mui/system/esm/createTheme/createSpacing.js +34 -0
- package/dist/external/@mui/system/esm/createTheme/createTheme.js +45 -0
- package/dist/external/@mui/system/esm/createTheme/index.js +3 -0
- package/dist/external/@mui/system/esm/createTheme/shape.js +5 -0
- package/dist/external/@mui/system/esm/cssGrid.js +86 -0
- package/dist/external/@mui/system/esm/memoize.js +11 -0
- package/dist/external/@mui/system/esm/merge.js +12 -0
- package/dist/external/@mui/system/esm/palette.js +28 -0
- package/dist/external/@mui/system/esm/responsivePropType.js +5 -0
- package/dist/external/@mui/system/esm/sizing.js +67 -0
- package/dist/external/@mui/system/esm/spacing.js +144 -0
- package/dist/external/@mui/system/esm/style.js +77 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/defaultSxConfig.js +293 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/extendSxProp.js +51 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/index.js +3 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/styleFunctionSx.js +129 -0
- package/dist/external/@mui/system/esm/useTheme.js +9 -0
- package/dist/external/@mui/system/esm/useThemeProps/getThemeProps.js +15 -0
- package/dist/external/@mui/system/esm/useThemeProps/useThemeProps.js +22 -0
- package/dist/external/@mui/system/esm/useThemeWithoutDefault.js +12 -0
- package/dist/external/@mui/utils/ClassNameGenerator/ClassNameGenerator.js +18 -0
- package/dist/external/@mui/utils/capitalize/capitalize.js +14 -0
- package/dist/external/@mui/utils/capitalize/index.js +1 -0
- package/dist/external/@mui/utils/clamp/clamp.js +5 -0
- package/dist/external/@mui/utils/clamp/index.js +1 -0
- package/dist/external/@mui/utils/composeClasses/composeClasses.js +23 -0
- package/dist/external/@mui/utils/deepmerge/deepmerge.js +44 -0
- package/dist/external/@mui/utils/deepmerge/index.js +1 -0
- package/dist/external/@mui/utils/formatMuiErrorMessage/formatMuiErrorMessage.js +21 -0
- package/dist/external/@mui/utils/formatMuiErrorMessage/index.js +1 -0
- package/dist/external/@mui/utils/generateUtilityClass/generateUtilityClass.js +22 -0
- package/dist/external/@mui/utils/generateUtilityClasses/generateUtilityClasses.js +11 -0
- package/dist/external/@mui/utils/getDisplayName/getDisplayName.js +49 -0
- package/dist/external/@mui/utils/getDisplayName/index.js +1 -0
- package/dist/external/@mui/utils/resolveProps/resolveProps.js +37 -0
- package/dist/external/bind-event-listener/dist/bind-all.js +54 -0
- package/dist/external/bind-event-listener/dist/bind.js +21 -0
- package/dist/external/bind-event-listener/dist/index.js +21 -0
- package/dist/external/clsx/dist/clsx.js +3 -0
- package/dist/external/object-assign/index.js +99 -0
- package/dist/external/prop-types/checkPropTypes.js +115 -0
- package/dist/external/prop-types/factoryWithThrowingShims.js +74 -0
- package/dist/external/prop-types/factoryWithTypeCheckers.js +625 -0
- package/dist/external/prop-types/index.js +33 -0
- package/dist/external/prop-types/lib/ReactPropTypesSecret.js +21 -0
- package/dist/external/prop-types/lib/has.js +11 -0
- package/dist/external/raf-schd/dist/raf-schd.esm.js +34 -0
- package/dist/external/stylis/src/Enum.js +12 -0
- package/dist/external/stylis/src/Middleware.js +32 -0
- package/dist/external/stylis/src/Parser.js +193 -0
- package/dist/external/stylis/src/Serializer.js +38 -0
- package/dist/external/stylis/src/Tokenizer.js +223 -0
- package/dist/external/stylis/src/Utility.js +117 -0
- package/dist/hooks/use-controlled-state/index.js +23 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +52 -2
- package/dist/libs/rehype-accent/index.js +39 -0
- package/framer/index.js +30 -30
- package/package.json +8 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var rafSchd = function rafSchd(fn) {
|
|
2
|
+
var lastArgs = [];
|
|
3
|
+
var frameId = null;
|
|
4
|
+
|
|
5
|
+
var wrapperFn = function wrapperFn() {
|
|
6
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7
|
+
args[_key] = arguments[_key];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
lastArgs = args;
|
|
11
|
+
|
|
12
|
+
if (frameId) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
frameId = requestAnimationFrame(function () {
|
|
17
|
+
frameId = null;
|
|
18
|
+
fn.apply(undefined, lastArgs);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
wrapperFn.cancel = function () {
|
|
23
|
+
if (!frameId) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
cancelAnimationFrame(frameId);
|
|
28
|
+
frameId = null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return wrapperFn;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { rafSchd as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var MS = '-ms-';
|
|
2
|
+
var MOZ = '-moz-';
|
|
3
|
+
var WEBKIT = '-webkit-';
|
|
4
|
+
|
|
5
|
+
var COMMENT = 'comm';
|
|
6
|
+
var RULESET = 'rule';
|
|
7
|
+
var DECLARATION = 'decl';
|
|
8
|
+
var IMPORT = '@import';
|
|
9
|
+
var KEYFRAMES = '@keyframes';
|
|
10
|
+
var LAYER = '@layer';
|
|
11
|
+
|
|
12
|
+
export { COMMENT, DECLARATION, IMPORT, KEYFRAMES, LAYER, MOZ, MS, RULESET, WEBKIT };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { sizeof } from './Utility.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {function[]} collection
|
|
5
|
+
* @return {function}
|
|
6
|
+
*/
|
|
7
|
+
function middleware (collection) {
|
|
8
|
+
var length = sizeof(collection);
|
|
9
|
+
|
|
10
|
+
return function (element, index, children, callback) {
|
|
11
|
+
var output = '';
|
|
12
|
+
|
|
13
|
+
for (var i = 0; i < length; i++)
|
|
14
|
+
output += collection[i](element, index, children, callback) || '';
|
|
15
|
+
|
|
16
|
+
return output
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {function} callback
|
|
22
|
+
* @return {function}
|
|
23
|
+
*/
|
|
24
|
+
function rulesheet (callback) {
|
|
25
|
+
return function (element) {
|
|
26
|
+
if (!element.root)
|
|
27
|
+
if (element = element.return)
|
|
28
|
+
callback(element);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { middleware, rulesheet };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { COMMENT, DECLARATION, RULESET } from './Enum.js';
|
|
2
|
+
import { strlen, append, charat, replace, indexof, sizeof, substr, abs, trim, from } from './Utility.js';
|
|
3
|
+
import { dealloc, alloc, next, peek, delimit, identifier, commenter, escaping, whitespace, node, char, prev, caret } from './Tokenizer.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} value
|
|
7
|
+
* @return {object[]}
|
|
8
|
+
*/
|
|
9
|
+
function compile (value) {
|
|
10
|
+
return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} value
|
|
15
|
+
* @param {object} root
|
|
16
|
+
* @param {object?} parent
|
|
17
|
+
* @param {string[]} rule
|
|
18
|
+
* @param {string[]} rules
|
|
19
|
+
* @param {string[]} rulesets
|
|
20
|
+
* @param {number[]} pseudo
|
|
21
|
+
* @param {number[]} points
|
|
22
|
+
* @param {string[]} declarations
|
|
23
|
+
* @return {object}
|
|
24
|
+
*/
|
|
25
|
+
function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
26
|
+
var index = 0;
|
|
27
|
+
var offset = 0;
|
|
28
|
+
var length = pseudo;
|
|
29
|
+
var atrule = 0;
|
|
30
|
+
var property = 0;
|
|
31
|
+
var previous = 0;
|
|
32
|
+
var variable = 1;
|
|
33
|
+
var scanning = 1;
|
|
34
|
+
var ampersand = 1;
|
|
35
|
+
var character = 0;
|
|
36
|
+
var type = '';
|
|
37
|
+
var props = rules;
|
|
38
|
+
var children = rulesets;
|
|
39
|
+
var reference = rule;
|
|
40
|
+
var characters = type;
|
|
41
|
+
|
|
42
|
+
while (scanning)
|
|
43
|
+
switch (previous = character, character = next()) {
|
|
44
|
+
// (
|
|
45
|
+
case 40:
|
|
46
|
+
if (previous != 108 && charat(characters, length - 1) == 58) {
|
|
47
|
+
if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1)
|
|
48
|
+
ampersand = -1;
|
|
49
|
+
break
|
|
50
|
+
}
|
|
51
|
+
// " ' [
|
|
52
|
+
case 34: case 39: case 91:
|
|
53
|
+
characters += delimit(character);
|
|
54
|
+
break
|
|
55
|
+
// \t \n \r \s
|
|
56
|
+
case 9: case 10: case 13: case 32:
|
|
57
|
+
characters += whitespace(previous);
|
|
58
|
+
break
|
|
59
|
+
// \
|
|
60
|
+
case 92:
|
|
61
|
+
characters += escaping(caret() - 1, 7);
|
|
62
|
+
continue
|
|
63
|
+
// /
|
|
64
|
+
case 47:
|
|
65
|
+
switch (peek()) {
|
|
66
|
+
case 42: case 47:
|
|
67
|
+
append(comment(commenter(next(), caret()), root, parent), declarations);
|
|
68
|
+
break
|
|
69
|
+
default:
|
|
70
|
+
characters += '/';
|
|
71
|
+
}
|
|
72
|
+
break
|
|
73
|
+
// {
|
|
74
|
+
case 123 * variable:
|
|
75
|
+
points[index++] = strlen(characters) * ampersand;
|
|
76
|
+
// } ; \0
|
|
77
|
+
case 125 * variable: case 59: case 0:
|
|
78
|
+
switch (character) {
|
|
79
|
+
// \0 }
|
|
80
|
+
case 0: case 125: scanning = 0;
|
|
81
|
+
// ;
|
|
82
|
+
case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '');
|
|
83
|
+
if (property > 0 && (strlen(characters) - length))
|
|
84
|
+
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations);
|
|
85
|
+
break
|
|
86
|
+
// @ ;
|
|
87
|
+
case 59: characters += ';';
|
|
88
|
+
// { rule/at-rule
|
|
89
|
+
default:
|
|
90
|
+
append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
|
|
91
|
+
|
|
92
|
+
if (character === 123)
|
|
93
|
+
if (offset === 0)
|
|
94
|
+
parse(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
95
|
+
else
|
|
96
|
+
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
|
97
|
+
// d l m s
|
|
98
|
+
case 100: case 108: case 109: case 115:
|
|
99
|
+
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
100
|
+
break
|
|
101
|
+
default:
|
|
102
|
+
parse(characters, reference, reference, reference, [''], children, 0, points, children);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo;
|
|
107
|
+
break
|
|
108
|
+
// :
|
|
109
|
+
case 58:
|
|
110
|
+
length = 1 + strlen(characters), property = previous;
|
|
111
|
+
default:
|
|
112
|
+
if (variable < 1)
|
|
113
|
+
if (character == 123)
|
|
114
|
+
--variable;
|
|
115
|
+
else if (character == 125 && variable++ == 0 && prev() == 125)
|
|
116
|
+
continue
|
|
117
|
+
|
|
118
|
+
switch (characters += from(character), character * variable) {
|
|
119
|
+
// &
|
|
120
|
+
case 38:
|
|
121
|
+
ampersand = offset > 0 ? 1 : (characters += '\f', -1);
|
|
122
|
+
break
|
|
123
|
+
// ,
|
|
124
|
+
case 44:
|
|
125
|
+
points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
|
|
126
|
+
break
|
|
127
|
+
// @
|
|
128
|
+
case 64:
|
|
129
|
+
// -
|
|
130
|
+
if (peek() === 45)
|
|
131
|
+
characters += delimit(next());
|
|
132
|
+
|
|
133
|
+
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
|
|
134
|
+
break
|
|
135
|
+
// -
|
|
136
|
+
case 45:
|
|
137
|
+
if (previous === 45 && strlen(characters) == 2)
|
|
138
|
+
variable = 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return rulesets
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @param {string} value
|
|
147
|
+
* @param {object} root
|
|
148
|
+
* @param {object?} parent
|
|
149
|
+
* @param {number} index
|
|
150
|
+
* @param {number} offset
|
|
151
|
+
* @param {string[]} rules
|
|
152
|
+
* @param {number[]} points
|
|
153
|
+
* @param {string} type
|
|
154
|
+
* @param {string[]} props
|
|
155
|
+
* @param {string[]} children
|
|
156
|
+
* @param {number} length
|
|
157
|
+
* @return {object}
|
|
158
|
+
*/
|
|
159
|
+
function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
|
|
160
|
+
var post = offset - 1;
|
|
161
|
+
var rule = offset === 0 ? rules : [''];
|
|
162
|
+
var size = sizeof(rule);
|
|
163
|
+
|
|
164
|
+
for (var i = 0, j = 0, k = 0; i < index; ++i)
|
|
165
|
+
for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
|
|
166
|
+
if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
|
|
167
|
+
props[k++] = z;
|
|
168
|
+
|
|
169
|
+
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @param {number} value
|
|
174
|
+
* @param {object} root
|
|
175
|
+
* @param {object?} parent
|
|
176
|
+
* @return {object}
|
|
177
|
+
*/
|
|
178
|
+
function comment (value, root, parent) {
|
|
179
|
+
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @param {string} value
|
|
184
|
+
* @param {object} root
|
|
185
|
+
* @param {object?} parent
|
|
186
|
+
* @param {number} length
|
|
187
|
+
* @return {object}
|
|
188
|
+
*/
|
|
189
|
+
function declaration (value, root, parent, length) {
|
|
190
|
+
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export { comment, compile, declaration, parse, ruleset };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { RULESET, KEYFRAMES, COMMENT, DECLARATION, IMPORT, LAYER } from './Enum.js';
|
|
2
|
+
import { strlen, sizeof } from './Utility.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {object[]} children
|
|
6
|
+
* @param {function} callback
|
|
7
|
+
* @return {string}
|
|
8
|
+
*/
|
|
9
|
+
function serialize (children, callback) {
|
|
10
|
+
var output = '';
|
|
11
|
+
var length = sizeof(children);
|
|
12
|
+
|
|
13
|
+
for (var i = 0; i < length; i++)
|
|
14
|
+
output += callback(children[i], i, children, callback) || '';
|
|
15
|
+
|
|
16
|
+
return output
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {object} element
|
|
21
|
+
* @param {number} index
|
|
22
|
+
* @param {object[]} children
|
|
23
|
+
* @param {function} callback
|
|
24
|
+
* @return {string}
|
|
25
|
+
*/
|
|
26
|
+
function stringify (element, index, children, callback) {
|
|
27
|
+
switch (element.type) {
|
|
28
|
+
case LAYER: if (element.children.length) break
|
|
29
|
+
case IMPORT: case DECLARATION: return element.return = element.return || element.value
|
|
30
|
+
case COMMENT: return ''
|
|
31
|
+
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
|
32
|
+
case RULESET: element.value = element.props.join(',');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { serialize, stringify };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { assign, charat, strlen, trim, from, substr } from './Utility.js';
|
|
2
|
+
|
|
3
|
+
var line = 1;
|
|
4
|
+
var column = 1;
|
|
5
|
+
var length = 0;
|
|
6
|
+
var position = 0;
|
|
7
|
+
var character = 0;
|
|
8
|
+
var characters = '';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} value
|
|
12
|
+
* @param {object | null} root
|
|
13
|
+
* @param {object | null} parent
|
|
14
|
+
* @param {string} type
|
|
15
|
+
* @param {string[] | string} props
|
|
16
|
+
* @param {object[] | string} children
|
|
17
|
+
* @param {number} length
|
|
18
|
+
*/
|
|
19
|
+
function node (value, root, parent, type, props, children, length) {
|
|
20
|
+
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {object} root
|
|
25
|
+
* @param {object} props
|
|
26
|
+
* @return {object}
|
|
27
|
+
*/
|
|
28
|
+
function copy (root, props) {
|
|
29
|
+
return assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @return {number}
|
|
34
|
+
*/
|
|
35
|
+
function char () {
|
|
36
|
+
return character
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @return {number}
|
|
41
|
+
*/
|
|
42
|
+
function prev () {
|
|
43
|
+
character = position > 0 ? charat(characters, --position) : 0;
|
|
44
|
+
|
|
45
|
+
if (column--, character === 10)
|
|
46
|
+
column = 1, line--;
|
|
47
|
+
|
|
48
|
+
return character
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @return {number}
|
|
53
|
+
*/
|
|
54
|
+
function next () {
|
|
55
|
+
character = position < length ? charat(characters, position++) : 0;
|
|
56
|
+
|
|
57
|
+
if (column++, character === 10)
|
|
58
|
+
column = 1, line++;
|
|
59
|
+
|
|
60
|
+
return character
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @return {number}
|
|
65
|
+
*/
|
|
66
|
+
function peek () {
|
|
67
|
+
return charat(characters, position)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @return {number}
|
|
72
|
+
*/
|
|
73
|
+
function caret () {
|
|
74
|
+
return position
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @param {number} begin
|
|
79
|
+
* @param {number} end
|
|
80
|
+
* @return {string}
|
|
81
|
+
*/
|
|
82
|
+
function slice (begin, end) {
|
|
83
|
+
return substr(characters, begin, end)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @param {number} type
|
|
88
|
+
* @return {number}
|
|
89
|
+
*/
|
|
90
|
+
function token (type) {
|
|
91
|
+
switch (type) {
|
|
92
|
+
// \0 \t \n \r \s whitespace token
|
|
93
|
+
case 0: case 9: case 10: case 13: case 32:
|
|
94
|
+
return 5
|
|
95
|
+
// ! + , / > @ ~ isolate token
|
|
96
|
+
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
|
|
97
|
+
// ; { } breakpoint token
|
|
98
|
+
case 59: case 123: case 125:
|
|
99
|
+
return 4
|
|
100
|
+
// : accompanied token
|
|
101
|
+
case 58:
|
|
102
|
+
return 3
|
|
103
|
+
// " ' ( [ opening delimit token
|
|
104
|
+
case 34: case 39: case 40: case 91:
|
|
105
|
+
return 2
|
|
106
|
+
// ) ] closing delimit token
|
|
107
|
+
case 41: case 93:
|
|
108
|
+
return 1
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return 0
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @param {string} value
|
|
116
|
+
* @return {any[]}
|
|
117
|
+
*/
|
|
118
|
+
function alloc (value) {
|
|
119
|
+
return line = column = 1, length = strlen(characters = value), position = 0, []
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @param {any} value
|
|
124
|
+
* @return {any}
|
|
125
|
+
*/
|
|
126
|
+
function dealloc (value) {
|
|
127
|
+
return characters = '', value
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @param {number} type
|
|
132
|
+
* @return {string}
|
|
133
|
+
*/
|
|
134
|
+
function delimit (type) {
|
|
135
|
+
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @param {number} type
|
|
140
|
+
* @return {string}
|
|
141
|
+
*/
|
|
142
|
+
function whitespace (type) {
|
|
143
|
+
while (character = peek())
|
|
144
|
+
if (character < 33)
|
|
145
|
+
next();
|
|
146
|
+
else
|
|
147
|
+
break
|
|
148
|
+
|
|
149
|
+
return token(type) > 2 || token(character) > 3 ? '' : ' '
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @param {number} index
|
|
154
|
+
* @param {number} count
|
|
155
|
+
* @return {string}
|
|
156
|
+
*/
|
|
157
|
+
function escaping (index, count) {
|
|
158
|
+
while (--count && next())
|
|
159
|
+
// not 0-9 A-F a-f
|
|
160
|
+
if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
|
|
161
|
+
break
|
|
162
|
+
|
|
163
|
+
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @param {number} type
|
|
168
|
+
* @return {number}
|
|
169
|
+
*/
|
|
170
|
+
function delimiter (type) {
|
|
171
|
+
while (next())
|
|
172
|
+
switch (character) {
|
|
173
|
+
// ] ) " '
|
|
174
|
+
case type:
|
|
175
|
+
return position
|
|
176
|
+
// " '
|
|
177
|
+
case 34: case 39:
|
|
178
|
+
if (type !== 34 && type !== 39)
|
|
179
|
+
delimiter(character);
|
|
180
|
+
break
|
|
181
|
+
// (
|
|
182
|
+
case 40:
|
|
183
|
+
if (type === 41)
|
|
184
|
+
delimiter(type);
|
|
185
|
+
break
|
|
186
|
+
// \
|
|
187
|
+
case 92:
|
|
188
|
+
next();
|
|
189
|
+
break
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return position
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @param {number} type
|
|
197
|
+
* @param {number} index
|
|
198
|
+
* @return {number}
|
|
199
|
+
*/
|
|
200
|
+
function commenter (type, index) {
|
|
201
|
+
while (next())
|
|
202
|
+
// //
|
|
203
|
+
if (type + character === 47 + 10)
|
|
204
|
+
break
|
|
205
|
+
// /*
|
|
206
|
+
else if (type + character === 42 + 42 && peek() === 47)
|
|
207
|
+
break
|
|
208
|
+
|
|
209
|
+
return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @param {number} index
|
|
214
|
+
* @return {string}
|
|
215
|
+
*/
|
|
216
|
+
function identifier (index) {
|
|
217
|
+
while (!token(peek()))
|
|
218
|
+
next();
|
|
219
|
+
|
|
220
|
+
return slice(index, position)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { alloc, caret, char, character, characters, column, commenter, copy, dealloc, delimit, delimiter, escaping, identifier, length, line, next, node, peek, position, prev, slice, token, whitespace };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {number}
|
|
3
|
+
* @return {number}
|
|
4
|
+
*/
|
|
5
|
+
var abs = Math.abs;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {number}
|
|
9
|
+
* @return {string}
|
|
10
|
+
*/
|
|
11
|
+
var from = String.fromCharCode;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {object}
|
|
15
|
+
* @return {object}
|
|
16
|
+
*/
|
|
17
|
+
var assign = Object.assign;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} value
|
|
21
|
+
* @param {number} length
|
|
22
|
+
* @return {number}
|
|
23
|
+
*/
|
|
24
|
+
function hash (value, length) {
|
|
25
|
+
return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} value
|
|
30
|
+
* @return {string}
|
|
31
|
+
*/
|
|
32
|
+
function trim (value) {
|
|
33
|
+
return value.trim()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} value
|
|
38
|
+
* @param {RegExp} pattern
|
|
39
|
+
* @return {string?}
|
|
40
|
+
*/
|
|
41
|
+
function match (value, pattern) {
|
|
42
|
+
return (value = pattern.exec(value)) ? value[0] : value
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {string} value
|
|
47
|
+
* @param {(string|RegExp)} pattern
|
|
48
|
+
* @param {string} replacement
|
|
49
|
+
* @return {string}
|
|
50
|
+
*/
|
|
51
|
+
function replace (value, pattern, replacement) {
|
|
52
|
+
return value.replace(pattern, replacement)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {string} value
|
|
57
|
+
* @param {string} search
|
|
58
|
+
* @return {number}
|
|
59
|
+
*/
|
|
60
|
+
function indexof (value, search) {
|
|
61
|
+
return value.indexOf(search)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {string} value
|
|
66
|
+
* @param {number} index
|
|
67
|
+
* @return {number}
|
|
68
|
+
*/
|
|
69
|
+
function charat (value, index) {
|
|
70
|
+
return value.charCodeAt(index) | 0
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {string} value
|
|
75
|
+
* @param {number} begin
|
|
76
|
+
* @param {number} end
|
|
77
|
+
* @return {string}
|
|
78
|
+
*/
|
|
79
|
+
function substr (value, begin, end) {
|
|
80
|
+
return value.slice(begin, end)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {string} value
|
|
85
|
+
* @return {number}
|
|
86
|
+
*/
|
|
87
|
+
function strlen (value) {
|
|
88
|
+
return value.length
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {any[]} value
|
|
93
|
+
* @return {number}
|
|
94
|
+
*/
|
|
95
|
+
function sizeof (value) {
|
|
96
|
+
return value.length
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param {any} value
|
|
101
|
+
* @param {any[]} array
|
|
102
|
+
* @return {any}
|
|
103
|
+
*/
|
|
104
|
+
function append (value, array) {
|
|
105
|
+
return array.push(value), value
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @param {string[]} array
|
|
110
|
+
* @param {function} callback
|
|
111
|
+
* @return {string}
|
|
112
|
+
*/
|
|
113
|
+
function combine (array, callback) {
|
|
114
|
+
return array.map(callback).join('')
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export { abs, append, assign, charat, combine, from, hash, indexof, match, replace, sizeof, strlen, substr, trim };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
function useControlledState(controlledValue, defaultValue, onChange, options) {
|
|
4
|
+
const { current: isControlled } = useRef(controlledValue !== undefined);
|
|
5
|
+
const [displayValue, setDisplayValue] = useState(controlledValue ?? defaultValue);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (isControlled) {
|
|
8
|
+
setDisplayValue(controlledValue ?? defaultValue);
|
|
9
|
+
}
|
|
10
|
+
}, [controlledValue, defaultValue, isControlled]);
|
|
11
|
+
const handleChange = useCallback((value) => {
|
|
12
|
+
const newValue = typeof value === "function"
|
|
13
|
+
? value(displayValue)
|
|
14
|
+
: value;
|
|
15
|
+
if (options?.disableStrict || !isControlled) {
|
|
16
|
+
setDisplayValue(newValue);
|
|
17
|
+
}
|
|
18
|
+
onChange?.(newValue);
|
|
19
|
+
}, [isControlled, onChange, displayValue, options]);
|
|
20
|
+
return [displayValue, handleChange];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { useControlledState };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useTheme, useColorScheme, useThemeProps, ButtonGroup, boxClasses, buttonClasses, checkboxClasses, dividerClasses, iconButtonClasses, inputClasses, menuClasses, menuButtonClasses, menuItemClasses, optionClasses, radioClasses, radioGroupClasses, selectClasses, switchClasses, tableClasses, textareaClasses, typographyClasses, formControlClasses, formLabelClasses, formHelperTextClasses, gridClasses, stackClasses, sheetClasses, modalClasses, modalCloseClasses, modalDialogClasses, modalOverflowClasses, dialogTitleClasses, dialogContentClasses, dialogActionsClasses, tooltipClasses, tabsClasses, tabListClasses, tabPanelClasses, accordionClasses, accordionDetailsClasses, accordionGroupClasses as accordionsClasses, accordionSummaryClasses, AutocompleteListbox, AutocompleteOption, autocompleteClasses, autocompleteListboxClasses, autocompleteOptionClasses, avatarClasses, avatarGroupClasses, AspectRatio, aspectRatioClasses, Badge, badgeClasses, breadcrumbsClasses, Card, cardClasses, CardActions, cardActionsClasses, CardContent, cardContentClasses, CardCover, cardCoverClasses, CardOverflow, cardOverflowClasses, Chip, chipClasses, CircularProgress, circularProgressClasses, drawerClasses, LinearProgress, linearProgressClasses, List, listClasses, ListDivider, listDividerClasses, ListItem, listItemClasses, ListItemButton, listItemButtonClasses, ListItemContent, listItemContentClasses, ListItemDecorator, listItemDecoratorClasses, ListSubheader, listSubheaderClasses, Link, linkClasses, Slider, sliderClasses, stepClasses, StepButton, stepButtonClasses, stepperClasses, Skeleton, skeletonClasses, } from "@mui/joy";
|
|
2
|
-
export { Autocomplete, Accordion, Accordions, AccordionDetails, AccordionSummary, Avatar, AvatarGroup, Box, Breadcrumbs, Button, Calendar, Checkbox, Container, CurrencyInput, DataTable, DatePicker, DateRangePicker, DialogActions, DialogContent, DialogTitle, DialogFrame, Divider, Drawer, Dropdown, extendTheme, InsetDrawer, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Markdown, Menu, MenuButton, MenuItem, Modal, ModalClose, ModalDialog, ModalOverflow, ModalFrame, MonthPicker, MonthRangePicker, NavigationGroup, NavigationItem, Navigator, Pagination, PercentageInput, Radio, RadioGroup, RadioList, Select, Step, StepIndicator, Stepper, Option, Sheet, Stack, Switch, theme, Table, TableHead, TableBody, Tabs, Tab, TabList, TabPanel, Textarea, ThemeProvider, Tooltip, Typography, Uploader, } from "./components";
|
|
2
|
+
export { Autocomplete, Accordion, Accordions, AccordionDetails, AccordionSummary, Avatar, AvatarGroup, Box, Breadcrumbs, Button, Calendar, Checkbox, Container, CurrencyInput, DataTable, DatePicker, DateRangePicker, DialogActions, DialogContent, DialogTitle, DialogFrame, Divider, Drawer, Dropdown, extendTheme, InsetDrawer, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Markdown, Menu, MenuButton, MenuItem, Modal, ModalClose, ModalDialog, ModalOverflow, ModalFrame, MonthPicker, MonthRangePicker, NavigationGroup, NavigationItem, Navigator, Pagination, PercentageInput, Radio, RadioGroup, RadioList, Select, Step, StepIndicator, Stepper, Option, Sheet, Stack, Switch, theme, Table, TableHead, TableBody, Tabs, Tab, TabList, TabPanel, Textarea, ThemeProvider, Tooltip, Typography, Uploader, } from "./components/index.js";
|