@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,255 @@
|
|
|
1
|
+
// packages/css-core/src/css-lexer.ts
|
|
2
|
+
export var TokenType;
|
|
3
|
+
(function (TokenType) {
|
|
4
|
+
TokenType[TokenType["Whitespace"] = 0] = "Whitespace";
|
|
5
|
+
TokenType[TokenType["Comment"] = 1] = "Comment";
|
|
6
|
+
TokenType[TokenType["Ident"] = 2] = "Ident";
|
|
7
|
+
TokenType[TokenType["AtKeyword"] = 3] = "AtKeyword";
|
|
8
|
+
TokenType[TokenType["String"] = 4] = "String";
|
|
9
|
+
TokenType[TokenType["Number"] = 5] = "Number";
|
|
10
|
+
TokenType[TokenType["Hash"] = 6] = "Hash";
|
|
11
|
+
TokenType[TokenType["Delim"] = 7] = "Delim";
|
|
12
|
+
TokenType[TokenType["Colon"] = 8] = "Colon";
|
|
13
|
+
TokenType[TokenType["Semicolon"] = 9] = "Semicolon";
|
|
14
|
+
TokenType[TokenType["Comma"] = 10] = "Comma";
|
|
15
|
+
TokenType[TokenType["LBrace"] = 11] = "LBrace";
|
|
16
|
+
TokenType[TokenType["RBrace"] = 12] = "RBrace";
|
|
17
|
+
TokenType[TokenType["LParen"] = 13] = "LParen";
|
|
18
|
+
TokenType[TokenType["RParen"] = 14] = "RParen";
|
|
19
|
+
TokenType[TokenType["LBracket"] = 15] = "LBracket";
|
|
20
|
+
TokenType[TokenType["RBracket"] = 16] = "RBracket";
|
|
21
|
+
TokenType[TokenType["Function"] = 17] = "Function";
|
|
22
|
+
TokenType[TokenType["Url"] = 18] = "Url";
|
|
23
|
+
TokenType[TokenType["EOF"] = 19] = "EOF";
|
|
24
|
+
})(TokenType || (TokenType = {}));
|
|
25
|
+
const isWhitespace = (c) => c === ' ' || c === '\t' || c === '\n' || c === '\r' || c === '\f';
|
|
26
|
+
const isDigit = (c) => c >= '0' && c <= '9';
|
|
27
|
+
const isIdentStart = (c) => /[A-Za-z_\u0080-\uFFFF-]/.test(c);
|
|
28
|
+
const isIdent = (c) => /[A-Za-z0-9_\u0080-\uFFFF-]/.test(c);
|
|
29
|
+
export class CssLexer {
|
|
30
|
+
constructor(input) {
|
|
31
|
+
this.i = 0;
|
|
32
|
+
this.line = 1;
|
|
33
|
+
this.col = 1;
|
|
34
|
+
this.len = 0;
|
|
35
|
+
this.s = '';
|
|
36
|
+
this.s = input;
|
|
37
|
+
this.len = input.length;
|
|
38
|
+
}
|
|
39
|
+
cur() { return this.s[this.i]; }
|
|
40
|
+
next() { return this.s[this.i + 1]; }
|
|
41
|
+
pos() { return { line: this.line, column: this.col, offset: this.i }; }
|
|
42
|
+
adv() {
|
|
43
|
+
const ch = this.s[this.i++];
|
|
44
|
+
if (ch === '\n') {
|
|
45
|
+
this.line++;
|
|
46
|
+
this.col = 1;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.col++;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
tokenize() {
|
|
53
|
+
const out = [];
|
|
54
|
+
while (this.i < this.len) {
|
|
55
|
+
const start = this.pos();
|
|
56
|
+
const ch = this.cur();
|
|
57
|
+
// Whitespace
|
|
58
|
+
if (isWhitespace(ch)) {
|
|
59
|
+
let val = '';
|
|
60
|
+
while (this.i < this.len && isWhitespace(this.cur())) {
|
|
61
|
+
val += this.cur();
|
|
62
|
+
this.adv();
|
|
63
|
+
}
|
|
64
|
+
out.push({ type: TokenType.Whitespace, value: val, loc: { start, end: this.pos() } });
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
// Comments /* ... */
|
|
68
|
+
if (ch === '/' && this.next() === '*') {
|
|
69
|
+
this.adv();
|
|
70
|
+
this.adv();
|
|
71
|
+
let val = '';
|
|
72
|
+
while (this.i < this.len && !(this.cur() === '*' && this.next() === '/')) {
|
|
73
|
+
val += this.cur();
|
|
74
|
+
this.adv();
|
|
75
|
+
}
|
|
76
|
+
if (this.i < this.len) {
|
|
77
|
+
this.adv();
|
|
78
|
+
this.adv();
|
|
79
|
+
}
|
|
80
|
+
out.push({ type: TokenType.Comment, value: val, loc: { start, end: this.pos() } });
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
// Strings
|
|
84
|
+
if (ch === '"' || ch === "'") {
|
|
85
|
+
const quote = ch;
|
|
86
|
+
this.adv();
|
|
87
|
+
let val = '';
|
|
88
|
+
while (this.i < this.len && this.cur() !== quote) {
|
|
89
|
+
if (this.cur() === '\\' && this.i + 1 < this.len) {
|
|
90
|
+
this.adv();
|
|
91
|
+
val += this.cur();
|
|
92
|
+
this.adv();
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
val += this.cur();
|
|
96
|
+
this.adv();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (this.cur() === quote)
|
|
100
|
+
this.adv();
|
|
101
|
+
out.push({ type: TokenType.String, value: val, loc: { start, end: this.pos() } });
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
// Url (raw)
|
|
105
|
+
if ((ch === 'u' || ch === 'U') && this.s.slice(this.i, this.i + 4).toLowerCase() === 'url(') {
|
|
106
|
+
// consume url(
|
|
107
|
+
for (let k = 0; k < 4; k++)
|
|
108
|
+
this.adv();
|
|
109
|
+
let depth = 1, val = 'url(';
|
|
110
|
+
while (this.i < this.len && depth > 0) {
|
|
111
|
+
const c = this.cur();
|
|
112
|
+
val += c;
|
|
113
|
+
if (c === '(')
|
|
114
|
+
depth++;
|
|
115
|
+
else if (c === ')')
|
|
116
|
+
depth--;
|
|
117
|
+
this.adv();
|
|
118
|
+
}
|
|
119
|
+
out.push({ type: TokenType.Url, value: val, loc: { start, end: this.pos() } });
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// Numbers / dimensions / percentage kept as Number token (value as raw)
|
|
123
|
+
if (isDigit(ch) || (ch === '.' && isDigit(this.next()))) {
|
|
124
|
+
let raw = '';
|
|
125
|
+
if (ch === '+' || ch === '-' || ch === '.') {
|
|
126
|
+
raw += ch;
|
|
127
|
+
this.adv();
|
|
128
|
+
}
|
|
129
|
+
while (this.i < this.len && isDigit(this.cur())) {
|
|
130
|
+
raw += this.cur();
|
|
131
|
+
this.adv();
|
|
132
|
+
}
|
|
133
|
+
if (this.cur() === '.') {
|
|
134
|
+
raw += '.';
|
|
135
|
+
this.adv();
|
|
136
|
+
while (this.i < this.len && isDigit(this.cur())) {
|
|
137
|
+
raw += this.cur();
|
|
138
|
+
this.adv();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (this.cur() === 'e' || this.cur() === 'E') {
|
|
142
|
+
const save = this.pos();
|
|
143
|
+
raw += this.cur();
|
|
144
|
+
this.adv();
|
|
145
|
+
if (this.cur() === '+' || this.cur() === '-') {
|
|
146
|
+
raw += this.cur();
|
|
147
|
+
this.adv();
|
|
148
|
+
}
|
|
149
|
+
if (!isDigit(this.cur())) { /* rollback exponent */ }
|
|
150
|
+
else {
|
|
151
|
+
while (this.i < this.len && isDigit(this.cur())) {
|
|
152
|
+
raw += this.cur();
|
|
153
|
+
this.adv();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// units/%
|
|
158
|
+
while (this.i < this.len && isIdent(this.cur())) {
|
|
159
|
+
raw += this.cur();
|
|
160
|
+
this.adv();
|
|
161
|
+
}
|
|
162
|
+
out.push({ type: TokenType.Number, value: raw, loc: { start, end: this.pos() } });
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
// Hash color or id-like
|
|
166
|
+
if (ch === '#') {
|
|
167
|
+
let raw = '#';
|
|
168
|
+
this.adv();
|
|
169
|
+
while (this.i < this.len && isIdent(this.cur())) {
|
|
170
|
+
raw += this.cur();
|
|
171
|
+
this.adv();
|
|
172
|
+
}
|
|
173
|
+
out.push({ type: TokenType.Hash, value: raw, loc: { start, end: this.pos() } });
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
// Function or Ident or @keyword
|
|
177
|
+
if (ch === '@') {
|
|
178
|
+
this.adv();
|
|
179
|
+
let name = '';
|
|
180
|
+
while (this.i < this.len && isIdent(this.cur())) {
|
|
181
|
+
name += this.cur();
|
|
182
|
+
this.adv();
|
|
183
|
+
}
|
|
184
|
+
out.push({ type: TokenType.AtKeyword, value: name, loc: { start, end: this.pos() } });
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (isIdentStart(ch)) {
|
|
188
|
+
let name = '';
|
|
189
|
+
while (this.i < this.len && isIdent(this.cur())) {
|
|
190
|
+
name += this.cur();
|
|
191
|
+
this.adv();
|
|
192
|
+
}
|
|
193
|
+
if (this.cur() === '(') {
|
|
194
|
+
this.adv();
|
|
195
|
+
out.push({ type: TokenType.Function, value: name, loc: { start, end: this.pos() } });
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
out.push({ type: TokenType.Ident, value: name, loc: { start, end: this.pos() } });
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
// Punctuation
|
|
202
|
+
if (ch === '{') {
|
|
203
|
+
this.adv();
|
|
204
|
+
out.push({ type: TokenType.LBrace, loc: { start, end: this.pos() } });
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (ch === '}') {
|
|
208
|
+
this.adv();
|
|
209
|
+
out.push({ type: TokenType.RBrace, loc: { start, end: this.pos() } });
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (ch === '(') {
|
|
213
|
+
this.adv();
|
|
214
|
+
out.push({ type: TokenType.LParen, loc: { start, end: this.pos() } });
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (ch === ')') {
|
|
218
|
+
this.adv();
|
|
219
|
+
out.push({ type: TokenType.RParen, loc: { start, end: this.pos() } });
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (ch === '[') {
|
|
223
|
+
this.adv();
|
|
224
|
+
out.push({ type: TokenType.LBracket, loc: { start, end: this.pos() } });
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (ch === ']') {
|
|
228
|
+
this.adv();
|
|
229
|
+
out.push({ type: TokenType.RBracket, loc: { start, end: this.pos() } });
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (ch === ':') {
|
|
233
|
+
this.adv();
|
|
234
|
+
out.push({ type: TokenType.Colon, loc: { start, end: this.pos() } });
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (ch === ';') {
|
|
238
|
+
this.adv();
|
|
239
|
+
out.push({ type: TokenType.Semicolon, loc: { start, end: this.pos() } });
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (ch === ',') {
|
|
243
|
+
this.adv();
|
|
244
|
+
out.push({ type: TokenType.Comma, loc: { start, end: this.pos() } });
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
// Delim (operators etc.)
|
|
248
|
+
this.adv();
|
|
249
|
+
out.push({ type: TokenType.Delim, value: ch, loc: { start, end: this.pos() } });
|
|
250
|
+
}
|
|
251
|
+
out.push({ type: TokenType.EOF, loc: { start: this.pos(), end: this.pos() } });
|
|
252
|
+
return out;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=css-lexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-lexer.js","sourceRoot":"","sources":["../../src/css-lexer.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,qDAAU,CAAA;IAAE,+CAAO,CAAA;IAAE,2CAAK,CAAA;IAAE,mDAAS,CAAA;IAAE,6CAAM,CAAA;IAAE,6CAAM,CAAA;IAAE,yCAAI,CAAA;IAAE,2CAAK,C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ident, AtKeyword, String, Number, Hash, Delim,\n Colon, Semicolon, Comma, LBrace, RBrace, LParen, RParen, LBracket, RBracket,\n Function, Url, EOF\n}\n\nexport interface Token {\n type: TokenType;\n value?: string;\n loc: { start: Position; end: Position };\n}\n\nexport type Position = { line: number; column: number; offset: number };\n\nconst isWhitespace = (c: string) => c === ' ' || c === '\\t' || c === '\\n' || c === '\\r' || c === '\\f';\nconst isDigit = (c: string) => c >= '0' && c <= '9';\nconst isIdentStart = (c: string) => /[A-Za-z_\\u0080-\\uFFFF-]/.test(c);\nconst isIdent = (c: string) => /[A-Za-z0-9_\\u0080-\\uFFFF-]/.test(c);\n\nexport class CssLexer {\n private i = 0;\n private line = 1;\n private col = 1;\n private len = 0;\n private s = '';\n\n constructor(input: string) {\n this.s = input;\n this.len = input.length;\n }\n\n private cur(): string { return this.s[this.i]; }\n private next(): string { return this.s[this.i + 1]; }\n private pos(): Position { return { line: this.line, column: this.col, offset: this.i }; }\n\n private adv(): void {\n const ch = this.s[this.i++];\n if (ch === '\\n') { this.line++; this.col = 1; } else { this.col++; }\n }\n\n tokenize(): Token[] {\n const out: Token[] = [];\n while (this.i < this.len) {\n const start = this.pos();\n const ch = this.cur();\n\n // Whitespace\n if (isWhitespace(ch)) {\n let val = '';\n while (this.i < this.len && isWhitespace(this.cur())) { val += this.cur(); this.adv(); }\n out.push({ type: TokenType.Whitespace, value: val, loc: { start, end: this.pos() } });\n continue;\n }\n\n // Comments /* ... */\n if (ch === '/' && this.next() === '*') {\n this.adv(); this.adv();\n let val = '';\n while (this.i < this.len && !(this.cur() === '*' && this.next() === '/')) {\n val += this.cur(); this.adv();\n }\n if (this.i < this.len) { this.adv(); this.adv(); }\n out.push({ type: TokenType.Comment, value: val, loc: { start, end: this.pos() } });\n continue;\n }\n\n // Strings\n if (ch === '\"' || ch === \"'\") {\n const quote = ch; this.adv();\n let val = '';\n while (this.i < this.len && this.cur() !== quote) {\n if (this.cur() === '\\\\' && this.i + 1 < this.len) { this.adv(); val += this.cur(); this.adv(); }\n else { val += this.cur(); this.adv(); }\n }\n if (this.cur() === quote) this.adv();\n out.push({ type: TokenType.String, value: val, loc: { start, end: this.pos() } });\n continue;\n }\n\n // Url (raw)\n if ((ch === 'u' || ch === 'U') && this.s.slice(this.i, this.i + 4).toLowerCase() === 'url(') {\n // consume url(\n for (let k = 0; k < 4; k++) this.adv();\n let depth = 1, val = 'url(';\n while (this.i < this.len && depth > 0) {\n const c = this.cur();\n val += c;\n if (c === '(') depth++;\n else if (c === ')') depth--;\n this.adv();\n }\n out.push({ type: TokenType.Url, value: val, loc: { start, end: this.pos() } });\n continue;\n }\n\n // Numbers / dimensions / percentage kept as Number token (value as raw)\n if (isDigit(ch) || (ch === '.' && isDigit(this.next()))) {\n let raw = '';\n if (ch === '+' || ch === '-' || ch === '.') { raw += ch; this.adv(); }\n while (this.i < this.len && isDigit(this.cur())) { raw += this.cur(); this.adv(); }\n if (this.cur() === '.') { raw += '.'; this.adv(); while (this.i < this.len && isDigit(this.cur())) { raw += this.cur(); this.adv(); } }\n if (this.cur() === 'e' || this.cur() === 'E') {\n const save = this.pos();\n raw += this.cur(); this.adv();\n if (this.cur() === '+' || this.cur() === '-') { raw += this.cur(); this.adv(); }\n if (!isDigit(this.cur())) { /* rollback exponent */ }\n else { while (this.i < this.len && isDigit(this.cur())) { raw += this.cur(); this.adv(); } }\n }\n // units/%\n while (this.i < this.len && isIdent(this.cur())) { raw += this.cur(); this.adv(); }\n out.push({ type: TokenType.Number, value: raw, loc: { start, end: this.pos() } });\n continue;\n }\n\n // Hash color or id-like\n if (ch === '#') {\n let raw = '#'; this.adv();\n while (this.i < this.len && isIdent(this.cur())) { raw += this.cur(); this.adv(); }\n out.push({ type: TokenType.Hash, value: raw, loc: { start, end: this.pos() } });\n continue;\n }\n\n // Function or Ident or @keyword\n if (ch === '@') {\n this.adv();\n let name = '';\n while (this.i < this.len && isIdent(this.cur())) { name += this.cur(); this.adv(); }\n out.push({ type: TokenType.AtKeyword, value: name, loc: { start, end: this.pos() } });\n continue;\n }\n if (isIdentStart(ch)) {\n let name = '';\n while (this.i < this.len && isIdent(this.cur())) { name += this.cur(); this.adv(); }\n if (this.cur() === '(') {\n this.adv();\n out.push({ type: TokenType.Function, value: name, loc: { start, end: this.pos() } });\n continue;\n }\n out.push({ type: TokenType.Ident, value: name, loc: { start, end: this.pos() } });\n continue;\n }\n\n // Punctuation\n if (ch === '{') { this.adv(); out.push({ type: TokenType.LBrace, loc: { start, end: this.pos() } }); continue; }\n if (ch === '}') { this.adv(); out.push({ type: TokenType.RBrace, loc: { start, end: this.pos() } }); continue; }\n if (ch === '(') { this.adv(); out.push({ type: TokenType.LParen, loc: { start, end: this.pos() } }); continue; }\n if (ch === ')') { this.adv(); out.push({ type: TokenType.RParen, loc: { start, end: this.pos() } }); continue; }\n if (ch === '[') { this.adv(); out.push({ type: TokenType.LBracket, loc: { start, end: this.pos() } }); continue; }\n if (ch === ']') { this.adv(); out.push({ type: TokenType.RBracket, loc: { start, end: this.pos() } }); continue; }\n if (ch === ':') { this.adv(); out.push({ type: TokenType.Colon, loc: { start, end: this.pos() } }); continue; }\n if (ch === ';') { this.adv(); out.push({ type: TokenType.Semicolon, loc: { start, end: this.pos() } }); continue; }\n if (ch === ',') { this.adv(); out.push({ type: TokenType.Comma, loc: { start, end: this.pos() } }); continue; }\n\n // Delim (operators etc.)\n this.adv();\n out.push({ type: TokenType.Delim, value: ch, loc: { start, end: this.pos() } });\n }\n out.push({ type: TokenType.EOF, loc: { start: this.pos(), end: this.pos() } });\n return out;\n }\n}"]}
|