@jesscss/core 2.0.0-alpha.1
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 +9 -0
- package/lib/context.d.ts +352 -0
- package/lib/context.d.ts.map +1 -0
- package/lib/context.js +636 -0
- package/lib/context.js.map +1 -0
- package/lib/conversions.d.ts +73 -0
- package/lib/conversions.d.ts.map +1 -0
- package/lib/conversions.js +253 -0
- package/lib/conversions.js.map +1 -0
- package/lib/debug-log.d.ts +2 -0
- package/lib/debug-log.d.ts.map +1 -0
- package/lib/debug-log.js +27 -0
- package/lib/debug-log.js.map +1 -0
- package/lib/define-function.d.ts +587 -0
- package/lib/define-function.d.ts.map +1 -0
- package/lib/define-function.js +726 -0
- package/lib/define-function.js.map +1 -0
- package/lib/deprecation.d.ts +34 -0
- package/lib/deprecation.d.ts.map +1 -0
- package/lib/deprecation.js +57 -0
- package/lib/deprecation.js.map +1 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +23 -0
- package/lib/index.js.map +1 -0
- package/lib/jess-error.d.ts +343 -0
- package/lib/jess-error.d.ts.map +1 -0
- package/lib/jess-error.js +508 -0
- package/lib/jess-error.js.map +1 -0
- package/lib/logger/deprecation-processing.d.ts +41 -0
- package/lib/logger/deprecation-processing.d.ts.map +1 -0
- package/lib/logger/deprecation-processing.js +81 -0
- package/lib/logger/deprecation-processing.js.map +1 -0
- package/lib/logger.d.ts +10 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +20 -0
- package/lib/logger.js.map +1 -0
- package/lib/plugin.d.ts +94 -0
- package/lib/plugin.d.ts.map +1 -0
- package/lib/plugin.js +174 -0
- package/lib/plugin.js.map +1 -0
- package/lib/tree/ampersand.d.ts +94 -0
- package/lib/tree/ampersand.d.ts.map +1 -0
- package/lib/tree/ampersand.js +269 -0
- package/lib/tree/ampersand.js.map +1 -0
- package/lib/tree/any.d.ts +58 -0
- package/lib/tree/any.d.ts.map +1 -0
- package/lib/tree/any.js +101 -0
- package/lib/tree/any.js.map +1 -0
- package/lib/tree/at-rule.d.ts +53 -0
- package/lib/tree/at-rule.d.ts.map +1 -0
- package/lib/tree/at-rule.js +503 -0
- package/lib/tree/at-rule.js.map +1 -0
- package/lib/tree/block.d.ts +22 -0
- package/lib/tree/block.d.ts.map +1 -0
- package/lib/tree/block.js +24 -0
- package/lib/tree/block.js.map +1 -0
- package/lib/tree/bool.d.ts +17 -0
- package/lib/tree/bool.d.ts.map +1 -0
- package/lib/tree/bool.js +24 -0
- package/lib/tree/bool.js.map +1 -0
- package/lib/tree/call.d.ts +66 -0
- package/lib/tree/call.d.ts.map +1 -0
- package/lib/tree/call.js +306 -0
- package/lib/tree/call.js.map +1 -0
- package/lib/tree/collection.d.ts +30 -0
- package/lib/tree/collection.d.ts.map +1 -0
- package/lib/tree/collection.js +37 -0
- package/lib/tree/collection.js.map +1 -0
- package/lib/tree/color.d.ts +101 -0
- package/lib/tree/color.d.ts.map +1 -0
- package/lib/tree/color.js +513 -0
- package/lib/tree/color.js.map +1 -0
- package/lib/tree/combinator.d.ts +12 -0
- package/lib/tree/combinator.d.ts.map +1 -0
- package/lib/tree/combinator.js +8 -0
- package/lib/tree/combinator.js.map +1 -0
- package/lib/tree/comment.d.ts +20 -0
- package/lib/tree/comment.d.ts.map +1 -0
- package/lib/tree/comment.js +18 -0
- package/lib/tree/comment.js.map +1 -0
- package/lib/tree/condition.d.ts +31 -0
- package/lib/tree/condition.d.ts.map +1 -0
- package/lib/tree/condition.js +103 -0
- package/lib/tree/condition.js.map +1 -0
- package/lib/tree/control.d.ts +104 -0
- package/lib/tree/control.d.ts.map +1 -0
- package/lib/tree/control.js +430 -0
- package/lib/tree/control.js.map +1 -0
- package/lib/tree/declaration-custom.d.ts +18 -0
- package/lib/tree/declaration-custom.d.ts.map +1 -0
- package/lib/tree/declaration-custom.js +24 -0
- package/lib/tree/declaration-custom.js.map +1 -0
- package/lib/tree/declaration-var.d.ts +36 -0
- package/lib/tree/declaration-var.d.ts.map +1 -0
- package/lib/tree/declaration-var.js +63 -0
- package/lib/tree/declaration-var.js.map +1 -0
- package/lib/tree/declaration.d.ts +78 -0
- package/lib/tree/declaration.d.ts.map +1 -0
- package/lib/tree/declaration.js +289 -0
- package/lib/tree/declaration.js.map +1 -0
- package/lib/tree/default-guard.d.ts +15 -0
- package/lib/tree/default-guard.d.ts.map +1 -0
- package/lib/tree/default-guard.js +19 -0
- package/lib/tree/default-guard.js.map +1 -0
- package/lib/tree/dimension.d.ts +33 -0
- package/lib/tree/dimension.d.ts.map +1 -0
- package/lib/tree/dimension.js +291 -0
- package/lib/tree/dimension.js.map +1 -0
- package/lib/tree/expression.d.ts +24 -0
- package/lib/tree/expression.d.ts.map +1 -0
- package/lib/tree/expression.js +28 -0
- package/lib/tree/expression.js.map +1 -0
- package/lib/tree/extend-list.d.ts +23 -0
- package/lib/tree/extend-list.d.ts.map +1 -0
- package/lib/tree/extend-list.js +20 -0
- package/lib/tree/extend-list.js.map +1 -0
- package/lib/tree/extend.d.ts +47 -0
- package/lib/tree/extend.d.ts.map +1 -0
- package/lib/tree/extend.js +292 -0
- package/lib/tree/extend.js.map +1 -0
- package/lib/tree/function.d.ts +48 -0
- package/lib/tree/function.d.ts.map +1 -0
- package/lib/tree/function.js +74 -0
- package/lib/tree/function.js.map +1 -0
- package/lib/tree/import-js.d.ts +35 -0
- package/lib/tree/import-js.d.ts.map +1 -0
- package/lib/tree/import-js.js +45 -0
- package/lib/tree/import-js.js.map +1 -0
- package/lib/tree/import-style.d.ts +156 -0
- package/lib/tree/import-style.d.ts.map +1 -0
- package/lib/tree/import-style.js +556 -0
- package/lib/tree/import-style.js.map +1 -0
- package/lib/tree/index.d.ts +71 -0
- package/lib/tree/index.d.ts.map +1 -0
- package/lib/tree/index.js +95 -0
- package/lib/tree/index.js.map +1 -0
- package/lib/tree/interpolated-reference.d.ts +24 -0
- package/lib/tree/interpolated-reference.d.ts.map +1 -0
- package/lib/tree/interpolated-reference.js +37 -0
- package/lib/tree/interpolated-reference.js.map +1 -0
- package/lib/tree/interpolated.d.ts +62 -0
- package/lib/tree/interpolated.d.ts.map +1 -0
- package/lib/tree/interpolated.js +204 -0
- package/lib/tree/interpolated.js.map +1 -0
- package/lib/tree/js-array.d.ts +10 -0
- package/lib/tree/js-array.d.ts.map +1 -0
- package/lib/tree/js-array.js +10 -0
- package/lib/tree/js-array.js.map +1 -0
- package/lib/tree/js-expr.d.ts +23 -0
- package/lib/tree/js-expr.d.ts.map +1 -0
- package/lib/tree/js-expr.js +28 -0
- package/lib/tree/js-expr.js.map +1 -0
- package/lib/tree/js-function.d.ts +20 -0
- package/lib/tree/js-function.d.ts.map +1 -0
- package/lib/tree/js-function.js +16 -0
- package/lib/tree/js-function.js.map +1 -0
- package/lib/tree/js-object.d.ts +10 -0
- package/lib/tree/js-object.d.ts.map +1 -0
- package/lib/tree/js-object.js +10 -0
- package/lib/tree/js-object.js.map +1 -0
- package/lib/tree/list.d.ts +38 -0
- package/lib/tree/list.d.ts.map +1 -0
- package/lib/tree/list.js +83 -0
- package/lib/tree/list.js.map +1 -0
- package/lib/tree/log.d.ts +29 -0
- package/lib/tree/log.d.ts.map +1 -0
- package/lib/tree/log.js +56 -0
- package/lib/tree/log.js.map +1 -0
- package/lib/tree/mixin.d.ts +87 -0
- package/lib/tree/mixin.d.ts.map +1 -0
- package/lib/tree/mixin.js +112 -0
- package/lib/tree/mixin.js.map +1 -0
- package/lib/tree/negative.d.ts +17 -0
- package/lib/tree/negative.d.ts.map +1 -0
- package/lib/tree/negative.js +22 -0
- package/lib/tree/negative.js.map +1 -0
- package/lib/tree/nil.d.ts +31 -0
- package/lib/tree/nil.d.ts.map +1 -0
- package/lib/tree/nil.js +36 -0
- package/lib/tree/nil.js.map +1 -0
- package/lib/tree/node-base.d.ts +359 -0
- package/lib/tree/node-base.d.ts.map +1 -0
- package/lib/tree/node-base.js +884 -0
- package/lib/tree/node-base.js.map +1 -0
- package/lib/tree/node.d.ts +10 -0
- package/lib/tree/node.d.ts.map +1 -0
- package/lib/tree/node.js +45 -0
- package/lib/tree/node.js.map +1 -0
- package/lib/tree/number.d.ts +21 -0
- package/lib/tree/number.d.ts.map +1 -0
- package/lib/tree/number.js +27 -0
- package/lib/tree/number.js.map +1 -0
- package/lib/tree/operation.d.ts +26 -0
- package/lib/tree/operation.d.ts.map +1 -0
- package/lib/tree/operation.js +103 -0
- package/lib/tree/operation.js.map +1 -0
- package/lib/tree/paren.d.ts +18 -0
- package/lib/tree/paren.d.ts.map +1 -0
- package/lib/tree/paren.js +86 -0
- package/lib/tree/paren.js.map +1 -0
- package/lib/tree/query-condition.d.ts +17 -0
- package/lib/tree/query-condition.d.ts.map +1 -0
- package/lib/tree/query-condition.js +39 -0
- package/lib/tree/query-condition.js.map +1 -0
- package/lib/tree/quoted.d.ts +27 -0
- package/lib/tree/quoted.d.ts.map +1 -0
- package/lib/tree/quoted.js +66 -0
- package/lib/tree/quoted.js.map +1 -0
- package/lib/tree/range.d.ts +33 -0
- package/lib/tree/range.d.ts.map +1 -0
- package/lib/tree/range.js +47 -0
- package/lib/tree/range.js.map +1 -0
- package/lib/tree/reference.d.ts +76 -0
- package/lib/tree/reference.d.ts.map +1 -0
- package/lib/tree/reference.js +521 -0
- package/lib/tree/reference.js.map +1 -0
- package/lib/tree/rest.d.ts +15 -0
- package/lib/tree/rest.d.ts.map +1 -0
- package/lib/tree/rest.js +32 -0
- package/lib/tree/rest.js.map +1 -0
- package/lib/tree/rules-raw.d.ts +17 -0
- package/lib/tree/rules-raw.d.ts.map +1 -0
- package/lib/tree/rules-raw.js +37 -0
- package/lib/tree/rules-raw.js.map +1 -0
- package/lib/tree/rules.d.ts +255 -0
- package/lib/tree/rules.d.ts.map +1 -0
- package/lib/tree/rules.js +2293 -0
- package/lib/tree/rules.js.map +1 -0
- package/lib/tree/ruleset.d.ts +91 -0
- package/lib/tree/ruleset.d.ts.map +1 -0
- package/lib/tree/ruleset.js +506 -0
- package/lib/tree/ruleset.js.map +1 -0
- package/lib/tree/selector-attr.d.ts +31 -0
- package/lib/tree/selector-attr.d.ts.map +1 -0
- package/lib/tree/selector-attr.js +99 -0
- package/lib/tree/selector-attr.js.map +1 -0
- package/lib/tree/selector-basic.d.ts +23 -0
- package/lib/tree/selector-basic.d.ts.map +1 -0
- package/lib/tree/selector-basic.js +34 -0
- package/lib/tree/selector-basic.js.map +1 -0
- package/lib/tree/selector-capture.d.ts +23 -0
- package/lib/tree/selector-capture.d.ts.map +1 -0
- package/lib/tree/selector-capture.js +34 -0
- package/lib/tree/selector-capture.js.map +1 -0
- package/lib/tree/selector-complex.d.ts +40 -0
- package/lib/tree/selector-complex.d.ts.map +1 -0
- package/lib/tree/selector-complex.js +143 -0
- package/lib/tree/selector-complex.js.map +1 -0
- package/lib/tree/selector-compound.d.ts +16 -0
- package/lib/tree/selector-compound.d.ts.map +1 -0
- package/lib/tree/selector-compound.js +114 -0
- package/lib/tree/selector-compound.js.map +1 -0
- package/lib/tree/selector-interpolated.d.ts +23 -0
- package/lib/tree/selector-interpolated.d.ts.map +1 -0
- package/lib/tree/selector-interpolated.js +27 -0
- package/lib/tree/selector-interpolated.js.map +1 -0
- package/lib/tree/selector-list.d.ts +17 -0
- package/lib/tree/selector-list.d.ts.map +1 -0
- package/lib/tree/selector-list.js +184 -0
- package/lib/tree/selector-list.js.map +1 -0
- package/lib/tree/selector-pseudo.d.ts +42 -0
- package/lib/tree/selector-pseudo.d.ts.map +1 -0
- package/lib/tree/selector-pseudo.js +191 -0
- package/lib/tree/selector-pseudo.js.map +1 -0
- package/lib/tree/selector-simple.d.ts +5 -0
- package/lib/tree/selector-simple.d.ts.map +1 -0
- package/lib/tree/selector-simple.js +6 -0
- package/lib/tree/selector-simple.js.map +1 -0
- package/lib/tree/selector.d.ts +43 -0
- package/lib/tree/selector.d.ts.map +1 -0
- package/lib/tree/selector.js +56 -0
- package/lib/tree/selector.js.map +1 -0
- package/lib/tree/sequence.d.ts +43 -0
- package/lib/tree/sequence.d.ts.map +1 -0
- package/lib/tree/sequence.js +148 -0
- package/lib/tree/sequence.js.map +1 -0
- package/lib/tree/tree.d.ts +87 -0
- package/lib/tree/tree.d.ts.map +1 -0
- package/lib/tree/tree.js +2 -0
- package/lib/tree/tree.js.map +1 -0
- package/lib/tree/url.d.ts +18 -0
- package/lib/tree/url.d.ts.map +1 -0
- package/lib/tree/url.js +35 -0
- package/lib/tree/url.js.map +1 -0
- package/lib/tree/util/__tests__/debug-log.d.ts +1 -0
- package/lib/tree/util/__tests__/debug-log.d.ts.map +1 -0
- package/lib/tree/util/__tests__/debug-log.js +36 -0
- package/lib/tree/util/__tests__/debug-log.js.map +1 -0
- package/lib/tree/util/calculate.d.ts +3 -0
- package/lib/tree/util/calculate.d.ts.map +1 -0
- package/lib/tree/util/calculate.js +10 -0
- package/lib/tree/util/calculate.js.map +1 -0
- package/lib/tree/util/cast.d.ts +10 -0
- package/lib/tree/util/cast.d.ts.map +1 -0
- package/lib/tree/util/cast.js +87 -0
- package/lib/tree/util/cast.js.map +1 -0
- package/lib/tree/util/cloning.d.ts +4 -0
- package/lib/tree/util/cloning.d.ts.map +1 -0
- package/lib/tree/util/cloning.js +8 -0
- package/lib/tree/util/cloning.js.map +1 -0
- package/lib/tree/util/collections.d.ts +57 -0
- package/lib/tree/util/collections.d.ts.map +1 -0
- package/lib/tree/util/collections.js +136 -0
- package/lib/tree/util/collections.js.map +1 -0
- package/lib/tree/util/compare.d.ts +11 -0
- package/lib/tree/util/compare.d.ts.map +1 -0
- package/lib/tree/util/compare.js +89 -0
- package/lib/tree/util/compare.js.map +1 -0
- package/lib/tree/util/extend-helpers.d.ts +2 -0
- package/lib/tree/util/extend-helpers.d.ts.map +1 -0
- package/lib/tree/util/extend-helpers.js +2 -0
- package/lib/tree/util/extend-helpers.js.map +1 -0
- package/lib/tree/util/extend-roots.d.ts +37 -0
- package/lib/tree/util/extend-roots.d.ts.map +1 -0
- package/lib/tree/util/extend-roots.js +682 -0
- package/lib/tree/util/extend-roots.js.map +1 -0
- package/lib/tree/util/extend-roots.old.d.ts +132 -0
- package/lib/tree/util/extend-roots.old.d.ts.map +1 -0
- package/lib/tree/util/extend-roots.old.js +2272 -0
- package/lib/tree/util/extend-roots.old.js.map +1 -0
- package/lib/tree/util/extend-trace-debug.d.ts +13 -0
- package/lib/tree/util/extend-trace-debug.d.ts.map +1 -0
- package/lib/tree/util/extend-trace-debug.js +34 -0
- package/lib/tree/util/extend-trace-debug.js.map +1 -0
- package/lib/tree/util/extend.d.ts +218 -0
- package/lib/tree/util/extend.d.ts.map +1 -0
- package/lib/tree/util/extend.js +3033 -0
- package/lib/tree/util/extend.js.map +1 -0
- package/lib/tree/util/find-extendable-locations.d.ts +2 -0
- package/lib/tree/util/find-extendable-locations.d.ts.map +1 -0
- package/lib/tree/util/find-extendable-locations.js +2 -0
- package/lib/tree/util/find-extendable-locations.js.map +1 -0
- package/lib/tree/util/format.d.ts +20 -0
- package/lib/tree/util/format.d.ts.map +1 -0
- package/lib/tree/util/format.js +67 -0
- package/lib/tree/util/format.js.map +1 -0
- package/lib/tree/util/is-node.d.ts +13 -0
- package/lib/tree/util/is-node.d.ts.map +1 -0
- package/lib/tree/util/is-node.js +43 -0
- package/lib/tree/util/is-node.js.map +1 -0
- package/lib/tree/util/print.d.ts +80 -0
- package/lib/tree/util/print.d.ts.map +1 -0
- package/lib/tree/util/print.js +205 -0
- package/lib/tree/util/print.js.map +1 -0
- package/lib/tree/util/process-leading-is.d.ts +25 -0
- package/lib/tree/util/process-leading-is.d.ts.map +1 -0
- package/lib/tree/util/process-leading-is.js +364 -0
- package/lib/tree/util/process-leading-is.js.map +1 -0
- package/lib/tree/util/recursion-helper.d.ts +15 -0
- package/lib/tree/util/recursion-helper.d.ts.map +1 -0
- package/lib/tree/util/recursion-helper.js +43 -0
- package/lib/tree/util/recursion-helper.js.map +1 -0
- package/lib/tree/util/regex.d.ts +4 -0
- package/lib/tree/util/regex.d.ts.map +1 -0
- package/lib/tree/util/regex.js +4 -0
- package/lib/tree/util/regex.js.map +1 -0
- package/lib/tree/util/registry-utils.d.ts +192 -0
- package/lib/tree/util/registry-utils.d.ts.map +1 -0
- package/lib/tree/util/registry-utils.js +1242 -0
- package/lib/tree/util/registry-utils.js.map +1 -0
- package/lib/tree/util/ruleset-trace.d.ts +4 -0
- package/lib/tree/util/ruleset-trace.d.ts.map +1 -0
- package/lib/tree/util/ruleset-trace.js +14 -0
- package/lib/tree/util/ruleset-trace.js.map +1 -0
- package/lib/tree/util/selector-compare.d.ts +2 -0
- package/lib/tree/util/selector-compare.d.ts.map +1 -0
- package/lib/tree/util/selector-compare.js +2 -0
- package/lib/tree/util/selector-compare.js.map +1 -0
- package/lib/tree/util/selector-match-core.d.ts +171 -0
- package/lib/tree/util/selector-match-core.d.ts.map +1 -0
- package/lib/tree/util/selector-match-core.js +1578 -0
- package/lib/tree/util/selector-match-core.js.map +1 -0
- package/lib/tree/util/selector-utils.d.ts +30 -0
- package/lib/tree/util/selector-utils.d.ts.map +1 -0
- package/lib/tree/util/selector-utils.js +100 -0
- package/lib/tree/util/selector-utils.js.map +1 -0
- package/lib/tree/util/serialize-helper.d.ts +13 -0
- package/lib/tree/util/serialize-helper.d.ts.map +1 -0
- package/lib/tree/util/serialize-helper.js +387 -0
- package/lib/tree/util/serialize-helper.js.map +1 -0
- package/lib/tree/util/serialize-types.d.ts +9 -0
- package/lib/tree/util/serialize-types.d.ts.map +1 -0
- package/lib/tree/util/serialize-types.js +216 -0
- package/lib/tree/util/serialize-types.js.map +1 -0
- package/lib/tree/util/should-operate.d.ts +23 -0
- package/lib/tree/util/should-operate.d.ts.map +1 -0
- package/lib/tree/util/should-operate.js +46 -0
- package/lib/tree/util/should-operate.js.map +1 -0
- package/lib/tree/util/sourcemap.d.ts +7 -0
- package/lib/tree/util/sourcemap.d.ts.map +1 -0
- package/lib/tree/util/sourcemap.js +25 -0
- package/lib/tree/util/sourcemap.js.map +1 -0
- package/lib/types/config.d.ts +205 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +2 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/modes.d.ts +24 -0
- package/lib/types/modes.d.ts.map +1 -0
- package/lib/types/modes.js +2 -0
- package/lib/types/modes.js.map +1 -0
- package/lib/types.d.ts +61 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/use-webpack-resolver.d.ts +9 -0
- package/lib/use-webpack-resolver.d.ts.map +1 -0
- package/lib/use-webpack-resolver.js +41 -0
- package/lib/use-webpack-resolver.js.map +1 -0
- package/lib/visitor/index.d.ts +136 -0
- package/lib/visitor/index.d.ts.map +1 -0
- package/lib/visitor/index.js +135 -0
- package/lib/visitor/index.js.map +1 -0
- package/lib/visitor/less-visitor.d.ts +7 -0
- package/lib/visitor/less-visitor.d.ts.map +1 -0
- package/lib/visitor/less-visitor.js +7 -0
- package/lib/visitor/less-visitor.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../../src/tree/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,KAAK,YAAY,EAAmC,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,iBAAiB,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IAEH,kCAAkC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,IAAI,CAAC,IAAI,EAAE,EAAE,eAAe,CAAC;IACzD,IAAI,SAAc;IAClB,SAAS,SAAS;IAET,OAAO,CAAC,KAAK,EAAE,IAAI;IAenB,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAyD/C,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI;IAsBxE;;;;;;;;;;;;OAYG;IACM,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC;CAiDxD;AAED,eAAO,MAAM,GAAG,8LAA0C,CAAC;AAE3D,eAAO,MAAM,MAAM,GACjB,OAAO,IAAI,EAAE,EACb,UAAU,eAAe,aAM1B,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Node, defineType } from './node.js';
|
|
2
|
+
import { Nil } from './nil.js';
|
|
3
|
+
import { List } from './list.js';
|
|
4
|
+
import { compareNodeArray } from './util/compare.js';
|
|
5
|
+
import { isNode } from './util/is-node.js';
|
|
6
|
+
import { pipe, isThenable, serialForEach } from '@jesscss/awaitable-pipe';
|
|
7
|
+
import { getPrintOptions } from './util/print.js';
|
|
8
|
+
/**
|
|
9
|
+
* A continuous collection of nodes. Historically in Less,
|
|
10
|
+
* these were termed "expressions", but in computer science,
|
|
11
|
+
* an expression will yield a value, and a CSS value can
|
|
12
|
+
* actually be a sequence of values (like for shorthand)
|
|
13
|
+
*/
|
|
14
|
+
export class Sequence extends Node {
|
|
15
|
+
type = 'Sequence';
|
|
16
|
+
shortType = 'seq';
|
|
17
|
+
compare(other) {
|
|
18
|
+
if (other instanceof Sequence) {
|
|
19
|
+
const equalityMode = this.treeContext?.equalityMode ?? 'coerce';
|
|
20
|
+
const result = compareNodeArray(this.value, other.value, equalityMode);
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
if (other.type === 'Any') {
|
|
24
|
+
const normalize = (s) => s.replace(/\s+/g, ' ').trim();
|
|
25
|
+
const left = normalize(this.toString());
|
|
26
|
+
const right = normalize(other.toString());
|
|
27
|
+
return left === right ? 0 : undefined;
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
toTrimmedString(options) {
|
|
32
|
+
options = getPrintOptions(options);
|
|
33
|
+
if (options?.inCustom) {
|
|
34
|
+
return super.toTrimmedString(options);
|
|
35
|
+
}
|
|
36
|
+
const w = options.writer;
|
|
37
|
+
const mark = w.mark();
|
|
38
|
+
const { value } = this;
|
|
39
|
+
const length = value.length;
|
|
40
|
+
if (length === 0) {
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
// Serialize first node with toString() to preserve comments
|
|
44
|
+
const firstCaptured = w.captureWithMeta(() => value[0].toString(options));
|
|
45
|
+
w.add(firstCaptured.text);
|
|
46
|
+
let prevTrailingIntent = firstCaptured.trailingIntent;
|
|
47
|
+
// Serialize subsequent nodes with normalized spacing
|
|
48
|
+
for (let i = 1; i < length; i++) {
|
|
49
|
+
const node = value[i];
|
|
50
|
+
// For sequences, normalize spacing based on actual serialized output (including pre/post)
|
|
51
|
+
// If direct child has explicit pre === 0, respect that (no space)
|
|
52
|
+
if (node.pre === 0) {
|
|
53
|
+
// Explicitly no space - respect that, but still use toString() to preserve comments
|
|
54
|
+
node.toString(options);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Check what's already written (previous node's output) to see if it ends with space
|
|
58
|
+
const currentMark = w.mark();
|
|
59
|
+
const writtenSoFar = w.getSince(mark);
|
|
60
|
+
const prevEndsWithSpace = writtenSoFar.endsWith(' ');
|
|
61
|
+
w.restore(currentMark);
|
|
62
|
+
// Capture current node's output to check if it starts with space
|
|
63
|
+
// This captures the serialized output including pre/post from child nodes
|
|
64
|
+
const currentCaptured = w.captureWithMeta(() => node.toString(options));
|
|
65
|
+
const currentNodeOut = currentCaptured.text;
|
|
66
|
+
const currentStartsWithSpace = currentNodeOut.startsWith(' ');
|
|
67
|
+
const hasExplicitNoSpaceBoundary = (prevTrailingIntent === 'explicit_none'
|
|
68
|
+
|| currentCaptured.leadingIntent === 'explicit_none');
|
|
69
|
+
if (!prevEndsWithSpace && !currentStartsWithSpace && !hasExplicitNoSpaceBoundary) {
|
|
70
|
+
// No space present - add single space before node
|
|
71
|
+
w.add(' ');
|
|
72
|
+
}
|
|
73
|
+
// Write the captured output (node was already serialized in capture())
|
|
74
|
+
w.add(currentNodeOut);
|
|
75
|
+
prevTrailingIntent = currentCaptured.trailingIntent;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return w.getSince(mark);
|
|
79
|
+
}
|
|
80
|
+
operate(b, op, context) {
|
|
81
|
+
if (op !== '+') {
|
|
82
|
+
throw new Error(`Sequence operation "${op}" not supported`);
|
|
83
|
+
}
|
|
84
|
+
let newSequence = this.maybeClone(context);
|
|
85
|
+
if (b instanceof List) {
|
|
86
|
+
return new List([newSequence, ...b.value]).inherit(this);
|
|
87
|
+
}
|
|
88
|
+
else if (isNode(b, 'Sequence')) {
|
|
89
|
+
/** Inference not working in this class? */
|
|
90
|
+
const values = b.value.map(v => v.maybeClone(context));
|
|
91
|
+
if (values.length) {
|
|
92
|
+
values[0].pre = 1;
|
|
93
|
+
}
|
|
94
|
+
newSequence.value.push(...values);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
b = b.maybeClone(context);
|
|
98
|
+
b.pre = 1;
|
|
99
|
+
newSequence.value.push(b);
|
|
100
|
+
}
|
|
101
|
+
return newSequence;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* During evaluation of sequences,
|
|
105
|
+
* Jess may find values that are lists.
|
|
106
|
+
*
|
|
107
|
+
* In this case, we need to create a single
|
|
108
|
+
* list that contains members of the expanded lists.
|
|
109
|
+
*
|
|
110
|
+
* @todo - If this is a selector sequence, and we've
|
|
111
|
+
* evaluated an expression to an inner sequence,
|
|
112
|
+
* then we should be inserting white-space combinators?
|
|
113
|
+
*
|
|
114
|
+
* @todo - REWRITE
|
|
115
|
+
*/
|
|
116
|
+
evalNode(context) {
|
|
117
|
+
return pipe(() => {
|
|
118
|
+
const node = this;
|
|
119
|
+
const maybe = serialForEach(node.value.map((n, i) => [n, i]), ([n, i]) => {
|
|
120
|
+
const out = n.eval(context);
|
|
121
|
+
if (isThenable(out)) {
|
|
122
|
+
return out.then((res) => {
|
|
123
|
+
node.value[i] = res;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
node.value[i] = out;
|
|
127
|
+
});
|
|
128
|
+
if (isThenable(maybe)) {
|
|
129
|
+
return maybe.then(() => node);
|
|
130
|
+
}
|
|
131
|
+
return node;
|
|
132
|
+
}, (node) => {
|
|
133
|
+
node.value = node.value.filter(n => n && !(n instanceof Nil));
|
|
134
|
+
if (node.value.length === 1 && !node.options.preserveWhitespace) {
|
|
135
|
+
return node.value[0];
|
|
136
|
+
}
|
|
137
|
+
return node;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export const seq = defineType(Sequence, 'Sequence', 'seq');
|
|
142
|
+
export const spaced = (value, options) => {
|
|
143
|
+
for (let i = 1; i < value.length; i++) {
|
|
144
|
+
value[i].pre = 1;
|
|
145
|
+
}
|
|
146
|
+
return new Sequence(value, options);
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=sequence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequence.js","sourceRoot":"","sources":["../../src/tree/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAA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ACnD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,EACD,CAAC,IAAI,EAAE,EAAE;YACP,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;YAC9D,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;gBAChE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC;YACxB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CACF,CAAC;IACJ,CAAC;CAuBF;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,KAAa,EACb,OAAyB,EACzB,EAAE;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,KAAK,CAAC,CAAC,CAAE,CAAC,GAAG,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Ampersand } from './ampersand.js';
|
|
2
|
+
import type { Any, Anonymous, Keyword } from './any.js';
|
|
3
|
+
import type { AtRule } from './at-rule.js';
|
|
4
|
+
import type { Call } from './call.js';
|
|
5
|
+
import type { Declaration } from './declaration.js';
|
|
6
|
+
import type { Dimension } from './dimension.js';
|
|
7
|
+
import type { Expression } from './expression.js';
|
|
8
|
+
import type { Operation } from './operation.js';
|
|
9
|
+
import type { BasicSelector } from './selector-basic.js';
|
|
10
|
+
import type { List } from './list.js';
|
|
11
|
+
import type { Mixin } from './mixin.js';
|
|
12
|
+
import type { Func } from './function.js';
|
|
13
|
+
import type { JsFunction } from './js-function.js';
|
|
14
|
+
import type { Ruleset } from './ruleset.js';
|
|
15
|
+
import type { Rules } from './rules.js';
|
|
16
|
+
import type { ComplexSelector } from './selector-complex.js';
|
|
17
|
+
import type { CompoundSelector } from './selector-compound.js';
|
|
18
|
+
import type { StyleImport } from './import-style.js';
|
|
19
|
+
import type { JsImport } from './import-js.js';
|
|
20
|
+
import type { Nil } from './nil.js';
|
|
21
|
+
import type { SelectorList } from './selector-list.js';
|
|
22
|
+
import type { Collection } from './collection.js';
|
|
23
|
+
import type { VarDeclaration } from './declaration-var.js';
|
|
24
|
+
import type { Rest } from './rest.js';
|
|
25
|
+
import type { SimpleSelector } from './selector-simple.js';
|
|
26
|
+
import type { PseudoSelector } from './selector-pseudo.js';
|
|
27
|
+
import type { Combinator } from './combinator.js';
|
|
28
|
+
import type { Sequence } from './sequence.js';
|
|
29
|
+
import type { Selector } from './selector.js';
|
|
30
|
+
import type { JsObject } from './js-object.js';
|
|
31
|
+
import type { JsArray } from './js-array.js';
|
|
32
|
+
import type { Num } from './number.js';
|
|
33
|
+
import type { Url } from './url.js';
|
|
34
|
+
import type { Quoted } from './quoted.js';
|
|
35
|
+
import type { Color } from './color.js';
|
|
36
|
+
import type { Reference } from './reference.js';
|
|
37
|
+
import type { Comment } from './comment.js';
|
|
38
|
+
import type { Range } from './range.js';
|
|
39
|
+
import type { Log } from './log.js';
|
|
40
|
+
import type { Paren } from './paren.js';
|
|
41
|
+
import type { Block } from './block.js';
|
|
42
|
+
export type Nodes = {
|
|
43
|
+
Ampersand: typeof Ampersand;
|
|
44
|
+
Any: typeof Any;
|
|
45
|
+
Anonymous: typeof Anonymous;
|
|
46
|
+
Keyword: typeof Keyword;
|
|
47
|
+
AtRule: typeof AtRule;
|
|
48
|
+
Call: typeof Call;
|
|
49
|
+
Comment: typeof Comment;
|
|
50
|
+
Declaration: typeof Declaration;
|
|
51
|
+
Expression: typeof Expression;
|
|
52
|
+
Operation: typeof Operation;
|
|
53
|
+
VarDeclaration: typeof VarDeclaration;
|
|
54
|
+
Dimension: typeof Dimension;
|
|
55
|
+
Num: typeof Num;
|
|
56
|
+
Selector: typeof Selector;
|
|
57
|
+
BasicSelector: typeof BasicSelector;
|
|
58
|
+
SimpleSelector: typeof SimpleSelector;
|
|
59
|
+
PseudoSelector: typeof PseudoSelector;
|
|
60
|
+
ComplexSelector: typeof ComplexSelector;
|
|
61
|
+
CompoundSelector: typeof CompoundSelector;
|
|
62
|
+
SelectorList: typeof SelectorList;
|
|
63
|
+
Combinator: typeof Combinator;
|
|
64
|
+
List: typeof List;
|
|
65
|
+
Mixin: typeof Mixin;
|
|
66
|
+
Func: typeof Func;
|
|
67
|
+
JsFunction: typeof JsFunction;
|
|
68
|
+
JsObject: typeof JsObject;
|
|
69
|
+
JsArray: typeof JsArray;
|
|
70
|
+
Ruleset: typeof Ruleset;
|
|
71
|
+
Rules: typeof Rules;
|
|
72
|
+
StyleImport: typeof StyleImport;
|
|
73
|
+
JsImport: typeof JsImport;
|
|
74
|
+
Nil: typeof Nil;
|
|
75
|
+
Collection: typeof Collection;
|
|
76
|
+
Rest: typeof Rest;
|
|
77
|
+
Sequence: typeof Sequence;
|
|
78
|
+
Url: typeof Url;
|
|
79
|
+
Quoted: typeof Quoted;
|
|
80
|
+
Color: typeof Color;
|
|
81
|
+
Reference: typeof Reference;
|
|
82
|
+
Range: typeof Range;
|
|
83
|
+
Log: typeof Log;
|
|
84
|
+
Paren: typeof Paren;
|
|
85
|
+
Block: typeof Block;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/tree/tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAA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E,OAAO,SAAS,CAAC;IAC5B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,GAAG,EAAE,OAAO,GAAG,CAAC;IAChB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAC"}
|
package/lib/tree/tree.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/tree/tree.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Node } from './node.js';
|
|
2
|
+
import { type Quoted } from './quoted.js';
|
|
3
|
+
import { type Any } from './any.js';
|
|
4
|
+
import { type PrintOptions } from './util/print.js';
|
|
5
|
+
/**
|
|
6
|
+
* e.g. url('foo.png')
|
|
7
|
+
*/
|
|
8
|
+
export declare class Url extends Node<Quoted | Any> {
|
|
9
|
+
type: string;
|
|
10
|
+
shortType: string;
|
|
11
|
+
/**
|
|
12
|
+
* @todo - enable URL rewriting
|
|
13
|
+
*/
|
|
14
|
+
valueOf(): string;
|
|
15
|
+
toTrimmedString(options?: PrintOptions): string;
|
|
16
|
+
}
|
|
17
|
+
export declare const url: (value?: Any<import("./any.js").AnyRole> | Quoted | undefined, options?: import("./node-base.js").NodeOptions | undefined, location?: import("./node-base.js").LocationInfo | undefined) => Url;
|
|
18
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/tree/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGrE;;GAEG;AACH,qBAAa,GAAI,SAAQ,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IACzC,IAAI,SAAS;IACb,SAAS,SAAS;IAClB;;OAEG;IACM,OAAO,IAAI,MAAM;IAYjB,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY;CAShD;AAED,eAAO,MAAM,GAAG,iMAAyB,CAAC"}
|
package/lib/tree/url.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Node, defineType } from './node.js';
|
|
2
|
+
import { getPrintOptions } from './util/print.js';
|
|
3
|
+
import { isNode } from './util/is-node.js';
|
|
4
|
+
/**
|
|
5
|
+
* e.g. url('foo.png')
|
|
6
|
+
*/
|
|
7
|
+
export class Url extends Node {
|
|
8
|
+
type = 'Url';
|
|
9
|
+
shortType = 'url';
|
|
10
|
+
/**
|
|
11
|
+
* @todo - enable URL rewriting
|
|
12
|
+
*/
|
|
13
|
+
valueOf() {
|
|
14
|
+
let value = this.value;
|
|
15
|
+
if (isNode(value, 'Quoted')) {
|
|
16
|
+
value = value.value;
|
|
17
|
+
if (isNode(value)) {
|
|
18
|
+
return String(value.value);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
return value.value;
|
|
23
|
+
}
|
|
24
|
+
toTrimmedString(options) {
|
|
25
|
+
options = getPrintOptions(options);
|
|
26
|
+
const w = options.writer;
|
|
27
|
+
const mark = w.mark();
|
|
28
|
+
w.add('url(');
|
|
29
|
+
this.value.toString(options);
|
|
30
|
+
w.add(')');
|
|
31
|
+
return w.getSince(mark);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export const url = defineType(Url, 'Url');
|
|
35
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/tree/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,eAAe,EAAqB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,IAAkB;IACzC,IAAI,GAAG,KAAK,CAAC;IACb,SAAS,GAAG,KAAK,CAAC;IAClB;;OAEG;IACM,OAAO;QACd,IAAI,KAAK,GAAkB,IAAI,CAAC,KAAK,CAAC;QACtC,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YAC5B,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YACpB,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClB,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAQ,KAAa,CAAC,KAAK,CAAC;IAC9B,CAAC;IAEQ,eAAe,CAAC,OAAsB;QAC7C,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAO,CAAC;QAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACX,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const syncLog: (data: object) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-log.d.ts","sourceRoot":"","sources":["../../../../src/tree/util/__tests__/debug-log.ts"],"names":[],"mappings":"AA6BA,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAcpD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synchronous debug logging utility for tests.
|
|
3
|
+
* This file is in __tests__ so it won't be included in the public API.
|
|
4
|
+
*/
|
|
5
|
+
import { appendFileSync, existsSync, mkdirSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
// Find monorepo root by looking for pnpm-workspace.yaml
|
|
9
|
+
function findMonorepoRoot(start) {
|
|
10
|
+
let dir = start;
|
|
11
|
+
while (dir !== '/') {
|
|
12
|
+
if (existsSync(join(dir, 'pnpm-workspace.yaml'))) {
|
|
13
|
+
return dir;
|
|
14
|
+
}
|
|
15
|
+
dir = dirname(dir);
|
|
16
|
+
}
|
|
17
|
+
return process.cwd();
|
|
18
|
+
}
|
|
19
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const ROOT = findMonorepoRoot(__dirname);
|
|
21
|
+
const LOG_DIR = join(ROOT, '.cursor');
|
|
22
|
+
const LOG_PATH = process.env.DEBUG_LOG_PATH || join(LOG_DIR, 'debug.log');
|
|
23
|
+
// Ensure directory exists
|
|
24
|
+
try {
|
|
25
|
+
mkdirSync(LOG_DIR, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
catch { }
|
|
28
|
+
export const syncLog = (data) => {
|
|
29
|
+
try {
|
|
30
|
+
appendFileSync(LOG_PATH, JSON.stringify(data) + '\n');
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Ignore errors
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=debug-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-log.js","sourceRoot":"","sources":["../../../../src/tree/util/__tests__/debug-log.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AAC;QACP,gBAAgB;IAClB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate.d.ts","sourceRoot":"","sources":["../../../src/tree/util/calculate.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEnD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,UAQ3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate.js","sourceRoot":"","sources":["../../../src/tree/util/calculate.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,EAAY,EAAE,CAAS;IAC1D,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvB,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvB,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvB,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvB,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cast.d.ts","sourceRoot":"","sources":["../../../src/tree/util/cast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAyEvC;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,CAWrC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Nil } from '../nil.js';
|
|
2
|
+
import { List } from '../list.js';
|
|
3
|
+
// Dimension and Num are NOT imported here to break circular dependency:
|
|
4
|
+
// dimension.ts → color.ts → call.ts → cast.ts → dimension.ts
|
|
5
|
+
// Instead, we use createRequire to access them synchronously at runtime
|
|
6
|
+
import { Any } from '../any.js';
|
|
7
|
+
import { Color } from '../color.js';
|
|
8
|
+
import { JsFunction } from '../js-function.js';
|
|
9
|
+
import { JsObject } from '../js-object.js';
|
|
10
|
+
import { Bool } from '../bool.js';
|
|
11
|
+
import { isNode } from './is-node.js';
|
|
12
|
+
import isPlainObject from 'lodash-es/isPlainObject.js';
|
|
13
|
+
import { createRequire } from 'node:module';
|
|
14
|
+
const { isArray } = Array;
|
|
15
|
+
// Create a synchronous require function for ES modules
|
|
16
|
+
const require = createRequire(import.meta.url);
|
|
17
|
+
// Lazy getters for Dimension and Num to break circular dependency
|
|
18
|
+
// These use require() to access modules at runtime, not at module load time
|
|
19
|
+
// By the time cast() is called, dimension.ts and number.ts will be fully loaded
|
|
20
|
+
function getDimension() {
|
|
21
|
+
// Use require() to access module at runtime - breaks circular dependency at module load time
|
|
22
|
+
return require('../dimension.js').Dimension;
|
|
23
|
+
}
|
|
24
|
+
function getNum() {
|
|
25
|
+
// Use require() to access module at runtime - breaks circular dependency at module load time
|
|
26
|
+
return require('../number.js').Num;
|
|
27
|
+
}
|
|
28
|
+
function getNodeType(value) {
|
|
29
|
+
if (isNode(value)) {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
if (value === undefined || value === null) {
|
|
33
|
+
return new Nil();
|
|
34
|
+
}
|
|
35
|
+
if (typeof value === 'boolean') {
|
|
36
|
+
return new Bool(value);
|
|
37
|
+
}
|
|
38
|
+
if (typeof value === 'function') {
|
|
39
|
+
// Hmm, the LLM added this, is it needed?
|
|
40
|
+
// Preserve function options (e.g., params metadata from getFunctionFromMixins)
|
|
41
|
+
const options = value?.options;
|
|
42
|
+
return new JsFunction(value, options);
|
|
43
|
+
}
|
|
44
|
+
if (isPlainObject(value)) {
|
|
45
|
+
return new JsObject(value);
|
|
46
|
+
}
|
|
47
|
+
if (isArray(value)) {
|
|
48
|
+
return new List(value.map(val => cast(val)));
|
|
49
|
+
}
|
|
50
|
+
if (value.constructor === Number) {
|
|
51
|
+
const Num = getNum();
|
|
52
|
+
return new Num(value);
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === 'string') {
|
|
55
|
+
if (value.startsWith('#')) {
|
|
56
|
+
return new Color(value);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
let result = value.match(/^(\d*(?:\.\d+))([a-z]*)$/i);
|
|
60
|
+
if (result) {
|
|
61
|
+
const Dimension = getDimension();
|
|
62
|
+
return new Dimension({ number: parseFloat(result[1]), unit: result[2] });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return new Any(value.toString());
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Casts a primitive JavaScript value to a Jess node
|
|
70
|
+
* (if not already).
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* cast(area(5))
|
|
74
|
+
*/
|
|
75
|
+
export function cast(value) {
|
|
76
|
+
const node = getNodeType(value);
|
|
77
|
+
/**
|
|
78
|
+
* If converting from a primitive, then
|
|
79
|
+
* the value should be considered evaluated.
|
|
80
|
+
*/
|
|
81
|
+
if (!isNode(value)) {
|
|
82
|
+
node.evaluated = true;
|
|
83
|
+
node.preEvaluated = true;
|
|
84
|
+
}
|
|
85
|
+
return node;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=cast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cast.js","sourceRoot":"","sources":["../../../src/tree/util/cast.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,wEAAwE;AACxE,6DAA6D;AAC7D,wEAAwE;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC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CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloning.d.ts","sourceRoot":"","sources":["../../../src/tree/util/cloning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wBAAwB;AACxB,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,wDAIxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloning.js","sourceRoot":"","sources":["../../../src/tree/util/cloning.ts"],"names":[],"mappings":"AAEA,wBAAwB;AACxB,MAAM,UAAU,cAAc,CAAC,IAAU;IACvC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;IAChB,OAAO,CAAC,CAAC;AACX,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Originally I had custom Hashmaps and ArrayLists, in order to normalize
|
|
3
|
+
* generators and iterators for each. But using non-native collections
|
|
4
|
+
* adds complexity but, more importantly, performance overhead, especially
|
|
5
|
+
* if you don't use those iterators.
|
|
6
|
+
*
|
|
7
|
+
* Even using a Map over an object for a dictionary, in theory, has faster
|
|
8
|
+
* lookups, but in total evaluation time, when the file is parsed, it would
|
|
9
|
+
* be passing in either a Map or an object, and converting the object
|
|
10
|
+
* to a map has object creation overhead, and so does creating the map itself,
|
|
11
|
+
* if you pass in an array of arrays.
|
|
12
|
+
*
|
|
13
|
+
* Maps are good for dynamic property additions and repeated lookups. Nodes
|
|
14
|
+
* look up / evaluate properties, at most, once per node, so an object-as-map
|
|
15
|
+
* will either be faster or the differences will be negligible.
|
|
16
|
+
*
|
|
17
|
+
* So now, data is exceedingly simple. It's all passed in as is when parsing or
|
|
18
|
+
* using the API, and we just have some utility functions in this file to iterate over
|
|
19
|
+
* arrays / objects / simple values and return the values or entries, in any order.
|
|
20
|
+
*/
|
|
21
|
+
import type { ConditionalExcept } from 'type-fest';
|
|
22
|
+
import type { Rules } from '../rules.js';
|
|
23
|
+
import type { Node } from '../node.js';
|
|
24
|
+
export declare function atIndex<T>(array: readonly T[], index?: number): T | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Entry generators, and this type will yield
|
|
27
|
+
* - [0] the value
|
|
28
|
+
* - [1] the key, if applicable, or the key '__value' for non-objects
|
|
29
|
+
* - [2] the containing object.
|
|
30
|
+
*
|
|
31
|
+
* The purpose of this structure is to iterate and allow replacement
|
|
32
|
+
* of the value in its containing object.
|
|
33
|
+
*
|
|
34
|
+
* The function logic should mirror this type logic.
|
|
35
|
+
*/
|
|
36
|
+
type GetEntriesOf<T> = T extends readonly any[] ? [T[number], number, T] : T extends Node ? [Node, Node, Rules] : T extends Record<string, infer RecordValue> ? RecordValue extends readonly any[] ? [RecordValue[number], number, RecordValue] : [RecordValue, keyof ConditionalExcept<T, readonly any[]>, T] : [T, 'value', T];
|
|
37
|
+
export declare function getValues<T>(collection: T, reverse?: boolean): Generator<GetEntriesOf<{
|
|
38
|
+
value: T;
|
|
39
|
+
}>[0]>;
|
|
40
|
+
export declare function getEntries<T>(collection: T, reverse?: boolean): Generator<GetEntriesOf<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* We use { value: unknown } as the type for the node so that
|
|
43
|
+
* we can easily override the value type when calling.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getValuesFromNode<T extends {
|
|
46
|
+
value: unknown;
|
|
47
|
+
}>(node: T, reverse?: boolean): Generator<GetEntriesOf<T>[0]>;
|
|
48
|
+
/**
|
|
49
|
+
* This is especially useful, because we don't have to care about what the Node's `value` is,
|
|
50
|
+
* we can just iterate over it and get the entries, and replace as necessary.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getEntriesFromNode<T extends {
|
|
53
|
+
value: unknown;
|
|
54
|
+
}>(node: T, reverse?: boolean): Generator<GetEntriesOf<T>>;
|
|
55
|
+
export declare function arraysEqual(a: string[], b: string[]): boolean;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/tree/util/collections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAInD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,GAAE,MAAW,GAAG,CAAC,GAAG,SAAS,CAMjF;AAED;;;;;;;;;;GAUG;AACH,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,EAAE,GAC3C,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,GACtB,CAAC,SAAS,IAAI,GACZ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,GACnB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,WAAW,CAAC,GACzC,WAAW,SAAS,SAAS,GAAG,EAAE,GAChC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,GAC1C,CAAC,WAAW,EAAE,MAAM,iBAAiB,CAAC,CAAC,EAAE,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,GAC9D,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAMxB,wBAAiB,SAAS,CAAC,CAAC,EAAE,UAAU,E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