@ceed/cds 0.0.186 → 0.0.187-cjs.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 +33 -0
- package/dist/_virtual/bind-all.js +5 -0
- package/dist/_virtual/bind.js +5 -0
- package/dist/_virtual/colorManipulator.js +7 -0
- package/dist/_virtual/colorManipulator2.js +5 -0
- package/dist/_virtual/createStyled.js +9 -0
- package/dist/_virtual/createStyled2.js +5 -0
- package/dist/_virtual/extends.js +5 -0
- package/dist/_virtual/index.js +7 -0
- package/dist/_virtual/index10.js +8 -0
- package/dist/_virtual/index11.js +12 -0
- package/dist/_virtual/index12.js +12 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index3.js +9 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index5.js +8 -0
- package/dist/_virtual/index6.js +8 -0
- package/dist/_virtual/index7.js +12 -0
- package/dist/_virtual/index8.js +8 -0
- package/dist/_virtual/index9.js +8 -0
- package/dist/_virtual/interopRequireDefault.js +5 -0
- package/dist/_virtual/objectWithoutPropertiesLoose.js +5 -0
- package/dist/components/Accordions/Accordions.js +48 -0
- package/dist/components/Autocomplete/Autocomplete.js +198 -0
- package/dist/components/Autocomplete/index.js +10 -0
- package/dist/components/Avatar/Avatar.js +47 -0
- package/dist/components/Box/Box.js +10 -0
- package/dist/components/Box/index.js +10 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +49 -0
- package/dist/components/Button/Button.js +22 -0
- package/dist/components/Button/index.js +10 -0
- package/dist/components/Calendar/Calendar.js +335 -0
- package/dist/components/Calendar/hooks/use-calendar-props.js +76 -0
- package/dist/components/Calendar/hooks/use-calendar.js +249 -0
- package/dist/components/Calendar/index.js +10 -0
- package/dist/components/Calendar/utils/index.js +84 -0
- package/dist/components/Card/Card.js +26 -0
- package/dist/components/Checkbox/Checkbox.js +21 -0
- package/dist/components/Checkbox/index.js +10 -0
- package/dist/components/Chip/Chip.js +10 -0
- package/dist/components/Chip/index.js +10 -0
- package/dist/components/Container/Container.js +51 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +93 -0
- package/dist/components/CurrencyInput/hooks/use-currency-setting.js +169 -0
- package/dist/components/CurrencyInput/index.js +10 -0
- package/dist/components/DataTable/DataTable.js +570 -0
- package/dist/components/DatePicker/DatePicker.js +212 -0
- package/dist/components/DatePicker/index.js +10 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +215 -0
- package/dist/components/DialogActions/DialogActions.js +16 -0
- package/dist/components/DialogActions/index.js +10 -0
- package/dist/components/DialogContent/DialogContent.js +13 -0
- package/dist/components/DialogContent/index.js +10 -0
- package/dist/components/DialogFrame/DialogFrame.js +33 -0
- package/dist/components/DialogTitle/DialogTitle.js +13 -0
- package/dist/components/DialogTitle/index.js +10 -0
- package/dist/components/Divider/Divider.js +21 -0
- package/dist/components/Drawer/Drawer.js +42 -0
- package/dist/components/Dropdown/Dropdown.js +10 -0
- package/dist/components/Dropdown/index.js +10 -0
- package/dist/components/FormControl/FormControl.js +17 -0
- package/dist/components/FormControl/index.js +10 -0
- package/dist/components/FormHelperText/FormHelperText.js +10 -0
- package/dist/components/FormHelperText/index.js +10 -0
- package/dist/components/FormLabel/FormLabel.js +10 -0
- package/dist/components/FormLabel/index.js +10 -0
- package/dist/components/IconButton/IconButton.js +22 -0
- package/dist/components/IconButton/index.js +10 -0
- package/dist/components/Input/Input.js +62 -0
- package/dist/components/Input/index.js +10 -0
- package/dist/components/InsetDrawer/InsetDrawer.js +32 -0
- package/dist/components/Markdown/Markdown.d.ts +6 -22
- package/dist/components/Markdown/Markdown.js +86 -0
- package/dist/components/Menu/Menu.js +46 -0
- package/dist/components/Menu/index.js +11 -0
- package/dist/components/MenuButton/MenuButton.d.ts +1 -1
- package/dist/components/MenuButton/MenuButton.js +28 -0
- package/dist/components/Modal/Modal.js +49 -0
- package/dist/components/MonthPicker/MonthPicker.js +164 -0
- package/dist/components/MonthRangePicker/MonthRangePicker.js +174 -0
- package/dist/components/NavigationGroup/NavigationGroup.js +44 -0
- package/dist/components/NavigationItem/NavigationItem.js +47 -0
- package/dist/components/Navigator/Navigator.js +32 -0
- package/dist/components/Pagination/Pagination.js +119 -0
- package/dist/components/Pagination/index.js +10 -0
- package/dist/components/PercentageInput/PercentageInput.js +87 -0
- package/dist/components/Radio/Radio.js +14 -0
- package/dist/components/RadioList/RadioList.js +20 -0
- package/dist/components/Select/Select.js +59 -0
- package/dist/components/Select/index.js +11 -0
- package/dist/components/Sheet/Sheet.js +10 -0
- package/dist/components/Sheet/index.js +10 -0
- package/dist/components/Stack/index.js +16 -0
- package/dist/components/Stepper/Stepper.js +70 -0
- package/dist/components/Switch/Switch.js +48 -0
- package/dist/components/Table/Table.js +68 -0
- package/dist/components/Tabs/Tabs.js +22 -0
- package/dist/components/Textarea/Textarea.d.ts +3 -17
- package/dist/components/Textarea/Textarea.js +33 -0
- package/dist/components/Textarea/index.js +10 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +250 -0
- package/dist/components/Tooltip/Tooltip.js +21 -0
- package/dist/components/Tooltip/index.js +10 -0
- package/dist/components/Typography/Typography.js +21 -0
- package/dist/components/Typography/index.js +10 -0
- package/dist/components/Uploader/Uploader.d.ts +1 -1
- package/dist/components/Uploader/Uploader.js +366 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js +10 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/external-adapter.js +251 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js +21 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js +7 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js +9 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js +130 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js +342 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js +35 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js +62 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js +314 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js +98 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js +15 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/external/file.js +26 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js +20 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/prevent-unhandled.js +104 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js +12 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js +5 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js +126 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-entering-window.js +57 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js +20 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js +57 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js +51 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js +18 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js +17 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js +20 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js +10 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/arrayLikeToArray.js +9 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/arrayWithHoles.js +7 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/arrayWithoutHoles.js +9 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/defineProperty.js +20 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/iterableToArray.js +7 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/iterableToArrayLimit.js +28 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/nonIterableRest.js +7 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/nonIterableSpread.js +7 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/slicedToArray.js +12 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/toConsumableArray.js +12 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/toPrimitive.js +16 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/toPropertyKey.js +11 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/typeof.js +13 -0
- package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +14 -0
- package/dist/external/@babel/runtime/helpers/esm/extends.js +18 -0
- package/dist/external/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +16 -0
- package/dist/external/@babel/runtime/helpers/extends.js +30 -0
- package/dist/external/@babel/runtime/helpers/interopRequireDefault.js +21 -0
- package/dist/external/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +28 -0
- package/dist/external/@emotion/cache/dist/emotion-cache.esm.js +655 -0
- package/dist/external/@emotion/memoize/dist/emotion-memoize.esm.js +11 -0
- package/dist/external/@emotion/sheet/dist/emotion-sheet.esm.js +156 -0
- package/dist/external/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js +18 -0
- package/dist/external/@mui/icons-material/esm/ArrowUpwardRounded.js +10 -0
- package/dist/external/@mui/icons-material/esm/CalendarToday.js +10 -0
- package/dist/external/@mui/icons-material/esm/Check.js +10 -0
- package/dist/external/@mui/icons-material/esm/ChevronLeft.js +10 -0
- package/dist/external/@mui/icons-material/esm/ChevronRight.js +10 -0
- package/dist/external/@mui/icons-material/esm/ClearRounded.js +10 -0
- package/dist/external/@mui/icons-material/esm/Close.js +10 -0
- package/dist/external/@mui/icons-material/esm/CloudUploadRounded.js +10 -0
- package/dist/external/@mui/icons-material/esm/ExpandMore.js +10 -0
- package/dist/external/@mui/icons-material/esm/Info.js +10 -0
- package/dist/external/@mui/icons-material/esm/UploadFileRounded.js +10 -0
- package/dist/external/@mui/material/SvgIcon/SvgIcon.js +207 -0
- package/dist/external/@mui/material/SvgIcon/svgIconClasses.js +11 -0
- package/dist/external/@mui/material/colors/blue.js +20 -0
- package/dist/external/@mui/material/colors/common.js +8 -0
- package/dist/external/@mui/material/colors/green.js +20 -0
- package/dist/external/@mui/material/colors/grey.js +20 -0
- package/dist/external/@mui/material/colors/lightBlue.js +20 -0
- package/dist/external/@mui/material/colors/orange.js +20 -0
- package/dist/external/@mui/material/colors/purple.js +20 -0
- package/dist/external/@mui/material/colors/red.js +20 -0
- package/dist/external/@mui/material/styles/createMixins.js +21 -0
- package/dist/external/@mui/material/styles/createPalette.js +314 -0
- package/dist/external/@mui/material/styles/createTheme.js +84 -0
- package/dist/external/@mui/material/styles/createTransitions.js +97 -0
- package/dist/external/@mui/material/styles/createTypography.js +95 -0
- package/dist/external/@mui/material/styles/defaultTheme.js +7 -0
- package/dist/external/@mui/material/styles/identifier.js +5 -0
- package/dist/external/@mui/material/styles/rootShouldForwardProp.js +7 -0
- package/dist/external/@mui/material/styles/shadows.js +13 -0
- package/dist/external/@mui/material/styles/slotShouldForwardProp.js +8 -0
- package/dist/external/@mui/material/styles/styled.js +17 -0
- package/dist/external/@mui/material/styles/useThemeProps.js +19 -0
- package/dist/external/@mui/material/styles/zIndex.js +16 -0
- package/dist/external/@mui/material/utils/capitalize.js +7 -0
- package/dist/external/@mui/material/utils/createSvgIcon.js +45 -0
- package/dist/external/@mui/styled-engine/GlobalStyles/GlobalStyles.js +26 -0
- package/dist/external/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js +39 -0
- package/dist/external/@mui/styled-engine/index.js +57 -0
- package/dist/external/@mui/system/colorManipulator.js +387 -0
- package/dist/external/@mui/system/createStyled.js +272 -0
- package/dist/external/@mui/system/esm/borders.js +66 -0
- package/dist/external/@mui/system/esm/breakpoints.js +71 -0
- package/dist/external/@mui/system/esm/compose.js +28 -0
- package/dist/external/@mui/system/esm/createTheme/applyStyles.js +78 -0
- package/dist/external/@mui/system/esm/createTheme/createBreakpoints.js +84 -0
- package/dist/external/@mui/system/esm/createTheme/createSpacing.js +36 -0
- package/dist/external/@mui/system/esm/createTheme/createTheme.js +47 -0
- package/dist/external/@mui/system/esm/createTheme/index.js +13 -0
- package/dist/external/@mui/system/esm/createTheme/shape.js +7 -0
- package/dist/external/@mui/system/esm/cssGrid.js +99 -0
- package/dist/external/@mui/system/esm/memoize.js +13 -0
- package/dist/external/@mui/system/esm/merge.js +14 -0
- package/dist/external/@mui/system/esm/palette.js +33 -0
- package/dist/external/@mui/system/esm/responsivePropType.js +7 -0
- package/dist/external/@mui/system/esm/sizing.js +76 -0
- package/dist/external/@mui/system/esm/spacing.js +153 -0
- package/dist/external/@mui/system/esm/style.js +83 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/defaultSxConfig.js +295 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/extendSxProp.js +53 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/index.js +14 -0
- package/dist/external/@mui/system/esm/styleFunctionSx/styleFunctionSx.js +134 -0
- package/dist/external/@mui/system/esm/useTheme.js +14 -0
- package/dist/external/@mui/system/esm/useThemeProps/getThemeProps.js +17 -0
- package/dist/external/@mui/system/esm/useThemeProps/useThemeProps.js +24 -0
- package/dist/external/@mui/system/esm/useThemeWithoutDefault.js +33 -0
- package/dist/external/@mui/utils/ClassNameGenerator/ClassNameGenerator.js +20 -0
- package/dist/external/@mui/utils/capitalize/capitalize.js +16 -0
- package/dist/external/@mui/utils/capitalize/index.js +7 -0
- package/dist/external/@mui/utils/clamp/clamp.js +7 -0
- package/dist/external/@mui/utils/clamp/index.js +7 -0
- package/dist/external/@mui/utils/composeClasses/composeClasses.js +25 -0
- package/dist/external/@mui/utils/deepmerge/deepmerge.js +49 -0
- package/dist/external/@mui/utils/deepmerge/index.js +10 -0
- package/dist/external/@mui/utils/formatMuiErrorMessage/formatMuiErrorMessage.js +23 -0
- package/dist/external/@mui/utils/formatMuiErrorMessage/index.js +7 -0
- package/dist/external/@mui/utils/generateUtilityClass/generateUtilityClass.js +27 -0
- package/dist/external/@mui/utils/generateUtilityClasses/generateUtilityClasses.js +13 -0
- package/dist/external/@mui/utils/getDisplayName/getDisplayName.js +54 -0
- package/dist/external/@mui/utils/getDisplayName/index.js +10 -0
- package/dist/external/@mui/utils/resolveProps/resolveProps.js +39 -0
- package/dist/external/bind-event-listener/dist/bind-all.js +56 -0
- package/dist/external/bind-event-listener/dist/bind.js +23 -0
- package/dist/external/bind-event-listener/dist/index.js +23 -0
- package/dist/external/clsx/dist/clsx.js +8 -0
- package/dist/external/object-assign/index.js +101 -0
- package/dist/external/prop-types/checkPropTypes.js +117 -0
- package/dist/external/prop-types/factoryWithThrowingShims.js +76 -0
- package/dist/external/prop-types/factoryWithTypeCheckers.js +627 -0
- package/dist/external/prop-types/index.js +35 -0
- package/dist/external/prop-types/lib/ReactPropTypesSecret.js +23 -0
- package/dist/external/prop-types/lib/has.js +13 -0
- package/dist/external/raf-schd/dist/raf-schd.esm.js +36 -0
- package/dist/external/stylis/src/Enum.js +22 -0
- package/dist/external/stylis/src/Middleware.js +35 -0
- package/dist/external/stylis/src/Parser.js +199 -0
- package/dist/external/stylis/src/Serializer.js +41 -0
- package/dist/external/stylis/src/Tokenizer.js +241 -0
- package/dist/external/stylis/src/Utility.js +132 -0
- package/dist/hooks/use-controlled-state/index.js +25 -0
- package/dist/index.js +521 -2
- package/dist/libs/rehype-accent/index.js +41 -0
- package/package.json +8 -5
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var rafSchd = function rafSchd(fn) {
|
|
4
|
+
var lastArgs = [];
|
|
5
|
+
var frameId = null;
|
|
6
|
+
|
|
7
|
+
var wrapperFn = function wrapperFn() {
|
|
8
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
|
+
args[_key] = arguments[_key];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
lastArgs = args;
|
|
13
|
+
|
|
14
|
+
if (frameId) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
frameId = requestAnimationFrame(function () {
|
|
19
|
+
frameId = null;
|
|
20
|
+
fn.apply(undefined, lastArgs);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
wrapperFn.cancel = function () {
|
|
25
|
+
if (!frameId) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
cancelAnimationFrame(frameId);
|
|
30
|
+
frameId = null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return wrapperFn;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = rafSchd;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var MS = '-ms-';
|
|
4
|
+
var MOZ = '-moz-';
|
|
5
|
+
var WEBKIT = '-webkit-';
|
|
6
|
+
|
|
7
|
+
var COMMENT = 'comm';
|
|
8
|
+
var RULESET = 'rule';
|
|
9
|
+
var DECLARATION = 'decl';
|
|
10
|
+
var IMPORT = '@import';
|
|
11
|
+
var KEYFRAMES = '@keyframes';
|
|
12
|
+
var LAYER = '@layer';
|
|
13
|
+
|
|
14
|
+
exports.COMMENT = COMMENT;
|
|
15
|
+
exports.DECLARATION = DECLARATION;
|
|
16
|
+
exports.IMPORT = IMPORT;
|
|
17
|
+
exports.KEYFRAMES = KEYFRAMES;
|
|
18
|
+
exports.LAYER = LAYER;
|
|
19
|
+
exports.MOZ = MOZ;
|
|
20
|
+
exports.MS = MS;
|
|
21
|
+
exports.RULESET = RULESET;
|
|
22
|
+
exports.WEBKIT = WEBKIT;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Utility = require('./Utility.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {function[]} collection
|
|
7
|
+
* @return {function}
|
|
8
|
+
*/
|
|
9
|
+
function middleware (collection) {
|
|
10
|
+
var length = Utility.sizeof(collection);
|
|
11
|
+
|
|
12
|
+
return function (element, index, children, callback) {
|
|
13
|
+
var output = '';
|
|
14
|
+
|
|
15
|
+
for (var i = 0; i < length; i++)
|
|
16
|
+
output += collection[i](element, index, children, callback) || '';
|
|
17
|
+
|
|
18
|
+
return output
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {function} callback
|
|
24
|
+
* @return {function}
|
|
25
|
+
*/
|
|
26
|
+
function rulesheet (callback) {
|
|
27
|
+
return function (element) {
|
|
28
|
+
if (!element.root)
|
|
29
|
+
if (element = element.return)
|
|
30
|
+
callback(element);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.middleware = middleware;
|
|
35
|
+
exports.rulesheet = rulesheet;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Enum = require('./Enum.js');
|
|
4
|
+
var Utility = require('./Utility.js');
|
|
5
|
+
var Tokenizer = require('./Tokenizer.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} value
|
|
9
|
+
* @return {object[]}
|
|
10
|
+
*/
|
|
11
|
+
function compile (value) {
|
|
12
|
+
return Tokenizer.dealloc(parse('', null, null, null, [''], value = Tokenizer.alloc(value), 0, [0], value))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} value
|
|
17
|
+
* @param {object} root
|
|
18
|
+
* @param {object?} parent
|
|
19
|
+
* @param {string[]} rule
|
|
20
|
+
* @param {string[]} rules
|
|
21
|
+
* @param {string[]} rulesets
|
|
22
|
+
* @param {number[]} pseudo
|
|
23
|
+
* @param {number[]} points
|
|
24
|
+
* @param {string[]} declarations
|
|
25
|
+
* @return {object}
|
|
26
|
+
*/
|
|
27
|
+
function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
28
|
+
var index = 0;
|
|
29
|
+
var offset = 0;
|
|
30
|
+
var length = pseudo;
|
|
31
|
+
var atrule = 0;
|
|
32
|
+
var property = 0;
|
|
33
|
+
var previous = 0;
|
|
34
|
+
var variable = 1;
|
|
35
|
+
var scanning = 1;
|
|
36
|
+
var ampersand = 1;
|
|
37
|
+
var character = 0;
|
|
38
|
+
var type = '';
|
|
39
|
+
var props = rules;
|
|
40
|
+
var children = rulesets;
|
|
41
|
+
var reference = rule;
|
|
42
|
+
var characters = type;
|
|
43
|
+
|
|
44
|
+
while (scanning)
|
|
45
|
+
switch (previous = character, character = Tokenizer.next()) {
|
|
46
|
+
// (
|
|
47
|
+
case 40:
|
|
48
|
+
if (previous != 108 && Utility.charat(characters, length - 1) == 58) {
|
|
49
|
+
if (Utility.indexof(characters += Utility.replace(Tokenizer.delimit(character), '&', '&\f'), '&\f') != -1)
|
|
50
|
+
ampersand = -1;
|
|
51
|
+
break
|
|
52
|
+
}
|
|
53
|
+
// " ' [
|
|
54
|
+
case 34: case 39: case 91:
|
|
55
|
+
characters += Tokenizer.delimit(character);
|
|
56
|
+
break
|
|
57
|
+
// \t \n \r \s
|
|
58
|
+
case 9: case 10: case 13: case 32:
|
|
59
|
+
characters += Tokenizer.whitespace(previous);
|
|
60
|
+
break
|
|
61
|
+
// \
|
|
62
|
+
case 92:
|
|
63
|
+
characters += Tokenizer.escaping(Tokenizer.caret() - 1, 7);
|
|
64
|
+
continue
|
|
65
|
+
// /
|
|
66
|
+
case 47:
|
|
67
|
+
switch (Tokenizer.peek()) {
|
|
68
|
+
case 42: case 47:
|
|
69
|
+
Utility.append(comment(Tokenizer.commenter(Tokenizer.next(), Tokenizer.caret()), root, parent), declarations);
|
|
70
|
+
break
|
|
71
|
+
default:
|
|
72
|
+
characters += '/';
|
|
73
|
+
}
|
|
74
|
+
break
|
|
75
|
+
// {
|
|
76
|
+
case 123 * variable:
|
|
77
|
+
points[index++] = Utility.strlen(characters) * ampersand;
|
|
78
|
+
// } ; \0
|
|
79
|
+
case 125 * variable: case 59: case 0:
|
|
80
|
+
switch (character) {
|
|
81
|
+
// \0 }
|
|
82
|
+
case 0: case 125: scanning = 0;
|
|
83
|
+
// ;
|
|
84
|
+
case 59 + offset: if (ampersand == -1) characters = Utility.replace(characters, /\f/g, '');
|
|
85
|
+
if (property > 0 && (Utility.strlen(characters) - length))
|
|
86
|
+
Utility.append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility.replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations);
|
|
87
|
+
break
|
|
88
|
+
// @ ;
|
|
89
|
+
case 59: characters += ';';
|
|
90
|
+
// { rule/at-rule
|
|
91
|
+
default:
|
|
92
|
+
Utility.append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
|
|
93
|
+
|
|
94
|
+
if (character === 123)
|
|
95
|
+
if (offset === 0)
|
|
96
|
+
parse(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
97
|
+
else
|
|
98
|
+
switch (atrule === 99 && Utility.charat(characters, 3) === 110 ? 100 : atrule) {
|
|
99
|
+
// d l m s
|
|
100
|
+
case 100: case 108: case 109: case 115:
|
|
101
|
+
parse(value, reference, reference, rule && Utility.append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
102
|
+
break
|
|
103
|
+
default:
|
|
104
|
+
parse(characters, reference, reference, reference, [''], children, 0, points, children);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo;
|
|
109
|
+
break
|
|
110
|
+
// :
|
|
111
|
+
case 58:
|
|
112
|
+
length = 1 + Utility.strlen(characters), property = previous;
|
|
113
|
+
default:
|
|
114
|
+
if (variable < 1)
|
|
115
|
+
if (character == 123)
|
|
116
|
+
--variable;
|
|
117
|
+
else if (character == 125 && variable++ == 0 && Tokenizer.prev() == 125)
|
|
118
|
+
continue
|
|
119
|
+
|
|
120
|
+
switch (characters += Utility.from(character), character * variable) {
|
|
121
|
+
// &
|
|
122
|
+
case 38:
|
|
123
|
+
ampersand = offset > 0 ? 1 : (characters += '\f', -1);
|
|
124
|
+
break
|
|
125
|
+
// ,
|
|
126
|
+
case 44:
|
|
127
|
+
points[index++] = (Utility.strlen(characters) - 1) * ampersand, ampersand = 1;
|
|
128
|
+
break
|
|
129
|
+
// @
|
|
130
|
+
case 64:
|
|
131
|
+
// -
|
|
132
|
+
if (Tokenizer.peek() === 45)
|
|
133
|
+
characters += Tokenizer.delimit(Tokenizer.next());
|
|
134
|
+
|
|
135
|
+
atrule = Tokenizer.peek(), offset = length = Utility.strlen(type = characters += Tokenizer.identifier(Tokenizer.caret())), character++;
|
|
136
|
+
break
|
|
137
|
+
// -
|
|
138
|
+
case 45:
|
|
139
|
+
if (previous === 45 && Utility.strlen(characters) == 2)
|
|
140
|
+
variable = 0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return rulesets
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @param {string} value
|
|
149
|
+
* @param {object} root
|
|
150
|
+
* @param {object?} parent
|
|
151
|
+
* @param {number} index
|
|
152
|
+
* @param {number} offset
|
|
153
|
+
* @param {string[]} rules
|
|
154
|
+
* @param {number[]} points
|
|
155
|
+
* @param {string} type
|
|
156
|
+
* @param {string[]} props
|
|
157
|
+
* @param {string[]} children
|
|
158
|
+
* @param {number} length
|
|
159
|
+
* @return {object}
|
|
160
|
+
*/
|
|
161
|
+
function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
|
|
162
|
+
var post = offset - 1;
|
|
163
|
+
var rule = offset === 0 ? rules : [''];
|
|
164
|
+
var size = Utility.sizeof(rule);
|
|
165
|
+
|
|
166
|
+
for (var i = 0, j = 0, k = 0; i < index; ++i)
|
|
167
|
+
for (var x = 0, y = Utility.substr(value, post + 1, post = Utility.abs(j = points[i])), z = value; x < size; ++x)
|
|
168
|
+
if (z = Utility.trim(j > 0 ? rule[x] + ' ' + y : Utility.replace(y, /&\f/g, rule[x])))
|
|
169
|
+
props[k++] = z;
|
|
170
|
+
|
|
171
|
+
return Tokenizer.node(value, root, parent, offset === 0 ? Enum.RULESET : type, props, children, length)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @param {number} value
|
|
176
|
+
* @param {object} root
|
|
177
|
+
* @param {object?} parent
|
|
178
|
+
* @return {object}
|
|
179
|
+
*/
|
|
180
|
+
function comment (value, root, parent) {
|
|
181
|
+
return Tokenizer.node(value, root, parent, Enum.COMMENT, Utility.from(Tokenizer.char()), Utility.substr(value, 2, -2), 0)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @param {string} value
|
|
186
|
+
* @param {object} root
|
|
187
|
+
* @param {object?} parent
|
|
188
|
+
* @param {number} length
|
|
189
|
+
* @return {object}
|
|
190
|
+
*/
|
|
191
|
+
function declaration (value, root, parent, length) {
|
|
192
|
+
return Tokenizer.node(value, root, parent, Enum.DECLARATION, Utility.substr(value, 0, length), Utility.substr(value, length + 1, -1), length)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
exports.comment = comment;
|
|
196
|
+
exports.compile = compile;
|
|
197
|
+
exports.declaration = declaration;
|
|
198
|
+
exports.parse = parse;
|
|
199
|
+
exports.ruleset = ruleset;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Enum = require('./Enum.js');
|
|
4
|
+
var Utility = require('./Utility.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {object[]} children
|
|
8
|
+
* @param {function} callback
|
|
9
|
+
* @return {string}
|
|
10
|
+
*/
|
|
11
|
+
function serialize (children, callback) {
|
|
12
|
+
var output = '';
|
|
13
|
+
var length = Utility.sizeof(children);
|
|
14
|
+
|
|
15
|
+
for (var i = 0; i < length; i++)
|
|
16
|
+
output += callback(children[i], i, children, callback) || '';
|
|
17
|
+
|
|
18
|
+
return output
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {object} element
|
|
23
|
+
* @param {number} index
|
|
24
|
+
* @param {object[]} children
|
|
25
|
+
* @param {function} callback
|
|
26
|
+
* @return {string}
|
|
27
|
+
*/
|
|
28
|
+
function stringify (element, index, children, callback) {
|
|
29
|
+
switch (element.type) {
|
|
30
|
+
case Enum.LAYER: if (element.children.length) break
|
|
31
|
+
case Enum.IMPORT: case Enum.DECLARATION: return element.return = element.return || element.value
|
|
32
|
+
case Enum.COMMENT: return ''
|
|
33
|
+
case Enum.KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
|
34
|
+
case Enum.RULESET: element.value = element.props.join(',');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return Utility.strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.serialize = serialize;
|
|
41
|
+
exports.stringify = stringify;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Utility = require('./Utility.js');
|
|
4
|
+
|
|
5
|
+
exports.line = 1;
|
|
6
|
+
exports.column = 1;
|
|
7
|
+
exports.length = 0;
|
|
8
|
+
exports.position = 0;
|
|
9
|
+
exports.character = 0;
|
|
10
|
+
exports.characters = '';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} value
|
|
14
|
+
* @param {object | null} root
|
|
15
|
+
* @param {object | null} parent
|
|
16
|
+
* @param {string} type
|
|
17
|
+
* @param {string[] | string} props
|
|
18
|
+
* @param {object[] | string} children
|
|
19
|
+
* @param {number} length
|
|
20
|
+
*/
|
|
21
|
+
function node (value, root, parent, type, props, children, length) {
|
|
22
|
+
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: exports.line, column: exports.column, length: length, return: ''}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {object} root
|
|
27
|
+
* @param {object} props
|
|
28
|
+
* @return {object}
|
|
29
|
+
*/
|
|
30
|
+
function copy (root, props) {
|
|
31
|
+
return Utility.assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @return {number}
|
|
36
|
+
*/
|
|
37
|
+
function char () {
|
|
38
|
+
return exports.character
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @return {number}
|
|
43
|
+
*/
|
|
44
|
+
function prev () {
|
|
45
|
+
exports.character = exports.position > 0 ? Utility.charat(exports.characters, --exports.position) : 0;
|
|
46
|
+
|
|
47
|
+
if (exports.column--, exports.character === 10)
|
|
48
|
+
exports.column = 1, exports.line--;
|
|
49
|
+
|
|
50
|
+
return exports.character
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @return {number}
|
|
55
|
+
*/
|
|
56
|
+
function next () {
|
|
57
|
+
exports.character = exports.position < exports.length ? Utility.charat(exports.characters, exports.position++) : 0;
|
|
58
|
+
|
|
59
|
+
if (exports.column++, exports.character === 10)
|
|
60
|
+
exports.column = 1, exports.line++;
|
|
61
|
+
|
|
62
|
+
return exports.character
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @return {number}
|
|
67
|
+
*/
|
|
68
|
+
function peek () {
|
|
69
|
+
return Utility.charat(exports.characters, exports.position)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @return {number}
|
|
74
|
+
*/
|
|
75
|
+
function caret () {
|
|
76
|
+
return exports.position
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {number} begin
|
|
81
|
+
* @param {number} end
|
|
82
|
+
* @return {string}
|
|
83
|
+
*/
|
|
84
|
+
function slice (begin, end) {
|
|
85
|
+
return Utility.substr(exports.characters, begin, end)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @param {number} type
|
|
90
|
+
* @return {number}
|
|
91
|
+
*/
|
|
92
|
+
function token (type) {
|
|
93
|
+
switch (type) {
|
|
94
|
+
// \0 \t \n \r \s whitespace token
|
|
95
|
+
case 0: case 9: case 10: case 13: case 32:
|
|
96
|
+
return 5
|
|
97
|
+
// ! + , / > @ ~ isolate token
|
|
98
|
+
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
|
|
99
|
+
// ; { } breakpoint token
|
|
100
|
+
case 59: case 123: case 125:
|
|
101
|
+
return 4
|
|
102
|
+
// : accompanied token
|
|
103
|
+
case 58:
|
|
104
|
+
return 3
|
|
105
|
+
// " ' ( [ opening delimit token
|
|
106
|
+
case 34: case 39: case 40: case 91:
|
|
107
|
+
return 2
|
|
108
|
+
// ) ] closing delimit token
|
|
109
|
+
case 41: case 93:
|
|
110
|
+
return 1
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return 0
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @param {string} value
|
|
118
|
+
* @return {any[]}
|
|
119
|
+
*/
|
|
120
|
+
function alloc (value) {
|
|
121
|
+
return exports.line = exports.column = 1, exports.length = Utility.strlen(exports.characters = value), exports.position = 0, []
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @param {any} value
|
|
126
|
+
* @return {any}
|
|
127
|
+
*/
|
|
128
|
+
function dealloc (value) {
|
|
129
|
+
return exports.characters = '', value
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {number} type
|
|
134
|
+
* @return {string}
|
|
135
|
+
*/
|
|
136
|
+
function delimit (type) {
|
|
137
|
+
return Utility.trim(slice(exports.position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @param {number} type
|
|
142
|
+
* @return {string}
|
|
143
|
+
*/
|
|
144
|
+
function whitespace (type) {
|
|
145
|
+
while (exports.character = peek())
|
|
146
|
+
if (exports.character < 33)
|
|
147
|
+
next();
|
|
148
|
+
else
|
|
149
|
+
break
|
|
150
|
+
|
|
151
|
+
return token(type) > 2 || token(exports.character) > 3 ? '' : ' '
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @param {number} index
|
|
156
|
+
* @param {number} count
|
|
157
|
+
* @return {string}
|
|
158
|
+
*/
|
|
159
|
+
function escaping (index, count) {
|
|
160
|
+
while (--count && next())
|
|
161
|
+
// not 0-9 A-F a-f
|
|
162
|
+
if (exports.character < 48 || exports.character > 102 || (exports.character > 57 && exports.character < 65) || (exports.character > 70 && exports.character < 97))
|
|
163
|
+
break
|
|
164
|
+
|
|
165
|
+
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @param {number} type
|
|
170
|
+
* @return {number}
|
|
171
|
+
*/
|
|
172
|
+
function delimiter (type) {
|
|
173
|
+
while (next())
|
|
174
|
+
switch (exports.character) {
|
|
175
|
+
// ] ) " '
|
|
176
|
+
case type:
|
|
177
|
+
return exports.position
|
|
178
|
+
// " '
|
|
179
|
+
case 34: case 39:
|
|
180
|
+
if (type !== 34 && type !== 39)
|
|
181
|
+
delimiter(exports.character);
|
|
182
|
+
break
|
|
183
|
+
// (
|
|
184
|
+
case 40:
|
|
185
|
+
if (type === 41)
|
|
186
|
+
delimiter(type);
|
|
187
|
+
break
|
|
188
|
+
// \
|
|
189
|
+
case 92:
|
|
190
|
+
next();
|
|
191
|
+
break
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return exports.position
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @param {number} type
|
|
199
|
+
* @param {number} index
|
|
200
|
+
* @return {number}
|
|
201
|
+
*/
|
|
202
|
+
function commenter (type, index) {
|
|
203
|
+
while (next())
|
|
204
|
+
// //
|
|
205
|
+
if (type + exports.character === 47 + 10)
|
|
206
|
+
break
|
|
207
|
+
// /*
|
|
208
|
+
else if (type + exports.character === 42 + 42 && peek() === 47)
|
|
209
|
+
break
|
|
210
|
+
|
|
211
|
+
return '/*' + slice(index, exports.position - 1) + '*' + Utility.from(type === 47 ? type : next())
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @param {number} index
|
|
216
|
+
* @return {string}
|
|
217
|
+
*/
|
|
218
|
+
function identifier (index) {
|
|
219
|
+
while (!token(peek()))
|
|
220
|
+
next();
|
|
221
|
+
|
|
222
|
+
return slice(index, exports.position)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
exports.alloc = alloc;
|
|
226
|
+
exports.caret = caret;
|
|
227
|
+
exports.char = char;
|
|
228
|
+
exports.commenter = commenter;
|
|
229
|
+
exports.copy = copy;
|
|
230
|
+
exports.dealloc = dealloc;
|
|
231
|
+
exports.delimit = delimit;
|
|
232
|
+
exports.delimiter = delimiter;
|
|
233
|
+
exports.escaping = escaping;
|
|
234
|
+
exports.identifier = identifier;
|
|
235
|
+
exports.next = next;
|
|
236
|
+
exports.node = node;
|
|
237
|
+
exports.peek = peek;
|
|
238
|
+
exports.prev = prev;
|
|
239
|
+
exports.slice = slice;
|
|
240
|
+
exports.token = token;
|
|
241
|
+
exports.whitespace = whitespace;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {number}
|
|
5
|
+
* @return {number}
|
|
6
|
+
*/
|
|
7
|
+
var abs = Math.abs;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {number}
|
|
11
|
+
* @return {string}
|
|
12
|
+
*/
|
|
13
|
+
var from = String.fromCharCode;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {object}
|
|
17
|
+
* @return {object}
|
|
18
|
+
*/
|
|
19
|
+
var assign = Object.assign;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} value
|
|
23
|
+
* @param {number} length
|
|
24
|
+
* @return {number}
|
|
25
|
+
*/
|
|
26
|
+
function hash (value, length) {
|
|
27
|
+
return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} value
|
|
32
|
+
* @return {string}
|
|
33
|
+
*/
|
|
34
|
+
function trim (value) {
|
|
35
|
+
return value.trim()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} value
|
|
40
|
+
* @param {RegExp} pattern
|
|
41
|
+
* @return {string?}
|
|
42
|
+
*/
|
|
43
|
+
function match (value, pattern) {
|
|
44
|
+
return (value = pattern.exec(value)) ? value[0] : value
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} value
|
|
49
|
+
* @param {(string|RegExp)} pattern
|
|
50
|
+
* @param {string} replacement
|
|
51
|
+
* @return {string}
|
|
52
|
+
*/
|
|
53
|
+
function replace (value, pattern, replacement) {
|
|
54
|
+
return value.replace(pattern, replacement)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {string} value
|
|
59
|
+
* @param {string} search
|
|
60
|
+
* @return {number}
|
|
61
|
+
*/
|
|
62
|
+
function indexof (value, search) {
|
|
63
|
+
return value.indexOf(search)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {string} value
|
|
68
|
+
* @param {number} index
|
|
69
|
+
* @return {number}
|
|
70
|
+
*/
|
|
71
|
+
function charat (value, index) {
|
|
72
|
+
return value.charCodeAt(index) | 0
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @param {string} value
|
|
77
|
+
* @param {number} begin
|
|
78
|
+
* @param {number} end
|
|
79
|
+
* @return {string}
|
|
80
|
+
*/
|
|
81
|
+
function substr (value, begin, end) {
|
|
82
|
+
return value.slice(begin, end)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {string} value
|
|
87
|
+
* @return {number}
|
|
88
|
+
*/
|
|
89
|
+
function strlen (value) {
|
|
90
|
+
return value.length
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @param {any[]} value
|
|
95
|
+
* @return {number}
|
|
96
|
+
*/
|
|
97
|
+
function sizeof (value) {
|
|
98
|
+
return value.length
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {any} value
|
|
103
|
+
* @param {any[]} array
|
|
104
|
+
* @return {any}
|
|
105
|
+
*/
|
|
106
|
+
function append (value, array) {
|
|
107
|
+
return array.push(value), value
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {string[]} array
|
|
112
|
+
* @param {function} callback
|
|
113
|
+
* @return {string}
|
|
114
|
+
*/
|
|
115
|
+
function combine (array, callback) {
|
|
116
|
+
return array.map(callback).join('')
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
exports.abs = abs;
|
|
120
|
+
exports.append = append;
|
|
121
|
+
exports.assign = assign;
|
|
122
|
+
exports.charat = charat;
|
|
123
|
+
exports.combine = combine;
|
|
124
|
+
exports.from = from;
|
|
125
|
+
exports.hash = hash;
|
|
126
|
+
exports.indexof = indexof;
|
|
127
|
+
exports.match = match;
|
|
128
|
+
exports.replace = replace;
|
|
129
|
+
exports.sizeof = sizeof;
|
|
130
|
+
exports.strlen = strlen;
|
|
131
|
+
exports.substr = substr;
|
|
132
|
+
exports.trim = trim;
|