@fluixi-css/core 0.1.0-next.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/LICENSE +21 -0
- package/README.md +52 -0
- package/base.css +4 -0
- package/components.css +1 -0
- package/dist/base.css +4 -0
- package/dist/components.css +1 -0
- package/dist/index.css +2 -0
- package/dist/package.json +139 -0
- package/dist/reset.css +168 -0
- package/dist/src/ast.d.ts +298 -0
- package/dist/src/ast.js +2240 -0
- package/dist/src/ast.js.map +1 -0
- package/dist/src/commons/constants.d.ts +1193 -0
- package/dist/src/commons/constants.js +1323 -0
- package/dist/src/commons/constants.js.map +1 -0
- package/dist/src/commons/helper.d.ts +1298 -0
- package/dist/src/commons/helper.js +1310 -0
- package/dist/src/commons/helper.js.map +1 -0
- package/dist/src/commons/index.d.ts +3 -0
- package/dist/src/commons/index.js +4 -0
- package/dist/src/commons/index.js.map +1 -0
- package/dist/src/commons/properties.d.ts +1431 -0
- package/dist/src/commons/properties.js +2855 -0
- package/dist/src/commons/properties.js.map +1 -0
- package/dist/src/commons/types.d.ts +359 -0
- package/dist/src/commons/types.js +4 -0
- package/dist/src/commons/types.js.map +1 -0
- package/dist/src/components/avatar/index.d.ts +19 -0
- package/dist/src/components/avatar/index.js +22 -0
- package/dist/src/components/avatar/index.js.map +1 -0
- package/dist/src/components/button/index.d.ts +48 -0
- package/dist/src/components/button/index.js +51 -0
- package/dist/src/components/button/index.js.map +1 -0
- package/dist/src/components/card/index.d.ts +44 -0
- package/dist/src/components/card/index.js +47 -0
- package/dist/src/components/card/index.js.map +1 -0
- package/dist/src/components/checkbox/index.d.ts +69 -0
- package/dist/src/components/checkbox/index.js +80 -0
- package/dist/src/components/checkbox/index.js.map +1 -0
- package/dist/src/components/daterangepicker/index.d.ts +147 -0
- package/dist/src/components/daterangepicker/index.js +150 -0
- package/dist/src/components/daterangepicker/index.js.map +1 -0
- package/dist/src/components/dialog/index.d.ts +71 -0
- package/dist/src/components/dialog/index.js +74 -0
- package/dist/src/components/dialog/index.js.map +1 -0
- package/dist/src/components/drawer/index.d.ts +26 -0
- package/dist/src/components/drawer/index.js +29 -0
- package/dist/src/components/drawer/index.js.map +1 -0
- package/dist/src/components/dropdown/index.d.ts +101 -0
- package/dist/src/components/dropdown/index.js +104 -0
- package/dist/src/components/dropdown/index.js.map +1 -0
- package/dist/src/components/forms/index.d.ts +58 -0
- package/dist/src/components/forms/index.js +62 -0
- package/dist/src/components/forms/index.js.map +1 -0
- package/dist/src/components/index.d.ts +1228 -0
- package/dist/src/components/index.js +64 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/layout/index.d.ts +28 -0
- package/dist/src/components/layout/index.js +33 -0
- package/dist/src/components/layout/index.js.map +1 -0
- package/dist/src/components/list/index.d.ts +65 -0
- package/dist/src/components/list/index.js +68 -0
- package/dist/src/components/list/index.js.map +1 -0
- package/dist/src/components/popover/index.d.ts +79 -0
- package/dist/src/components/popover/index.js +82 -0
- package/dist/src/components/popover/index.js.map +1 -0
- package/dist/src/components/radio/index.d.ts +77 -0
- package/dist/src/components/radio/index.js +80 -0
- package/dist/src/components/radio/index.js.map +1 -0
- package/dist/src/components/select/index.d.ts +102 -0
- package/dist/src/components/select/index.js +105 -0
- package/dist/src/components/select/index.js.map +1 -0
- package/dist/src/components/sidenav/index.d.ts +98 -0
- package/dist/src/components/sidenav/index.js +101 -0
- package/dist/src/components/sidenav/index.js.map +1 -0
- package/dist/src/components/table/index.d.ts +95 -0
- package/dist/src/components/table/index.js +98 -0
- package/dist/src/components/table/index.js.map +1 -0
- package/dist/src/constants.d.ts +3 -0
- package/dist/src/constants.js +29 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/css-ast.d.ts +48 -0
- package/dist/src/css-ast.js +2 -0
- package/dist/src/css-ast.js.map +1 -0
- package/dist/src/css-generator.d.ts +29 -0
- package/dist/src/css-generator.js +104 -0
- package/dist/src/css-generator.js.map +1 -0
- package/dist/src/css-helpers.d.ts +76 -0
- package/dist/src/css-helpers.js +272 -0
- package/dist/src/css-helpers.js.map +1 -0
- package/dist/src/css-lexer.d.ts +48 -0
- package/dist/src/css-lexer.js +255 -0
- package/dist/src/css-lexer.js.map +1 -0
- package/dist/src/css-parser.cjs +2047 -0
- package/dist/src/css-parser.cjs.map +1 -0
- package/dist/src/css-parser.d.ts +100 -0
- package/dist/src/css-parser.js +1098 -0
- package/dist/src/css-parser.js.map +1 -0
- package/dist/src/css-parser.mjs +2028 -0
- package/dist/src/css-parser.mjs.map +1 -0
- package/dist/src/design-system.d.ts +210 -0
- package/dist/src/design-system.js +1034 -0
- package/dist/src/design-system.js.map +1 -0
- package/dist/src/engine/ast.d.ts +44 -0
- package/dist/src/engine/ast.js +92 -0
- package/dist/src/engine/ast.js.map +1 -0
- package/dist/src/engine/atom.d.ts +74 -0
- package/dist/src/engine/atom.js +227 -0
- package/dist/src/engine/atom.js.map +1 -0
- package/dist/src/engine/compile.d.ts +5 -0
- package/dist/src/engine/compile.js +79 -0
- package/dist/src/engine/compile.js.map +1 -0
- package/dist/src/engine/defaults.d.ts +2 -0
- package/dist/src/engine/defaults.js +14 -0
- package/dist/src/engine/defaults.js.map +1 -0
- package/dist/src/engine/directives.d.ts +2 -0
- package/dist/src/engine/directives.js +191 -0
- package/dist/src/engine/directives.js.map +1 -0
- package/dist/src/engine/index.d.ts +41 -0
- package/dist/src/engine/index.js +88 -0
- package/dist/src/engine/index.js.map +1 -0
- package/dist/src/engine/registry.d.ts +46 -0
- package/dist/src/engine/registry.js +49 -0
- package/dist/src/engine/registry.js.map +1 -0
- package/dist/src/engine/scanner.d.ts +1 -0
- package/dist/src/engine/scanner.js +45 -0
- package/dist/src/engine/scanner.js.map +1 -0
- package/dist/src/engine/source.d.ts +12 -0
- package/dist/src/engine/source.js +81 -0
- package/dist/src/engine/source.js.map +1 -0
- package/dist/src/engine/theme-defaults.d.ts +2 -0
- package/dist/src/engine/theme-defaults.js +54 -0
- package/dist/src/engine/theme-defaults.js.map +1 -0
- package/dist/src/engine/theme-source.d.ts +5 -0
- package/dist/src/engine/theme-source.js +71 -0
- package/dist/src/engine/theme-source.js.map +1 -0
- package/dist/src/engine/theme.d.ts +10 -0
- package/dist/src/engine/theme.js +42 -0
- package/dist/src/engine/theme.js.map +1 -0
- package/dist/src/engine/transform.d.ts +25 -0
- package/dist/src/engine/transform.js +91 -0
- package/dist/src/engine/transform.js.map +1 -0
- package/dist/src/engine/ui-preset.d.ts +4 -0
- package/dist/src/engine/ui-preset.js +56 -0
- package/dist/src/engine/ui-preset.js.map +1 -0
- package/dist/src/engine/utilities/backgrounds.d.ts +2 -0
- package/dist/src/engine/utilities/backgrounds.js +32 -0
- package/dist/src/engine/utilities/backgrounds.js.map +1 -0
- package/dist/src/engine/utilities/borders.d.ts +2 -0
- package/dist/src/engine/utilities/borders.js +95 -0
- package/dist/src/engine/utilities/borders.js.map +1 -0
- package/dist/src/engine/utilities/effects.d.ts +2 -0
- package/dist/src/engine/utilities/effects.js +61 -0
- package/dist/src/engine/utilities/effects.js.map +1 -0
- package/dist/src/engine/utilities/flexgrid.d.ts +2 -0
- package/dist/src/engine/utilities/flexgrid.js +125 -0
- package/dist/src/engine/utilities/flexgrid.js.map +1 -0
- package/dist/src/engine/utilities/index.d.ts +3 -0
- package/dist/src/engine/utilities/index.js +20 -0
- package/dist/src/engine/utilities/index.js.map +1 -0
- package/dist/src/engine/utilities/layout.d.ts +2 -0
- package/dist/src/engine/utilities/layout.js +84 -0
- package/dist/src/engine/utilities/layout.js.map +1 -0
- package/dist/src/engine/utilities/sizing.d.ts +2 -0
- package/dist/src/engine/utilities/sizing.js +21 -0
- package/dist/src/engine/utilities/sizing.js.map +1 -0
- package/dist/src/engine/utilities/spacing.d.ts +2 -0
- package/dist/src/engine/utilities/spacing.js +39 -0
- package/dist/src/engine/utilities/spacing.js.map +1 -0
- package/dist/src/engine/utilities/typography.d.ts +2 -0
- package/dist/src/engine/utilities/typography.js +120 -0
- package/dist/src/engine/utilities/typography.js.map +1 -0
- package/dist/src/engine/utilities/values.d.ts +16 -0
- package/dist/src/engine/utilities/values.js +91 -0
- package/dist/src/engine/utilities/values.js.map +1 -0
- package/dist/src/engine/variants.d.ts +2 -0
- package/dist/src/engine/variants.js +99 -0
- package/dist/src/engine/variants.js.map +1 -0
- package/dist/src/extractor.d.ts +146 -0
- package/dist/src/extractor.js +3862 -0
- package/dist/src/extractor.js.map +1 -0
- package/dist/src/index.cjs +4518 -0
- package/dist/src/index.cjs.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.mjs +4480 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/src/keyframes.cjs +367 -0
- package/dist/src/keyframes.cjs.map +1 -0
- package/dist/src/keyframes.d.ts +27 -0
- package/dist/src/keyframes.js +188 -0
- package/dist/src/keyframes.js.map +1 -0
- package/dist/src/keyframes.mjs +362 -0
- package/dist/src/keyframes.mjs.map +1 -0
- package/dist/src/logger.d.ts +2 -0
- package/dist/src/logger.js +31 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/plugin.cjs +43 -0
- package/dist/src/plugin.cjs.map +1 -0
- package/dist/src/plugin.d.ts +12 -0
- package/dist/src/plugin.js +39 -0
- package/dist/src/plugin.js.map +1 -0
- package/dist/src/plugin.mjs +41 -0
- package/dist/src/plugin.mjs.map +1 -0
- package/dist/src/presets-plugins.cjs +99 -0
- package/dist/src/presets-plugins.cjs.map +1 -0
- package/dist/src/presets-plugins.d.ts +1 -0
- package/dist/src/presets-plugins.js +56 -0
- package/dist/src/presets-plugins.js.map +1 -0
- package/dist/src/presets-plugins.mjs +97 -0
- package/dist/src/presets-plugins.mjs.map +1 -0
- package/dist/src/state.d.ts +76 -0
- package/dist/src/state.js +314 -0
- package/dist/src/state.js.map +1 -0
- package/dist/src/theme/constants.d.ts +22 -0
- package/dist/src/theme/constants.js +17 -0
- package/dist/src/theme/constants.js.map +1 -0
- package/dist/src/theme/index.d.ts +2 -0
- package/dist/src/theme/index.js +48 -0
- package/dist/src/theme/index.js.map +1 -0
- package/dist/src/theme/types.d.ts +13 -0
- package/dist/src/theme/types.js +2 -0
- package/dist/src/theme/types.js.map +1 -0
- package/dist/src/types/ast.d.ts +23 -0
- package/dist/src/types/ast.js +2 -0
- package/dist/src/types/ast.js.map +1 -0
- package/dist/src/types/base-types.d.ts +53 -0
- package/dist/src/types/base-types.js +2 -0
- package/dist/src/types/base-types.js.map +1 -0
- package/dist/src/types/components-types.d.ts +28 -0
- package/dist/src/types/components-types.js +2 -0
- package/dist/src/types/components-types.js.map +1 -0
- package/dist/src/types/config.d.ts +90 -0
- package/dist/src/types/config.js +3 -0
- package/dist/src/types/config.js.map +1 -0
- package/dist/src/types/css-parser.d.ts +361 -0
- package/dist/src/types/css-parser.js +2 -0
- package/dist/src/types/css-parser.js.map +1 -0
- package/dist/src/types/keyframes-type.d.ts +47 -0
- package/dist/src/types/keyframes-type.js +2 -0
- package/dist/src/types/keyframes-type.js.map +1 -0
- package/dist/src/types/plugin.d.ts +10 -0
- package/dist/src/types/plugin.js +2 -0
- package/dist/src/types/plugin.js.map +1 -0
- package/dist/src/types/screens-types.d.ts +47 -0
- package/dist/src/types/screens-types.js +2 -0
- package/dist/src/types/screens-types.js.map +1 -0
- package/dist/src/types/utilities-types.d.ts +147 -0
- package/dist/src/types/utilities-types.js +2 -0
- package/dist/src/types/utilities-types.js.map +1 -0
- package/dist/src/types.d.ts +77 -0
- package/dist/src/types.js +12 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/units/constants.d.ts +35 -0
- package/dist/src/units/constants.js +9 -0
- package/dist/src/units/constants.js.map +1 -0
- package/dist/src/units/index.d.ts +15 -0
- package/dist/src/units/index.js +7 -0
- package/dist/src/units/index.js.map +1 -0
- package/dist/src/units/types.d.ts +9 -0
- package/dist/src/units/types.js +2 -0
- package/dist/src/units/types.js.map +1 -0
- package/dist/src/utilities/backgrounds/constants.d.ts +2810 -0
- package/dist/src/utilities/backgrounds/constants.js +119 -0
- package/dist/src/utilities/backgrounds/constants.js.map +1 -0
- package/dist/src/utilities/backgrounds/index.d.ts +1 -0
- package/dist/src/utilities/backgrounds/index.js +2 -0
- package/dist/src/utilities/backgrounds/index.js.map +1 -0
- package/dist/src/utilities/borders/constants.d.ts +10586 -0
- package/dist/src/utilities/borders/constants.js +309 -0
- package/dist/src/utilities/borders/constants.js.map +1 -0
- package/dist/src/utilities/borders/index.d.ts +1 -0
- package/dist/src/utilities/borders/index.js +2 -0
- package/dist/src/utilities/borders/index.js.map +1 -0
- package/dist/src/utilities/breakpoints/constants.d.ts +330 -0
- package/dist/src/utilities/breakpoints/constants.js +269 -0
- package/dist/src/utilities/breakpoints/constants.js.map +1 -0
- package/dist/src/utilities/breakpoints/index.d.ts +2 -0
- package/dist/src/utilities/breakpoints/index.js +3 -0
- package/dist/src/utilities/breakpoints/index.js.map +1 -0
- package/dist/src/utilities/breakpoints/types.d.ts +8 -0
- package/dist/src/utilities/breakpoints/types.js +2 -0
- package/dist/src/utilities/breakpoints/types.js.map +1 -0
- package/dist/src/utilities/colors/base.d.ts +778 -0
- package/dist/src/utilities/colors/base.js +872 -0
- package/dist/src/utilities/colors/base.js.map +1 -0
- package/dist/src/utilities/colors/color.d.ts +1122 -0
- package/dist/src/utilities/colors/color.js +957 -0
- package/dist/src/utilities/colors/color.js.map +1 -0
- package/dist/src/utilities/colors/constants.d.ts +1 -0
- package/dist/src/utilities/colors/constants.js +2 -0
- package/dist/src/utilities/colors/constants.js.map +1 -0
- package/dist/src/utilities/colors/index.d.ts +4 -0
- package/dist/src/utilities/colors/index.js +29 -0
- package/dist/src/utilities/colors/index.js.map +1 -0
- package/dist/src/utilities/colors/types.d.ts +3 -0
- package/dist/src/utilities/colors/types.js +2 -0
- package/dist/src/utilities/colors/types.js.map +1 -0
- package/dist/src/utilities/effects/constants.d.ts +641 -0
- package/dist/src/utilities/effects/constants.js +83 -0
- package/dist/src/utilities/effects/constants.js.map +1 -0
- package/dist/src/utilities/effects/index.d.ts +1 -0
- package/dist/src/utilities/effects/index.js +2 -0
- package/dist/src/utilities/effects/index.js.map +1 -0
- package/dist/src/utilities/filters/constants.d.ts +406 -0
- package/dist/src/utilities/filters/constants.js +206 -0
- package/dist/src/utilities/filters/constants.js.map +1 -0
- package/dist/src/utilities/filters/index.d.ts +1 -0
- package/dist/src/utilities/filters/index.js +2 -0
- package/dist/src/utilities/filters/index.js.map +1 -0
- package/dist/src/utilities/flex/constants.d.ts +934 -0
- package/dist/src/utilities/flex/constants.js +221 -0
- package/dist/src/utilities/flex/constants.js.map +1 -0
- package/dist/src/utilities/flex/index.d.ts +1 -0
- package/dist/src/utilities/flex/index.js +2 -0
- package/dist/src/utilities/flex/index.js.map +1 -0
- package/dist/src/utilities/flex/types.d.ts +0 -0
- package/dist/src/utilities/flex/types.js +4 -0
- package/dist/src/utilities/flex/types.js.map +1 -0
- package/dist/src/utilities/index.d.ts +31338 -0
- package/dist/src/utilities/index.js +333 -0
- package/dist/src/utilities/index.js.map +1 -0
- package/dist/src/utilities/interactivity/constants.d.ts +1244 -0
- package/dist/src/utilities/interactivity/constants.js +165 -0
- package/dist/src/utilities/interactivity/constants.js.map +1 -0
- package/dist/src/utilities/interactivity/index.d.ts +1 -0
- package/dist/src/utilities/interactivity/index.js +2 -0
- package/dist/src/utilities/interactivity/index.js.map +1 -0
- package/dist/src/utilities/layout/constants.d.ts +837 -0
- package/dist/src/utilities/layout/constants.js +159 -0
- package/dist/src/utilities/layout/constants.js.map +1 -0
- package/dist/src/utilities/layout/index.d.ts +1 -0
- package/dist/src/utilities/layout/index.js +2 -0
- package/dist/src/utilities/layout/index.js.map +1 -0
- package/dist/src/utilities/layout/types.d.ts +0 -0
- package/dist/src/utilities/layout/types.js +2 -0
- package/dist/src/utilities/layout/types.js.map +1 -0
- package/dist/src/utilities/sizing/constants.d.ts +989 -0
- package/dist/src/utilities/sizing/constants.js +53 -0
- package/dist/src/utilities/sizing/constants.js.map +1 -0
- package/dist/src/utilities/sizing/index.d.ts +2 -0
- package/dist/src/utilities/sizing/index.js +3 -0
- package/dist/src/utilities/sizing/index.js.map +1 -0
- package/dist/src/utilities/sizing/types.d.ts +10 -0
- package/dist/src/utilities/sizing/types.js +2 -0
- package/dist/src/utilities/sizing/types.js.map +1 -0
- package/dist/src/utilities/spacing/constants.d.ts +1779 -0
- package/dist/src/utilities/spacing/constants.js +142 -0
- package/dist/src/utilities/spacing/constants.js.map +1 -0
- package/dist/src/utilities/spacing/index.d.ts +2 -0
- package/dist/src/utilities/spacing/index.js +3 -0
- package/dist/src/utilities/spacing/index.js.map +1 -0
- package/dist/src/utilities/spacing/types.d.ts +15 -0
- package/dist/src/utilities/spacing/types.js +8 -0
- package/dist/src/utilities/spacing/types.js.map +1 -0
- package/dist/src/utilities/svg/constants.d.ts +1062 -0
- package/dist/src/utilities/svg/constants.js +34 -0
- package/dist/src/utilities/svg/constants.js.map +1 -0
- package/dist/src/utilities/transforms/constants.d.ts +247 -0
- package/dist/src/utilities/transforms/constants.js +74 -0
- package/dist/src/utilities/transforms/constants.js.map +1 -0
- package/dist/src/utilities/transforms/index.d.ts +1 -0
- package/dist/src/utilities/transforms/index.js +2 -0
- package/dist/src/utilities/transforms/index.js.map +1 -0
- package/dist/src/utilities/transitions/constants.d.ts +116 -0
- package/dist/src/utilities/transitions/constants.js +91 -0
- package/dist/src/utilities/transitions/constants.js.map +1 -0
- package/dist/src/utilities/transitions/index.d.ts +1 -0
- package/dist/src/utilities/transitions/index.js +2 -0
- package/dist/src/utilities/transitions/index.js.map +1 -0
- package/dist/src/utilities/typography/constants.d.ts +2401 -0
- package/dist/src/utilities/typography/constants.js +401 -0
- package/dist/src/utilities/typography/constants.js.map +1 -0
- package/dist/src/utilities/typography/index.d.ts +1 -0
- package/dist/src/utilities/typography/index.js +2 -0
- package/dist/src/utilities/typography/index.js.map +1 -0
- package/dist/src/utils.d.ts +18 -0
- package/dist/src/utils.js +282 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/src/watcher.d.ts +15 -0
- package/dist/src/watcher.js +62 -0
- package/dist/src/watcher.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utilities.css +1 -0
- package/index.css +2 -0
- package/package.json +139 -0
- package/reset.css +168 -0
- package/utilities.css +1 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _arrayLikeToArray(r, a) {
|
|
4
|
+
(null == a || a > r.length) && (a = r.length);
|
|
5
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
6
|
+
return n;
|
|
7
|
+
}
|
|
8
|
+
function _arrayWithHoles(r) {
|
|
9
|
+
if (Array.isArray(r)) return r;
|
|
10
|
+
}
|
|
11
|
+
function _createForOfIteratorHelper(r, e) {
|
|
12
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
13
|
+
if (!t) {
|
|
14
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
15
|
+
t && (r = t);
|
|
16
|
+
var n = 0,
|
|
17
|
+
F = function () {};
|
|
18
|
+
return {
|
|
19
|
+
s: F,
|
|
20
|
+
n: function () {
|
|
21
|
+
return n >= r.length ? {
|
|
22
|
+
done: true
|
|
23
|
+
} : {
|
|
24
|
+
done: false,
|
|
25
|
+
value: r[n++]
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
e: function (r) {
|
|
29
|
+
throw r;
|
|
30
|
+
},
|
|
31
|
+
f: F
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
|
+
}
|
|
36
|
+
var o,
|
|
37
|
+
a = true,
|
|
38
|
+
u = false;
|
|
39
|
+
return {
|
|
40
|
+
s: function () {
|
|
41
|
+
t = t.call(r);
|
|
42
|
+
},
|
|
43
|
+
n: function () {
|
|
44
|
+
var r = t.next();
|
|
45
|
+
return a = r.done, r;
|
|
46
|
+
},
|
|
47
|
+
e: function (r) {
|
|
48
|
+
u = true, o = r;
|
|
49
|
+
},
|
|
50
|
+
f: function () {
|
|
51
|
+
try {
|
|
52
|
+
a || null == t.return || t.return();
|
|
53
|
+
} finally {
|
|
54
|
+
if (u) throw o;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function _defineProperty(e, r, t) {
|
|
60
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
61
|
+
value: t,
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true
|
|
65
|
+
}) : e[r] = t, e;
|
|
66
|
+
}
|
|
67
|
+
function _iterableToArrayLimit(r, l) {
|
|
68
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
69
|
+
if (null != t) {
|
|
70
|
+
var e,
|
|
71
|
+
n,
|
|
72
|
+
i,
|
|
73
|
+
u,
|
|
74
|
+
a = [],
|
|
75
|
+
f = true,
|
|
76
|
+
o = false;
|
|
77
|
+
try {
|
|
78
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
79
|
+
} catch (r) {
|
|
80
|
+
o = true, n = r;
|
|
81
|
+
} finally {
|
|
82
|
+
try {
|
|
83
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
84
|
+
} finally {
|
|
85
|
+
if (o) throw n;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return a;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function _nonIterableRest() {
|
|
92
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
93
|
+
}
|
|
94
|
+
function ownKeys(e, r) {
|
|
95
|
+
var t = Object.keys(e);
|
|
96
|
+
if (Object.getOwnPropertySymbols) {
|
|
97
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
98
|
+
r && (o = o.filter(function (r) {
|
|
99
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
100
|
+
})), t.push.apply(t, o);
|
|
101
|
+
}
|
|
102
|
+
return t;
|
|
103
|
+
}
|
|
104
|
+
function _objectSpread2(e) {
|
|
105
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
106
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
107
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
108
|
+
_defineProperty(e, r, t[r]);
|
|
109
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
110
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return e;
|
|
114
|
+
}
|
|
115
|
+
function _slicedToArray(r, e) {
|
|
116
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
117
|
+
}
|
|
118
|
+
function _toPrimitive(t, r) {
|
|
119
|
+
if ("object" != typeof t || !t) return t;
|
|
120
|
+
var e = t[Symbol.toPrimitive];
|
|
121
|
+
if (void 0 !== e) {
|
|
122
|
+
var i = e.call(t, r);
|
|
123
|
+
if ("object" != typeof i) return i;
|
|
124
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
125
|
+
}
|
|
126
|
+
return ("string" === r ? String : Number)(t);
|
|
127
|
+
}
|
|
128
|
+
function _toPropertyKey(t) {
|
|
129
|
+
var i = _toPrimitive(t, "string");
|
|
130
|
+
return "symbol" == typeof i ? i : i + "";
|
|
131
|
+
}
|
|
132
|
+
function _unsupportedIterableToArray(r, a) {
|
|
133
|
+
if (r) {
|
|
134
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
135
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
136
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var DEFAULT_OPTIONS = {
|
|
141
|
+
prefix: 'fluixi-',
|
|
142
|
+
useRawValues: false,
|
|
143
|
+
transformValues: true,
|
|
144
|
+
includeDefaults: true
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Converts camelCase to kebab-case
|
|
149
|
+
*/
|
|
150
|
+
function toKebabCase(str) {
|
|
151
|
+
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Formats CSS property value
|
|
156
|
+
*/
|
|
157
|
+
function formatValue(property, value, options) {
|
|
158
|
+
if (!options.transformValues) return String(value);
|
|
159
|
+
|
|
160
|
+
// Handle numeric values
|
|
161
|
+
if (typeof value === 'number') {
|
|
162
|
+
if (/^(z|opacity|flex|order|grid-row|grid-column)/.test(property)) {
|
|
163
|
+
return String(value);
|
|
164
|
+
}
|
|
165
|
+
return "".concat(value, "px");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Handle transform functions
|
|
169
|
+
if (property === 'transform' && !value.includes('(')) {
|
|
170
|
+
return "".concat(value, "(1)");
|
|
171
|
+
}
|
|
172
|
+
return value;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Validates keyframe selectors
|
|
177
|
+
*/
|
|
178
|
+
function isValidKeyframeSelector(selector) {
|
|
179
|
+
if (selector === 'from' || selector === 'to') return true;
|
|
180
|
+
if (/%$/.test(selector)) {
|
|
181
|
+
var num = parseFloat(selector);
|
|
182
|
+
return !isNaN(num) && num >= 0 && num <= 100;
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
function parseStyles(styles) {
|
|
187
|
+
if (typeof styles === 'string') {
|
|
188
|
+
var declarations = styles.split(';');
|
|
189
|
+
var styles_data = {};
|
|
190
|
+
var _iterator = _createForOfIteratorHelper(declarations),
|
|
191
|
+
_step;
|
|
192
|
+
try {
|
|
193
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
194
|
+
var declaration = _step.value;
|
|
195
|
+
var _declaration$split = declaration.split(':'),
|
|
196
|
+
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
197
|
+
key = _declaration$split2[0],
|
|
198
|
+
value = _declaration$split2[1];
|
|
199
|
+
styles_data[key] = value;
|
|
200
|
+
}
|
|
201
|
+
} catch (err) {
|
|
202
|
+
_iterator.e(err);
|
|
203
|
+
} finally {
|
|
204
|
+
_iterator.f();
|
|
205
|
+
}
|
|
206
|
+
return styles_data;
|
|
207
|
+
}
|
|
208
|
+
return styles;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Creates CSS rules for a keyframe definition
|
|
213
|
+
*/
|
|
214
|
+
function createKeyframeRules(definition, options) {
|
|
215
|
+
var rules = [];
|
|
216
|
+
for (var _i = 0, _Object$entries = Object.entries(definition); _i < _Object$entries.length; _i++) {
|
|
217
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
218
|
+
selector = _Object$entries$_i[0],
|
|
219
|
+
_styles = _Object$entries$_i[1];
|
|
220
|
+
var styles = parseStyles(_styles);
|
|
221
|
+
if (!isValidKeyframeSelector(selector)) {
|
|
222
|
+
console.warn("Invalid keyframe selector: ".concat(selector));
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
var styleRules = Object.entries(styles).map(function (_ref) {
|
|
226
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
227
|
+
prop = _ref2[0],
|
|
228
|
+
value = _ref2[1];
|
|
229
|
+
var kebabProp = toKebabCase(prop);
|
|
230
|
+
var formattedValue = formatValue(kebabProp, value, options);
|
|
231
|
+
return " ".concat(kebabProp, ": ").concat(formattedValue, ";");
|
|
232
|
+
}).join('\n');
|
|
233
|
+
rules.push(" ".concat(selector, " {\n").concat(styleRules, "\n }"));
|
|
234
|
+
}
|
|
235
|
+
return rules.join('\n\n');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Creates a complete keyframe rule
|
|
240
|
+
*/
|
|
241
|
+
function createKeyframeRule(name, definition) {
|
|
242
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_OPTIONS;
|
|
243
|
+
var prefix = options.prefix || '';
|
|
244
|
+
var keyframeName = "".concat(prefix).concat(name);
|
|
245
|
+
var rules = createKeyframeRules(definition, options);
|
|
246
|
+
return "@keyframes ".concat(keyframeName, " {\n").concat(rules, "\n}");
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Normalizes keyframes configuration
|
|
251
|
+
*/
|
|
252
|
+
function normalizeKeyframes(keyframes) {
|
|
253
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_OPTIONS;
|
|
254
|
+
var normalized = {};
|
|
255
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(keyframes); _i2 < _Object$entries2.length; _i2++) {
|
|
256
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
257
|
+
name = _Object$entries2$_i[0],
|
|
258
|
+
definition = _Object$entries2$_i[1];
|
|
259
|
+
try {
|
|
260
|
+
normalized[name] = createKeyframeRule(name, definition, options);
|
|
261
|
+
} catch (error) {
|
|
262
|
+
console.error("Error processing keyframe '".concat(name, "':"), error);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return normalized;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Generates animation utilities from keyframes
|
|
270
|
+
*/
|
|
271
|
+
function generateAnimationUtilities(keyframes) {
|
|
272
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_OPTIONS;
|
|
273
|
+
var utilities = {};
|
|
274
|
+
var prefix = options.prefix || '';
|
|
275
|
+
for (var _i3 = 0, _Object$keys = Object.keys(keyframes); _i3 < _Object$keys.length; _i3++) {
|
|
276
|
+
var name = _Object$keys[_i3];
|
|
277
|
+
utilities["animate-".concat(name)] = {
|
|
278
|
+
animation: "".concat(prefix).concat(name, " var(--fluixi-animation-duration, 1s) var(--fluixi-animation-timing, linear) var(--fluixi-animation-iteration, infinite)")
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
return utilities;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Combines all keyframe-related processing
|
|
286
|
+
*/
|
|
287
|
+
function processKeyframes(keyframes) {
|
|
288
|
+
var _options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_OPTIONS;
|
|
289
|
+
var options = _options || DEFAULT_OPTIONS;
|
|
290
|
+
// Merge with default options
|
|
291
|
+
var mergedOptions = _objectSpread2(_objectSpread2({}, DEFAULT_OPTIONS), options);
|
|
292
|
+
|
|
293
|
+
// Process keyframes
|
|
294
|
+
var normalizedKeyframes = normalizeKeyframes(keyframes, mergedOptions);
|
|
295
|
+
var keyframeRules = Object.values(normalizedKeyframes);
|
|
296
|
+
|
|
297
|
+
// Generate utilities
|
|
298
|
+
var utilities = generateAnimationUtilities(keyframes, mergedOptions);
|
|
299
|
+
return {
|
|
300
|
+
keyframeRules: keyframeRules,
|
|
301
|
+
utilities: utilities
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// /**
|
|
306
|
+
// * Default keyframe animations
|
|
307
|
+
// */
|
|
308
|
+
// export const DEFAULT_KEYFRAMES: KeyframesConfig = {
|
|
309
|
+
// spin: {
|
|
310
|
+
// from: {
|
|
311
|
+
// transform: 'rotate(0deg)'
|
|
312
|
+
// },
|
|
313
|
+
// to: {
|
|
314
|
+
// transform: 'rotate(360deg)'
|
|
315
|
+
// }
|
|
316
|
+
// },
|
|
317
|
+
// ping: {
|
|
318
|
+
// '75%, 100%': {
|
|
319
|
+
// transform: 'scale(2)',
|
|
320
|
+
// opacity: '0'
|
|
321
|
+
// }
|
|
322
|
+
// },
|
|
323
|
+
// pulse: {
|
|
324
|
+
// '0%, 100%': {
|
|
325
|
+
// opacity: '1'
|
|
326
|
+
// },
|
|
327
|
+
// '50%': {
|
|
328
|
+
// opacity: '.5'
|
|
329
|
+
// }
|
|
330
|
+
// },
|
|
331
|
+
// bounce: {
|
|
332
|
+
// '0%, 100%': {
|
|
333
|
+
// transform: 'translateY(-25%)',
|
|
334
|
+
// animationTimingFunction: 'cubic-bezier(0.8,0,1,1)'
|
|
335
|
+
// },
|
|
336
|
+
// '50%': {
|
|
337
|
+
// transform: 'none',
|
|
338
|
+
// animationTimingFunction: 'cubic-bezier(0,0,0.2,1)'
|
|
339
|
+
// }
|
|
340
|
+
// },
|
|
341
|
+
// 'fade-in': {
|
|
342
|
+
// from: {
|
|
343
|
+
// opacity: '0'
|
|
344
|
+
// },
|
|
345
|
+
// to: {
|
|
346
|
+
// opacity: '1'
|
|
347
|
+
// }
|
|
348
|
+
// },
|
|
349
|
+
// 'slide-in': {
|
|
350
|
+
// from: {
|
|
351
|
+
// transform: 'translateX(-100%)'
|
|
352
|
+
// },
|
|
353
|
+
// to: {
|
|
354
|
+
// transform: 'translateX(0)'
|
|
355
|
+
// }
|
|
356
|
+
// }
|
|
357
|
+
// };
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Usage example
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
exports.createKeyframeRule = createKeyframeRule;
|
|
364
|
+
exports.generateAnimationUtilities = generateAnimationUtilities;
|
|
365
|
+
exports.normalizeKeyframes = normalizeKeyframes;
|
|
366
|
+
exports.processKeyframes = processKeyframes;
|
|
367
|
+
//# sourceMappingURL=keyframes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyframes.cjs","sources":["../../src/keyframes.ts"],"sourcesContent":["import { KeyframeDefinition, KeyframesConfig, KeyframesOptions, KeyframeStyles } from './types/keyframes-type.js';\n\nconst DEFAULT_OPTIONS: KeyframesOptions = {\n prefix: 'fluixi-',\n useRawValues: false,\n transformValues: true,\n includeDefaults: true\n};\n\n/**\n * Converts camelCase to kebab-case\n */\nfunction toKebabCase(str: string): string {\n return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\n/**\n * Formats CSS property value\n */\nfunction formatValue(property: string, value: string | number, options: KeyframesOptions): string {\n if (!options.transformValues) return String(value);\n\n // Handle numeric values\n if (typeof value === 'number') {\n if (/^(z|opacity|flex|order|grid-row|grid-column)/.test(property)) {\n return String(value);\n }\n return `${value}px`;\n }\n\n // Handle transform functions\n if (property === 'transform' && !value.includes('(')) {\n return `${value}(1)`;\n }\n\n return value;\n}\n\n/**\n * Validates keyframe selectors\n */\nfunction isValidKeyframeSelector(selector: string): boolean {\n if (selector === 'from' || selector === 'to') return true;\n if (/%$/.test(selector)) {\n const num = parseFloat(selector);\n return !isNaN(num) && num >= 0 && num <= 100;\n }\n return false;\n}\n\nfunction parseStyles(styles: KeyframeStyles | string): KeyframeStyles {\n if (typeof styles === 'string') {\n const declarations = styles.split(';');\n const styles_data: KeyframeStyles = {};\n for(const declaration of declarations){\n const [key, value] = declaration.split(':');\n styles_data[key] = value;\n }\n return styles_data;\n }\n return styles;\n}\n\n/**\n * Creates CSS rules for a keyframe definition\n */\nfunction createKeyframeRules(definition: KeyframeDefinition, options: KeyframesOptions): string {\n let rules: string[] = [];\n\n for (const [selector, _styles] of Object.entries(definition)) {\n const styles = parseStyles(_styles);\n if (!isValidKeyframeSelector(selector)) {\n console.warn(`Invalid keyframe selector: ${selector}`);\n continue;\n }\n\n const styleRules = Object.entries(styles)\n .map(([prop, value]) => {\n const kebabProp = toKebabCase(prop);\n const formattedValue = formatValue(kebabProp, value, options);\n return ` ${kebabProp}: ${formattedValue};`;\n })\n .join('\\n');\n\n rules.push(` ${selector} {\\n${styleRules}\\n }`);\n }\n\n return rules.join('\\n\\n');\n}\n\n/**\n * Creates a complete keyframe rule\n */\nexport function createKeyframeRule(\n name: string,\n definition: KeyframeDefinition,\n options: KeyframesOptions = DEFAULT_OPTIONS\n): string {\n const prefix = options.prefix || '';\n const keyframeName = `${prefix}${name}`;\n const rules = createKeyframeRules(definition, options);\n\n return `@keyframes ${keyframeName} {\\n${rules}\\n}`;\n}\n\n/**\n * Normalizes keyframes configuration\n */\nexport function normalizeKeyframes(\n keyframes: KeyframesConfig,\n options: KeyframesOptions = DEFAULT_OPTIONS\n): Record<string, string> {\n const normalized: Record<string, string> = {};\n\n for (const [name, definition] of Object.entries(keyframes)) {\n try {\n normalized[name] = createKeyframeRule(name, definition, options);\n } catch (error) {\n console.error(`Error processing keyframe '${name}':`, error);\n }\n }\n\n return normalized;\n}\n\n/**\n * Generates animation utilities from keyframes\n */\nexport function generateAnimationUtilities(\n keyframes: KeyframesConfig,\n options: KeyframesOptions = DEFAULT_OPTIONS\n): Record<string, { animation: string }> {\n const utilities: Record<string, { animation: string }> = {};\n const prefix = options.prefix || '';\n\n for (const name of Object.keys(keyframes)) {\n utilities[`animate-${name}`] = {\n animation: `${prefix}${name} var(--fluixi-animation-duration, 1s) var(--fluixi-animation-timing, linear) var(--fluixi-animation-iteration, infinite)`\n };\n }\n\n return utilities;\n}\n\n/**\n * Combines all keyframe-related processing\n */\nexport function processKeyframes(\n keyframes: KeyframesConfig,\n _options: KeyframesOptions = DEFAULT_OPTIONS\n): {\n keyframeRules: string[];\n utilities: Record<string, { animation: string }>;\n} {\n const options = _options || DEFAULT_OPTIONS;\n // Merge with default options\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n\n // Process keyframes\n const normalizedKeyframes = normalizeKeyframes(keyframes, mergedOptions);\n const keyframeRules = Object.values(normalizedKeyframes);\n\n // Generate utilities\n const utilities = generateAnimationUtilities(keyframes, mergedOptions);\n\n return {\n keyframeRules,\n utilities\n };\n}\n\n// /**\n// * Default keyframe animations\n// */\n// export const DEFAULT_KEYFRAMES: KeyframesConfig = {\n// spin: {\n// from: {\n// transform: 'rotate(0deg)'\n// },\n// to: {\n// transform: 'rotate(360deg)'\n// }\n// },\n// ping: {\n// '75%, 100%': {\n// transform: 'scale(2)',\n// opacity: '0'\n// }\n// },\n// pulse: {\n// '0%, 100%': {\n// opacity: '1'\n// },\n// '50%': {\n// opacity: '.5'\n// }\n// },\n// bounce: {\n// '0%, 100%': {\n// transform: 'translateY(-25%)',\n// animationTimingFunction: 'cubic-bezier(0.8,0,1,1)'\n// },\n// '50%': {\n// transform: 'none',\n// animationTimingFunction: 'cubic-bezier(0,0,0.2,1)'\n// }\n// },\n// 'fade-in': {\n// from: {\n// opacity: '0'\n// },\n// to: {\n// opacity: '1'\n// }\n// },\n// 'slide-in': {\n// from: {\n// transform: 'translateX(-100%)'\n// },\n// to: {\n// transform: 'translateX(0)'\n// }\n// }\n// };\n\n/**\n * Usage example\n */\n"],"names":["DEFAULT_OPTIONS","prefix","useRawValues","transformValues","includeDefaults","toKebabCase","str","replace","toLowerCase","formatValue","property","value","options","String","test","concat","includes","isValidKeyframeSelector","selector","num","parseFloat","isNaN","parseStyles","styles","declarations","split","styles_data","_iterator","_createForOfIteratorHelper","_step","s","n","done","declaration","_declaration$split","_declaration$split2","_slicedToArray","key","err","e","f","createKeyframeRules","definition","rules","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_styles","console","warn","styleRules","map","_ref","_ref2","prop","kebabProp","formattedValue","join","push","createKeyframeRule","name","arguments","undefined","keyframeName","normalizeKeyframes","keyframes","normalized","_i2","_Object$entries2","_Object$entries2$_i","error","generateAnimationUtilities","utilities","_i3","_Object$keys","keys","animation","processKeyframes","_options","mergedOptions","_objectSpread","normalizedKeyframes","keyframeRules","values"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,eAAiC,GAAG;AACxCC,EAAAA,MAAM,EAAE,SAAS;AACjBC,EAAAA,YAAY,EAAE,KAAK;AACnBC,EAAAA,eAAe,EAAE,IAAI;AACrBC,EAAAA,eAAe,EAAE;AACnB,CAAC;;AAED;AACA;AACA;AACA,SAASC,WAAWA,CAACC,GAAW,EAAU;EACxC,OAAOA,GAAG,CAACC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAACC,WAAW,EAAE;AACjE;;AAEA;AACA;AACA;AACA,SAASC,WAAWA,CAACC,QAAgB,EAAEC,KAAsB,EAAEC,OAAyB,EAAU;EAChG,IAAI,CAACA,OAAO,CAACT,eAAe,EAAE,OAAOU,MAAM,CAACF,KAAK,CAAC;;AAElD;AACA,EAAA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAC7B,IAAA,IAAI,8CAA8C,CAACG,IAAI,CAACJ,QAAQ,CAAC,EAAE;MACjE,OAAOG,MAAM,CAACF,KAAK,CAAC;AACtB,IAAA;IACA,OAAA,EAAA,CAAAI,MAAA,CAAUJ,KAAK,EAAA,IAAA,CAAA;AACjB,EAAA;;AAEA;EACA,IAAID,QAAQ,KAAK,WAAW,IAAI,CAACC,KAAK,CAACK,QAAQ,CAAC,GAAG,CAAC,EAAE;IACpD,OAAA,EAAA,CAAAD,MAAA,CAAUJ,KAAK,EAAA,KAAA,CAAA;AACjB,EAAA;AAEA,EAAA,OAAOA,KAAK;AACd;;AAEA;AACA;AACA;AACA,SAASM,uBAAuBA,CAACC,QAAgB,EAAW;EAC1D,IAAIA,QA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eyframesConfig, KeyframesOptions } from './types/keyframes-type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a complete keyframe rule
|
|
4
|
+
*/
|
|
5
|
+
export declare function createKeyframeRule(name: string, definition: KeyframeDefinition, options?: KeyframesOptions): string;
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes keyframes configuration
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeKeyframes(keyframes: KeyframesConfig, options?: KeyframesOptions): Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Generates animation utilities from keyframes
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateAnimationUtilities(keyframes: KeyframesConfig, options?: KeyframesOptions): Record<string, {
|
|
14
|
+
animation: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Combines all keyframe-related processing
|
|
18
|
+
*/
|
|
19
|
+
export declare function processKeyframes(keyframes: KeyframesConfig, _options?: KeyframesOptions): {
|
|
20
|
+
keyframeRules: string[];
|
|
21
|
+
utilities: Record<string, {
|
|
22
|
+
animation: string;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Usage example
|
|
27
|
+
*/
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
const DEFAULT_OPTIONS = {
|
|
2
|
+
prefix: 'fluixi-',
|
|
3
|
+
useRawValues: false,
|
|
4
|
+
transformValues: true,
|
|
5
|
+
includeDefaults: true
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Converts camelCase to kebab-case
|
|
9
|
+
*/
|
|
10
|
+
function toKebabCase(str) {
|
|
11
|
+
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Formats CSS property value
|
|
15
|
+
*/
|
|
16
|
+
function formatValue(property, value, options) {
|
|
17
|
+
if (!options.transformValues)
|
|
18
|
+
return String(value);
|
|
19
|
+
// Handle numeric values
|
|
20
|
+
if (typeof value === 'number') {
|
|
21
|
+
if (/^(z|opacity|flex|order|grid-row|grid-column)/.test(property)) {
|
|
22
|
+
return String(value);
|
|
23
|
+
}
|
|
24
|
+
return `${value}px`;
|
|
25
|
+
}
|
|
26
|
+
// Handle transform functions
|
|
27
|
+
if (property === 'transform' && !value.includes('(')) {
|
|
28
|
+
return `${value}(1)`;
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validates keyframe selectors
|
|
34
|
+
*/
|
|
35
|
+
function isValidKeyframeSelector(selector) {
|
|
36
|
+
if (selector === 'from' || selector === 'to')
|
|
37
|
+
return true;
|
|
38
|
+
if (/%$/.test(selector)) {
|
|
39
|
+
const num = parseFloat(selector);
|
|
40
|
+
return !isNaN(num) && num >= 0 && num <= 100;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
function parseStyles(styles) {
|
|
45
|
+
if (typeof styles === 'string') {
|
|
46
|
+
const declarations = styles.split(';');
|
|
47
|
+
const styles_data = {};
|
|
48
|
+
for (const declaration of declarations) {
|
|
49
|
+
const [key, value] = declaration.split(':');
|
|
50
|
+
styles_data[key] = value;
|
|
51
|
+
}
|
|
52
|
+
return styles_data;
|
|
53
|
+
}
|
|
54
|
+
return styles;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates CSS rules for a keyframe definition
|
|
58
|
+
*/
|
|
59
|
+
function createKeyframeRules(definition, options) {
|
|
60
|
+
let rules = [];
|
|
61
|
+
for (const [selector, _styles] of Object.entries(definition)) {
|
|
62
|
+
const styles = parseStyles(_styles);
|
|
63
|
+
if (!isValidKeyframeSelector(selector)) {
|
|
64
|
+
console.warn(`Invalid keyframe selector: ${selector}`);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const styleRules = Object.entries(styles)
|
|
68
|
+
.map(([prop, value]) => {
|
|
69
|
+
const kebabProp = toKebabCase(prop);
|
|
70
|
+
const formattedValue = formatValue(kebabProp, value, options);
|
|
71
|
+
return ` ${kebabProp}: ${formattedValue};`;
|
|
72
|
+
})
|
|
73
|
+
.join('\n');
|
|
74
|
+
rules.push(` ${selector} {\n${styleRules}\n }`);
|
|
75
|
+
}
|
|
76
|
+
return rules.join('\n\n');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Creates a complete keyframe rule
|
|
80
|
+
*/
|
|
81
|
+
export function createKeyframeRule(name, definition, options = DEFAULT_OPTIONS) {
|
|
82
|
+
const prefix = options.prefix || '';
|
|
83
|
+
const keyframeName = `${prefix}${name}`;
|
|
84
|
+
const rules = createKeyframeRules(definition, options);
|
|
85
|
+
return `@keyframes ${keyframeName} {\n${rules}\n}`;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Normalizes keyframes configuration
|
|
89
|
+
*/
|
|
90
|
+
export function normalizeKeyframes(keyframes, options = DEFAULT_OPTIONS) {
|
|
91
|
+
const normalized = {};
|
|
92
|
+
for (const [name, definition] of Object.entries(keyframes)) {
|
|
93
|
+
try {
|
|
94
|
+
normalized[name] = createKeyframeRule(name, definition, options);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error(`Error processing keyframe '${name}':`, error);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return normalized;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Generates animation utilities from keyframes
|
|
104
|
+
*/
|
|
105
|
+
export function generateAnimationUtilities(keyframes, options = DEFAULT_OPTIONS) {
|
|
106
|
+
const utilities = {};
|
|
107
|
+
const prefix = options.prefix || '';
|
|
108
|
+
for (const name of Object.keys(keyframes)) {
|
|
109
|
+
utilities[`animate-${name}`] = {
|
|
110
|
+
animation: `${prefix}${name} var(--fluixi-animation-duration, 1s) var(--fluixi-animation-timing, linear) var(--fluixi-animation-iteration, infinite)`
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return utilities;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Combines all keyframe-related processing
|
|
117
|
+
*/
|
|
118
|
+
export function processKeyframes(keyframes, _options = DEFAULT_OPTIONS) {
|
|
119
|
+
const options = _options || DEFAULT_OPTIONS;
|
|
120
|
+
// Merge with default options
|
|
121
|
+
const mergedOptions = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
|
|
122
|
+
// Process keyframes
|
|
123
|
+
const normalizedKeyframes = normalizeKeyframes(keyframes, mergedOptions);
|
|
124
|
+
const keyframeRules = Object.values(normalizedKeyframes);
|
|
125
|
+
// Generate utilities
|
|
126
|
+
const utilities = generateAnimationUtilities(keyframes, mergedOptions);
|
|
127
|
+
return {
|
|
128
|
+
keyframeRules,
|
|
129
|
+
utilities
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
// /**
|
|
133
|
+
// * Default keyframe animations
|
|
134
|
+
// */
|
|
135
|
+
// export const DEFAULT_KEYFRAMES: KeyframesConfig = {
|
|
136
|
+
// spin: {
|
|
137
|
+
// from: {
|
|
138
|
+
// transform: 'rotate(0deg)'
|
|
139
|
+
// },
|
|
140
|
+
// to: {
|
|
141
|
+
// transform: 'rotate(360deg)'
|
|
142
|
+
// }
|
|
143
|
+
// },
|
|
144
|
+
// ping: {
|
|
145
|
+
// '75%, 100%': {
|
|
146
|
+
// transform: 'scale(2)',
|
|
147
|
+
// opacity: '0'
|
|
148
|
+
// }
|
|
149
|
+
// },
|
|
150
|
+
// pulse: {
|
|
151
|
+
// '0%, 100%': {
|
|
152
|
+
// opacity: '1'
|
|
153
|
+
// },
|
|
154
|
+
// '50%': {
|
|
155
|
+
// opacity: '.5'
|
|
156
|
+
// }
|
|
157
|
+
// },
|
|
158
|
+
// bounce: {
|
|
159
|
+
// '0%, 100%': {
|
|
160
|
+
// transform: 'translateY(-25%)',
|
|
161
|
+
// animationTimingFunction: 'cubic-bezier(0.8,0,1,1)'
|
|
162
|
+
// },
|
|
163
|
+
// '50%': {
|
|
164
|
+
// transform: 'none',
|
|
165
|
+
// animationTimingFunction: 'cubic-bezier(0,0,0.2,1)'
|
|
166
|
+
// }
|
|
167
|
+
// },
|
|
168
|
+
// 'fade-in': {
|
|
169
|
+
// from: {
|
|
170
|
+
// opacity: '0'
|
|
171
|
+
// },
|
|
172
|
+
// to: {
|
|
173
|
+
// opacity: '1'
|
|
174
|
+
// }
|
|
175
|
+
// },
|
|
176
|
+
// 'slide-in': {
|
|
177
|
+
// from: {
|
|
178
|
+
// transform: 'translateX(-100%)'
|
|
179
|
+
// },
|
|
180
|
+
// to: {
|
|
181
|
+
// transform: 'translateX(0)'
|
|
182
|
+
// }
|
|
183
|
+
// }
|
|
184
|
+
// };
|
|
185
|
+
/**
|
|
186
|
+
* Usage example
|
|
187
|
+
*/
|
|
188
|
+
//# sourceMappingURL=keyframes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyframes.js","sourceRoot":"","sources":["../../src/keyframes.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAqB;IACxC,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,IAAI;CACtB,CAAC;AAEF;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,QAAgB,EAAE,KAAsB,EAAE,OAAyB;IACtF,IAAI,CAAC,OAAO,CAAC,eAAe;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAEnD,wBAAwB;IACxB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,8CAA8C,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,GA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AAC;AACJ,CAAC;AAED,MAAM;AACN,iCAAiC;AACjC,MAAM;AACN,sDAAsD;AACtD,YAAY;AACZ,cAAc;AACd,kCAAkC;AAClC,SAAS;AACT,YAAY;AACZ,oCAAoC;AACpC,QAAQ;AACR,OAAO;AACP,YAAY;AACZ,qBAAqB;AACrB,+BAA+B;AAC/B,qBAAqB;AACrB,QAAQ;AACR,OAAO;AACP,aAAa;AACb,oBAAoB;AACpB,qBAAqB;AACrB,SAAS;AACT,eAAe;AACf,sBAAsB;AACtB,QAAQ;AACR,OAAO;AACP,cAAc;AACd,oBAAoB;AACpB,uCAAuC;AACvC,2DAA2D;AAC3D,SAAS;AACT,eAAe;AACf,2BAA2B;AAC3B,2DAA2D;AAC3D,QAAQ;AACR,OAAO;AACP,iBAAiB;AACjB,cAAc;AACd,qBAAqB;AACrB,SAAS;AACT,YAAY;AACZ,qBAAqB;AACrB,QAAQ;AACR,OAAO;AACP,kBAAkB;AAClB,cAAc;AACd,uCAAuC;AACvC,SAAS;AACT,YAAY;AACZ,mCAAmC;AACnC,QAAQ;AACR,MAAM;AACN,KAAK;AAEL;;GAEG","sourcesContent":["import { KeyframeDefinition, KeyframesConfig, KeyframesOptions, KeyframeStyles } from './types/keyframes-type.js';\n\nconst DEFAULT_OPTIONS: KeyframesOptions = {\n prefix: 'fluixi-',\n useRawValues: false,\n transformValues: true,\n includeDefaults: true\n};\n\n/**\n * Converts camelCase to kebab-case\n */\nfunction toKebabCase(str: string): string {\n return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\n/**\n * Formats CSS property value\n */\nfunction formatValue(property: string, value: string | number, options: KeyframesOptions): string {\n if (!options.transformValues) return String(value);\n\n // Handle numeric values\n if (typeof value === 'number') {\n if (/^(z|opacity|flex|order|grid-row|grid-column)/.test(property)) {\n return String(value);\n }\n return `${value}px`;\n }\n\n // Handle transform functions\n if (property === 'transform' && !value.includes('(')) {\n return `${value}(1)`;\n }\n\n return value;\n}\n\n/**\n * Validates keyframe selectors\n */\nfunction isValidKeyframeSelector(selector: string): boolean {\n if (selector === 'from' || selector === 'to') return true;\n if (/%$/.test(selector)) {\n const num = parseFloat(selector);\n return !isNaN(num) && num >= 0 && num <= 100;\n }\n return false;\n}\n\nfunction parseStyles(styles: KeyframeStyles | string): KeyframeStyles {\n if (typeof styles === 'string') {\n const declarations = styles.split(';');\n const styles_data: KeyframeStyles = {};\n for(const declaration of declarations){\n const [key, value] = declaration.split(':');\n styles_data[key] = value;\n }\n return styles_data;\n }\n return styles;\n}\n\n/**\n * Creates CSS rules for a keyframe definition\n */\nfunction createKeyframeRules(definition: KeyframeDefinition, options: KeyframesOptions): string {\n let rules: string[] = [];\n\n for (const [selector, _styles] of Object.entries(definition)) {\n const styles = parseStyles(_styles);\n if (!isValidKeyframeSelector(selector)) {\n console.warn(`Invalid keyframe selector: ${selector}`);\n continue;\n }\n\n const styleRules = Object.entries(styles)\n .map(([prop, value]) => {\n const kebabProp = toKebabCase(prop);\n const formattedValue = formatValue(kebabProp, value, options);\n return ` ${kebabProp}: ${formattedValue};`;\n })\n .join('\\n');\n\n rules.push(` ${selector} {\\n${styleRules}\\n }`);\n }\n\n return rules.join('\\n\\n');\n}\n\n/**\n * Creates a complete keyframe rule\n */\nexport function createKeyframeRule(\n name: string,\n definition: KeyframeDefinition,\n options: KeyframesOptions = DEFAULT_OPTIONS\n): string {\n const prefix = options.prefix || '';\n const keyframeName = `${prefix}${name}`;\n const rules = createKeyframeRules(definition, options);\n\n return `@keyframes ${keyframeName} {\\n${rules}\\n}`;\n}\n\n/**\n * Normalizes keyframes configuration\n */\nexport function normalizeKeyframes(\n keyframes: KeyframesConfig,\n options: KeyframesOptions = DEFAULT_OPTIONS\n): Record<string, string> {\n const normalized: Record<string, string> = {};\n\n for (const [name, definition] of Object.entries(keyframes)) {\n try {\n normalized[name] = createKeyframeRule(name, definition, options);\n } catch (error) {\n console.error(`Error processing keyframe '${name}':`, error);\n }\n }\n\n return normalized;\n}\n\n/**\n * Generates animation utilities from keyframes\n */\nexport function generateAnimationUtilities(\n keyframes: KeyframesConfig,\n options: KeyframesOptions = DEFAULT_OPTIONS\n): Record<string, { animation: string }> {\n const utilities: Record<string, { animation: string }> = {};\n const prefix = options.prefix || '';\n\n for (const name of Object.keys(keyframes)) {\n utilities[`animate-${name}`] = {\n animation: `${prefix}${name} var(--fluixi-animation-duration, 1s) var(--fluixi-animation-timing, linear) var(--fluixi-animation-iteration, infinite)`\n };\n }\n\n return utilities;\n}\n\n/**\n * Combines all keyframe-related processing\n */\nexport function processKeyframes(\n keyframes: KeyframesConfig,\n _options: KeyframesOptions = DEFAULT_OPTIONS\n): {\n keyframeRules: string[];\n utilities: Record<string, { animation: string }>;\n} {\n const options = _options || DEFAULT_OPTIONS;\n // Merge with default options\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n\n // Process keyframes\n const normalizedKeyframes = normalizeKeyframes(keyframes, mergedOptions);\n const keyframeRules = Object.values(normalizedKeyframes);\n\n // Generate utilities\n const utilities = generateAnimationUtilities(keyframes, mergedOptions);\n\n return {\n keyframeRules,\n utilities\n };\n}\n\n// /**\n// * Default keyframe animations\n// */\n// export const DEFAULT_KEYFRAMES: KeyframesConfig = {\n// spin: {\n// from: {\n// transform: 'rotate(0deg)'\n// },\n// to: {\n// transform: 'rotate(360deg)'\n// }\n// },\n// ping: {\n// '75%, 100%': {\n// transform: 'scale(2)',\n// opacity: '0'\n// }\n// },\n// pulse: {\n// '0%, 100%': {\n// opacity: '1'\n// },\n// '50%': {\n// opacity: '.5'\n// }\n// },\n// bounce: {\n// '0%, 100%': {\n// transform: 'translateY(-25%)',\n// animationTimingFunction: 'cubic-bezier(0.8,0,1,1)'\n// },\n// '50%': {\n// transform: 'none',\n// animationTimingFunction: 'cubic-bezier(0,0,0.2,1)'\n// }\n// },\n// 'fade-in': {\n// from: {\n// opacity: '0'\n// },\n// to: {\n// opacity: '1'\n// }\n// },\n// 'slide-in': {\n// from: {\n// transform: 'translateX(-100%)'\n// },\n// to: {\n// transform: 'translateX(0)'\n// }\n// }\n// };\n\n/**\n * Usage example\n */\n"]}
|