chnobli 0.1.4 → 0.1.6
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/.prettierignore +4 -0
- package/.prettierrc +6 -0
- package/.vscode/settings.json +4 -0
- package/auto-docs/easing.js.html +342 -0
- package/auto-docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/auto-docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/auto-docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/auto-docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/auto-docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/auto-docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/auto-docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/auto-docs/global.html +4810 -0
- package/auto-docs/index.html +65 -0
- package/auto-docs/scripts/linenumber.js +25 -0
- package/auto-docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/auto-docs/scripts/prettify/lang-css.js +2 -0
- package/auto-docs/scripts/prettify/prettify.js +28 -0
- package/auto-docs/styles/jsdoc-default.css +358 -0
- package/auto-docs/styles/prettify-jsdoc.css +111 -0
- package/auto-docs/styles/prettify-tomorrow.css +132 -0
- package/dist/animation/Animation.d.ts +36 -0
- package/dist/animation/Animation.d.ts.map +1 -0
- package/dist/animation/Animation.js +230 -0
- package/dist/animation/Animation.js.map +1 -0
- package/dist/animation/animation.d.ts +36 -0
- package/dist/animation/animation.d.ts.map +1 -0
- package/dist/animation/animation.js +230 -0
- package/dist/animation/animation.js.map +1 -0
- package/dist/animation/public.d.ts +55 -0
- package/dist/animation/public.d.ts.map +1 -0
- package/dist/animation/public.js +104 -0
- package/dist/animation/public.js.map +1 -0
- package/dist/chnobli.d.ts +15 -0
- package/dist/chnobli.d.ts.map +1 -0
- package/dist/chnobli.js +63 -0
- package/dist/chnobli.js.map +1 -0
- package/dist/property/BasicProperty.d.ts +38 -0
- package/dist/property/BasicProperty.d.ts.map +1 -0
- package/dist/property/BasicProperty.js +72 -0
- package/dist/property/BasicProperty.js.map +1 -0
- package/dist/property/ClassProperty.d.ts +32 -0
- package/dist/property/ClassProperty.d.ts.map +1 -0
- package/dist/property/ClassProperty.js +108 -0
- package/dist/property/ClassProperty.js.map +1 -0
- package/dist/property/Property.d.ts +13 -0
- package/dist/property/Property.d.ts.map +1 -0
- package/dist/property/Property.js +20 -0
- package/dist/property/Property.js.map +1 -0
- package/dist/property/StyleProperty.d.ts +25 -0
- package/dist/property/StyleProperty.d.ts.map +1 -0
- package/dist/property/StyleProperty.js +221 -0
- package/dist/property/StyleProperty.js.map +1 -0
- package/dist/property/TransformProperty.d.ts +15 -0
- package/dist/property/TransformProperty.d.ts.map +1 -0
- package/dist/property/TransformProperty.js +43 -0
- package/dist/property/TransformProperty.js.map +1 -0
- package/dist/property/TransformXYProperty.d.ts +28 -0
- package/dist/property/TransformXYProperty.d.ts.map +1 -0
- package/dist/property/TransformXYProperty.js +65 -0
- package/dist/property/TransformXYProperty.js.map +1 -0
- package/dist/responsive/ResponsiveEvent.d.ts +17 -0
- package/dist/responsive/ResponsiveEvent.d.ts.map +1 -0
- package/dist/responsive/ResponsiveEvent.js +45 -0
- package/dist/responsive/ResponsiveEvent.js.map +1 -0
- package/dist/responsive/TestEvent.d.ts +11 -0
- package/dist/responsive/TestEvent.d.ts.map +1 -0
- package/dist/responsive/TestEvent.js +26 -0
- package/dist/responsive/TestEvent.js.map +1 -0
- package/dist/responsive/event.d.ts +10 -0
- package/dist/responsive/event.d.ts.map +1 -0
- package/dist/responsive/event.js +39 -0
- package/dist/responsive/event.js.map +1 -0
- package/dist/scroll/Scroll.d.ts +27 -0
- package/dist/scroll/Scroll.d.ts.map +1 -0
- package/dist/scroll/Scroll.js +132 -0
- package/dist/scroll/Scroll.js.map +1 -0
- package/dist/scroll/ScrollEvent.d.ts +17 -0
- package/dist/scroll/ScrollEvent.d.ts.map +1 -0
- package/dist/scroll/ScrollEvent.js +39 -0
- package/dist/scroll/ScrollEvent.js.map +1 -0
- package/dist/scroll/public.d.ts +7 -0
- package/dist/scroll/public.d.ts.map +1 -0
- package/dist/scroll/public.js +17 -0
- package/dist/scroll/public.js.map +1 -0
- package/dist/stagger/stagger.d.ts +13 -0
- package/dist/stagger/stagger.d.ts.map +1 -0
- package/dist/stagger/stagger.js +35 -0
- package/dist/stagger/stagger.js.map +1 -0
- package/dist/target/BaseTarget.old.d.ts +33 -0
- package/dist/target/BaseTarget.old.d.ts.map +1 -0
- package/dist/target/BaseTarget.old.js +73 -0
- package/dist/target/BaseTarget.old.js.map +1 -0
- package/dist/target/DomTarget.d.ts +41 -0
- package/dist/target/DomTarget.d.ts.map +1 -0
- package/dist/target/DomTarget.js +230 -0
- package/dist/target/DomTarget.js.map +1 -0
- package/dist/target/Target.d.ts +22 -0
- package/dist/target/Target.d.ts.map +1 -0
- package/dist/target/Target.js +21 -0
- package/dist/target/Target.js.map +1 -0
- package/dist/target/TestDomNode.d.ts +14 -0
- package/dist/target/TestDomNode.d.ts.map +1 -0
- package/dist/target/TestDomNode.js +55 -0
- package/dist/target/TestDomNode.js.map +1 -0
- package/dist/timeline/Nested.d.ts +30 -0
- package/dist/timeline/Nested.d.ts.map +1 -0
- package/dist/timeline/Nested.js +51 -0
- package/dist/timeline/Nested.js.map +1 -0
- package/dist/timeline/TimeLine.d.ts +32 -0
- package/dist/timeline/TimeLine.d.ts.map +1 -0
- package/dist/timeline/TimeLine.js +288 -0
- package/dist/timeline/TimeLine.js.map +1 -0
- package/dist/timeline/public.d.ts +120 -0
- package/dist/timeline/public.d.ts.map +1 -0
- package/dist/timeline/public.js +301 -0
- package/dist/timeline/public.js.map +1 -0
- package/dist/timing/AnimationFrameTicker.d.ts +32 -0
- package/dist/timing/AnimationFrameTicker.d.ts.map +1 -0
- package/dist/timing/AnimationFrameTicker.js +134 -0
- package/dist/timing/AnimationFrameTicker.js.map +1 -0
- package/dist/timing/Ease.d.ts +6 -0
- package/dist/timing/Ease.d.ts.map +1 -0
- package/dist/timing/Ease.js +15 -0
- package/dist/timing/Ease.js.map +1 -0
- package/dist/timing/TestTicker.d.ts +19 -0
- package/dist/timing/TestTicker.d.ts.map +1 -0
- package/dist/timing/TestTicker.js +81 -0
- package/dist/timing/TestTicker.js.map +1 -0
- package/dist/timing/Ticker.d.ts +14 -0
- package/dist/timing/Ticker.d.ts.map +1 -0
- package/dist/timing/Ticker.js +2 -0
- package/dist/timing/Ticker.js.map +1 -0
- package/dist/timing/Timing.d.ts +62 -0
- package/dist/timing/Timing.d.ts.map +1 -0
- package/dist/timing/Timing.js +257 -0
- package/dist/timing/Timing.js.map +1 -0
- package/dist/timing/easing.d.ts +158 -0
- package/dist/timing/easing.d.ts.map +1 -0
- package/dist/timing/easing.js +273 -0
- package/dist/timing/easing.js.map +1 -0
- package/dist/utils/Events.d.ts +9 -0
- package/dist/utils/Events.d.ts.map +1 -0
- package/dist/utils/Events.js +35 -0
- package/dist/utils/Events.js.map +1 -0
- package/dist/utils/internal.d.ts +2 -0
- package/dist/utils/internal.d.ts.map +1 -0
- package/dist/utils/internal.js +6 -0
- package/dist/utils/internal.js.map +1 -0
- package/dist/utils/motionpath.d.ts +16 -0
- package/dist/utils/motionpath.d.ts.map +1 -0
- package/dist/utils/motionpath.js +41 -0
- package/dist/utils/motionpath.js.map +1 -0
- package/dist/utils/utils.d.ts +43 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +93 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/values/ColorValue.d.ts +12 -0
- package/dist/values/ColorValue.d.ts.map +1 -0
- package/dist/values/ColorValue.js +133 -0
- package/dist/values/ColorValue.js.map +1 -0
- package/dist/values/StyleValue.d.ts +40 -0
- package/dist/values/StyleValue.d.ts.map +1 -0
- package/dist/values/StyleValue.js +149 -0
- package/dist/values/StyleValue.js.map +1 -0
- package/dist/values/Value.d.ts +13 -0
- package/dist/values/Value.d.ts.map +1 -0
- package/dist/values/Value.js +38 -0
- package/dist/values/Value.js.map +1 -0
- package/dist/values/defaultcolors.d.ts +2 -0
- package/dist/values/defaultcolors.d.ts.map +1 -0
- package/dist/values/defaultcolors.js +149 -0
- package/dist/values/defaultcolors.js.map +1 -0
- package/package.json +11 -7
- package/src/animation/{animation.js → Animation.ts} +56 -54
- package/src/animation/{public.js → public.ts} +23 -18
- package/src/{chnobli.js → chnobli.ts} +11 -12
- package/src/property/BasicProperty.ts +91 -0
- package/src/property/ClassProperty.ts +132 -0
- package/src/property/Property.ts +33 -0
- package/src/property/StyleProperty.ts +273 -0
- package/src/property/TransformProperty.ts +56 -0
- package/src/property/TransformXYProperty.ts +88 -0
- package/src/responsive/ResponsiveEvent.ts +60 -0
- package/src/responsive/{testevent.js → TestEvent.ts} +12 -10
- package/src/scroll/{scroll.js → Scroll.ts} +53 -35
- package/src/scroll/ScrollEvent.ts +53 -0
- package/src/scroll/public.ts +20 -0
- package/src/stagger/stagger.ts +45 -0
- package/src/target/{basetarget.js → BaseTarget.old.ts} +25 -26
- package/src/target/DomTarget.ts +281 -0
- package/src/target/Target.ts +48 -0
- package/src/target/{testdomnode.js → TestDomNode.ts} +18 -15
- package/src/tests/{properties.test.js → properties.test.ts} +54 -49
- package/src/tests/timeline.test.ts +290 -0
- package/src/tests/{timing.test.js → timing.test.ts} +25 -22
- package/src/tests/{usecases.test.js → usecases.test.ts} +13 -10
- package/src/tests/{values.test.js → values.test.ts} +21 -21
- package/src/timeline/Nested.ts +67 -0
- package/src/timeline/{timeline.js → TimeLine.ts} +126 -56
- package/src/timeline/{public.js → public.ts} +112 -73
- package/src/timing/{ticker.js → AnimationFrameTicker.ts} +36 -21
- package/src/timing/{ease.js → Ease.ts} +6 -5
- package/src/timing/{testticker.js → TestTicker.ts} +27 -24
- package/src/timing/Ticker.ts +11 -0
- package/src/timing/{timing.js → Timing.ts} +72 -63
- package/src/timing/{easing.js → easing.ts} +52 -43
- package/src/utils/{events.js → Events.ts} +12 -11
- package/src/utils/internal.ts +10 -0
- package/src/utils/{motionpath.js → motionpath.ts} +36 -13
- package/src/utils/utils.ts +110 -0
- package/src/values/{colorvalue.js → ColorValue.ts} +46 -47
- package/src/values/StyleValue.ts +186 -0
- package/src/values/{value.js → Value.ts} +14 -12
- package/src/values/{defaultcolors.js → defaultcolors.ts} +2 -2
- package/tsconfig.build.json +19 -0
- package/tsconfig.json +17 -108
- package/src/animation/property.js +0 -556
- package/src/responsive/event.js +0 -46
- package/src/scroll/event.js +0 -41
- package/src/scroll/public.js +0 -17
- package/src/stagger/stagger.js +0 -42
- package/src/target/domtarget.js +0 -266
- package/src/target/target.js +0 -22
- package/src/tests/timeline.test.js +0 -234
- package/src/utils/internal.js +0 -7
- package/src/utils/utils.js +0 -75
- package/src/values/stylevalue.js +0 -148
package/tsconfig.json
CHANGED
|
@@ -1,110 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
20
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
21
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
22
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
23
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
24
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
25
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
26
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
27
|
-
|
|
28
|
-
/* Modules */
|
|
29
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
|
30
|
-
// "rootDir": "./src", /* Specify the root folder within your source files. */
|
|
31
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
32
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
33
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
34
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
35
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
36
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
37
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
38
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
39
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
40
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
41
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
42
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
43
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
44
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
45
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
46
|
-
|
|
47
|
-
/* JavaScript Support */
|
|
48
|
-
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
49
|
-
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
50
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
51
|
-
|
|
52
|
-
/* Emit */
|
|
53
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
54
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
55
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
56
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
57
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
58
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
59
|
-
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
60
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
61
|
-
"noEmit": true, /* Disable emitting files from a compilation. */
|
|
62
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
63
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
64
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
65
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
66
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
67
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
68
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
69
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
70
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
71
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
72
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
73
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
74
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
75
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
76
|
-
|
|
77
|
-
/* Interop Constraints */
|
|
78
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
79
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
80
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
81
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
82
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
83
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
84
|
-
|
|
85
|
-
/* Type Checking */
|
|
86
|
-
// "strict": true, /* Enable all strict type-checking options. */
|
|
87
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
88
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
89
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
90
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
91
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
92
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
93
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
94
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
95
|
-
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
96
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
97
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
98
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
99
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
100
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
101
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
102
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
103
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
104
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
105
|
-
|
|
106
|
-
/* Completeness */
|
|
107
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
108
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
109
|
-
}
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"allowJs": true,
|
|
12
|
+
"checkJs": false,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"outDir": "./dist"
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*.ts"],
|
|
18
|
+
|
|
110
19
|
}
|
|
@@ -1,556 +0,0 @@
|
|
|
1
|
-
import Value from '../values/value.js';
|
|
2
|
-
import ColorValue from '../values/colorvalue.js';
|
|
3
|
-
import StyleValue from '../values/stylevalue.js';
|
|
4
|
-
|
|
5
|
-
export default class Property {
|
|
6
|
-
constructor(name) {
|
|
7
|
-
// this is the property name
|
|
8
|
-
this.name = name;
|
|
9
|
-
|
|
10
|
-
this.from = null;
|
|
11
|
-
this.to = null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
allowsValueFn() {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* From or to might be null
|
|
20
|
-
*/
|
|
21
|
-
init(target, from, to) {
|
|
22
|
-
if (!from)
|
|
23
|
-
from = this.getValue(target);
|
|
24
|
-
|
|
25
|
-
if (!to)
|
|
26
|
-
to = this.getValue(target);
|
|
27
|
-
|
|
28
|
-
if (!from || !to)
|
|
29
|
-
throw new Error('could not determine from or to value');
|
|
30
|
-
|
|
31
|
-
const [nFrom, nTo] = target.unifyValues(this.name, from, to);
|
|
32
|
-
|
|
33
|
-
this.from = nFrom;
|
|
34
|
-
this.to = nTo;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Gets called with the value of a property
|
|
39
|
-
*
|
|
40
|
-
* For examply during initializiation
|
|
41
|
-
*/
|
|
42
|
-
parseValue(val) {
|
|
43
|
-
return Value.parse(val);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
defaultValue() {
|
|
47
|
-
throw new Error('default value for ' + this.name + ' not known');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// try to access the value from the target
|
|
51
|
-
getValue(target) {
|
|
52
|
-
const val = target.getValue(this.name);
|
|
53
|
-
if (typeof val === 'undefined' || val === null)
|
|
54
|
-
return this.defaultValue();
|
|
55
|
-
|
|
56
|
-
return val;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Pos needs to be between 0 and 1
|
|
61
|
-
*/
|
|
62
|
-
interpolate(pos) {
|
|
63
|
-
const dif = this.to.num - this.from.num;
|
|
64
|
-
|
|
65
|
-
return this.from.cloneAdd(pos * dif);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
setValue(target, val) {
|
|
69
|
-
return target.setValue(this.name, val);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
removeValue(target) {
|
|
73
|
-
return target.removeValue(this.name);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const TRANSFORM_PROPS = {
|
|
78
|
-
'x': [0, 'px'],
|
|
79
|
-
'y': [0, 'px'],
|
|
80
|
-
'z': [0, 'px'],
|
|
81
|
-
'scale': [1, null],
|
|
82
|
-
'scaleX': [1, null],
|
|
83
|
-
'scaleY': [1, null],
|
|
84
|
-
'scaleZ': [1, null],
|
|
85
|
-
'rotate': [0, 'deg'],
|
|
86
|
-
'rotateX': [0, 'deg'],
|
|
87
|
-
'rotateY': [0, 'deg'],
|
|
88
|
-
'rotateZ': [0, 'deg'],
|
|
89
|
-
'skew': [0, 'deg'],
|
|
90
|
-
'skewX': [0, 'deg'],
|
|
91
|
-
'skewY': [0, 'deg']
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export class Transform extends Property {
|
|
95
|
-
constructor(name) {
|
|
96
|
-
super(name);
|
|
97
|
-
|
|
98
|
-
this._defaultValue = new Value(...TRANSFORM_PROPS[name]);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
parseValue(val) {
|
|
102
|
-
return Value.parse(val);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
defaultValue() {
|
|
106
|
-
return this._defaultValue.clone();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
getValue(target) {
|
|
110
|
-
return target.getTransformValue(this.name) ?? this.defaultValue();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
setValue(target, val) {
|
|
114
|
-
target.setTransformValue(this.name, val);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
removeValue(target) {
|
|
118
|
-
target.removeTransformValue(this.name);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export class TransformXY extends Property {
|
|
123
|
-
constructor(name) {
|
|
124
|
-
super(name);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
parseValue(val) {
|
|
128
|
-
if (Array.isArray(val))
|
|
129
|
-
val = { x: val[0], y: val[1] };
|
|
130
|
-
|
|
131
|
-
const { x, y } = val;
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
x: Value.parse(x),
|
|
135
|
-
y: Value.parse(y)
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
defaultValue() {
|
|
140
|
-
return {
|
|
141
|
-
x: new Value(0, 'px'),
|
|
142
|
-
y: new Value(0, 'px')
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
getValue(target) {
|
|
147
|
-
const x = target.getTransformValue('x');
|
|
148
|
-
const y = target.getTransformValue('y');
|
|
149
|
-
|
|
150
|
-
const def = this.defaultValue();
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
x: x ? x : def.x,
|
|
154
|
-
y: y ? y : def.y
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
setValue(target, val) {
|
|
159
|
-
target.setTransformValue('x', val.x.withDefaultUnit('px'));
|
|
160
|
-
target.setTransformValue('y', val.y.withDefaultUnit('px'));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
removeValue(target) {
|
|
164
|
-
target.removeTransformValue('x');
|
|
165
|
-
target.removeTransformValue('y');
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const STYLE_PROPS = {
|
|
170
|
-
'position': 'static',
|
|
171
|
-
'display': 'block',
|
|
172
|
-
'visibility': 'visible',
|
|
173
|
-
'minWidth': 'px',
|
|
174
|
-
'width': 'px',
|
|
175
|
-
'maxWidth': 'px',
|
|
176
|
-
'minHeight': 'px',
|
|
177
|
-
'height': 'px',
|
|
178
|
-
'maxHeight': 'px',
|
|
179
|
-
'top': 'px',
|
|
180
|
-
'left': 'px',
|
|
181
|
-
'right': 'px',
|
|
182
|
-
'bottom': 'px',
|
|
183
|
-
'opacity': [1, null],
|
|
184
|
-
'padding': 'px',
|
|
185
|
-
'margin': 'px',
|
|
186
|
-
'color': '#000',
|
|
187
|
-
'backgroundColor': '#fff'
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export class StyleProp extends Property {
|
|
191
|
-
constructor(name) {
|
|
192
|
-
super(name);
|
|
193
|
-
|
|
194
|
-
const def = STYLE_PROPS[name];
|
|
195
|
-
if (Array.isArray(def)) {
|
|
196
|
-
this._defaultValue = new StyleValue([new Value(def[0], def[1])]);
|
|
197
|
-
this.unit = def[1];
|
|
198
|
-
} else if (def === 'px') {
|
|
199
|
-
this._defaultValue = new StyleValue([new Value(0, def)]);
|
|
200
|
-
this.unit = def;
|
|
201
|
-
} else if (typeof def !== 'undefined') {
|
|
202
|
-
this._defaultValue = StyleValue.parse(def);
|
|
203
|
-
this.unit = null;
|
|
204
|
-
} else {
|
|
205
|
-
this._defaultValue = null;
|
|
206
|
-
this.unit = null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// text|color|values
|
|
210
|
-
this.kind = null;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
init(target, from, to) {
|
|
214
|
-
// this check is probably not necessary?
|
|
215
|
-
if (!from && !to)
|
|
216
|
-
throw new Error('either from or to need to be defined');
|
|
217
|
-
|
|
218
|
-
/*
|
|
219
|
-
if the user inputed a text value both need to be treated as text
|
|
220
|
-
and interpolated as classes or in reverse if they are negative values
|
|
221
|
-
|
|
222
|
-
if the user inputed a value both need to be treated as values and need
|
|
223
|
-
to match in length
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
if (from?.kind === 'text' || to?.kind === 'text') {
|
|
227
|
-
if (from && from.kind !== 'text')
|
|
228
|
-
throw new Error('from is expected to be a text because to is');
|
|
229
|
-
|
|
230
|
-
if (to && to.kind !== 'text')
|
|
231
|
-
throw new Error('to is expected to be a text because from is');
|
|
232
|
-
|
|
233
|
-
this.kind = 'text';
|
|
234
|
-
this.from = from;
|
|
235
|
-
this.to = to;
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// get the current value
|
|
240
|
-
if (!from)
|
|
241
|
-
from = this.getValue(target);
|
|
242
|
-
|
|
243
|
-
// get the current value
|
|
244
|
-
if (!to)
|
|
245
|
-
to = this.getValue(target);
|
|
246
|
-
|
|
247
|
-
if (!from || !to)
|
|
248
|
-
throw new Error('from or to could not be defined, specified ' +
|
|
249
|
-
'it with fromTo');
|
|
250
|
-
|
|
251
|
-
// if one is a color both need to be a color
|
|
252
|
-
if (from.kind === 'color' || to.kind === 'color') {
|
|
253
|
-
if (from.kind !== to.kind)
|
|
254
|
-
throw new Error('expected two colors');
|
|
255
|
-
|
|
256
|
-
this.kind = 'color';
|
|
257
|
-
this.from = from;
|
|
258
|
-
this.to = to;
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// check that both are values
|
|
263
|
-
if (from.kind === 'text')
|
|
264
|
-
from = this.defaultValue();
|
|
265
|
-
|
|
266
|
-
if (to.kind === 'text')
|
|
267
|
-
to = this.defaultValue();
|
|
268
|
-
|
|
269
|
-
if (from.length === 0 || to.length === 0)
|
|
270
|
-
throw new Error('from or to has zero values');
|
|
271
|
-
|
|
272
|
-
// either from or to needs to be 1 to work
|
|
273
|
-
|
|
274
|
-
if (from.length !== to.length && from.length !== 1 && to.length !== 1)
|
|
275
|
-
throw new Error('from or to need to match in length or be one');
|
|
276
|
-
|
|
277
|
-
const newLength = Math.max(from.length, to.length);
|
|
278
|
-
from.extendToLength(newLength);
|
|
279
|
-
to.extendToLength(newLength);
|
|
280
|
-
|
|
281
|
-
// now let's try to unify each value
|
|
282
|
-
const fromVals = [];
|
|
283
|
-
const toVals = [];
|
|
284
|
-
|
|
285
|
-
// now we need to make sure the values are the same
|
|
286
|
-
for (let i = 0; i < newLength; i++) {
|
|
287
|
-
const f = from.values[i];
|
|
288
|
-
const t = to.values[i];
|
|
289
|
-
|
|
290
|
-
const [nFrom, nTo] = target.unifyValues(this.name, f, t);
|
|
291
|
-
fromVals.push(nFrom);
|
|
292
|
-
toVals.push(nTo);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
this.kind = 'values';
|
|
296
|
-
this.from = new StyleValue(fromVals);
|
|
297
|
-
this.to = new StyleValue(toVals);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
parseValue(val) {
|
|
301
|
-
return StyleValue.parse(val);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
defaultValue() {
|
|
305
|
-
return this._defaultValue?.clone();
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
getValue(target) {
|
|
309
|
-
const val = target.getStyleValue(this.name);
|
|
310
|
-
if (!val)
|
|
311
|
-
return this.defaultValue();
|
|
312
|
-
|
|
313
|
-
return val;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
interpolate(pos) {
|
|
317
|
-
switch (this.kind) {
|
|
318
|
-
case 'text':
|
|
319
|
-
return this._interpolateText(pos);
|
|
320
|
-
|
|
321
|
-
case 'color':
|
|
322
|
-
return this._interpolateColor(pos);
|
|
323
|
-
|
|
324
|
-
default:
|
|
325
|
-
return this._interpolateValues(pos);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
_interpolateText(pos) {
|
|
330
|
-
/*
|
|
331
|
-
## if both values are set
|
|
332
|
-
|
|
333
|
-
<=0 the from value will be set
|
|
334
|
-
>0 the to value will be set
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
## if only one text is set
|
|
338
|
-
|
|
339
|
-
if the to value is
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
the text in the to value will be set >0
|
|
343
|
-
the text in the to value will be removed in <=0
|
|
344
|
-
|
|
345
|
-
the text in the from value will be set <1
|
|
346
|
-
the text in the from value will be removed in >=1
|
|
347
|
-
*/
|
|
348
|
-
if (this.from && this.to) {
|
|
349
|
-
if (pos <= 0)
|
|
350
|
-
return this.from.clone();
|
|
351
|
-
|
|
352
|
-
return this.to.clone();
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (this.to) {
|
|
356
|
-
if (pos <= 0)
|
|
357
|
-
return null;
|
|
358
|
-
|
|
359
|
-
return this.to.clone();
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (this.from) {
|
|
363
|
-
if (pos >= 1)
|
|
364
|
-
return null;
|
|
365
|
-
|
|
366
|
-
return this.from.clone();
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
throw new Error('expected from or to');
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
_interpolateColor(pos) {
|
|
373
|
-
const vals = [];
|
|
374
|
-
|
|
375
|
-
for (let i = 0; i < 4; i++) {
|
|
376
|
-
const f = this.from.values.values[i];
|
|
377
|
-
const t = this.to.values.values[i];
|
|
378
|
-
|
|
379
|
-
const dif = t - f;
|
|
380
|
-
|
|
381
|
-
vals.push(f + pos * dif);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return new StyleValue(new ColorValue(vals));
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
_interpolateValues(pos) {
|
|
388
|
-
// both values should be the same length
|
|
389
|
-
|
|
390
|
-
const vals = [];
|
|
391
|
-
|
|
392
|
-
for (let i = 0; i < this.from.values.length; i++) {
|
|
393
|
-
const f = this.from.values[i];
|
|
394
|
-
const t = this.to.values[i];
|
|
395
|
-
|
|
396
|
-
const dif = t.num - f.num;
|
|
397
|
-
|
|
398
|
-
vals.push(f.cloneAdd(pos * dif));
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return new StyleValue(vals);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
setValue(target, val) {
|
|
405
|
-
if (!val)
|
|
406
|
-
return target.removeStyleValue(this.name);
|
|
407
|
-
|
|
408
|
-
return target.setStyleValue(this.name, val.withDefaultUnit(this.unit));
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
removeValue(target) {
|
|
412
|
-
return target.removeStyleValue(this.name);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* In most cases we wan't to add the class at pos 0
|
|
418
|
-
* and in reverse remove it at pos 0
|
|
419
|
-
*
|
|
420
|
-
* so this behaviour should be in str|{ to }
|
|
421
|
-
*
|
|
422
|
-
* If we wan't to remove the class at pos 1
|
|
423
|
-
* and in reverse add it at pos 1
|
|
424
|
-
* we do it in { from }
|
|
425
|
-
*/
|
|
426
|
-
export class ClassNameProp extends Property {
|
|
427
|
-
constructor(name) {
|
|
428
|
-
super(name);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
allowsValueFn() {
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
init(target, from, to) {
|
|
436
|
-
this.from = from ?? [];
|
|
437
|
-
this.to = to ?? [];
|
|
438
|
-
|
|
439
|
-
this.preStates = new Map;
|
|
440
|
-
this.states = new Map;
|
|
441
|
-
|
|
442
|
-
for (const cls of [...this.from, ...this.to]) {
|
|
443
|
-
const exists = target.hasClass(cls);
|
|
444
|
-
this.preStates.set(cls, exists);
|
|
445
|
-
this.states.set(cls, exists);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
parseValue(val) {
|
|
450
|
-
if (Array.isArray(val)) {
|
|
451
|
-
return val.map(v => {
|
|
452
|
-
if (typeof v !== 'string')
|
|
453
|
-
throw new Error('cls only accepts strings[]');
|
|
454
|
-
|
|
455
|
-
return v;
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
if (typeof val === 'string')
|
|
460
|
-
return [val];
|
|
461
|
-
|
|
462
|
-
throw new Error('cls only accepts strings and strings[]');
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
defaultValue() {
|
|
466
|
-
throw new Error('unused');
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
getValue(_target) {
|
|
470
|
-
throw new Error('unused');
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
interpolate(pos) {
|
|
474
|
-
/**
|
|
475
|
-
* ## to
|
|
476
|
-
* add the class at pos >0
|
|
477
|
-
* and in reverse remove it at pos 0
|
|
478
|
-
*
|
|
479
|
-
* ## from
|
|
480
|
-
* remove the class at pos <1
|
|
481
|
-
* and in reverse add it at pos 1
|
|
482
|
-
*/
|
|
483
|
-
|
|
484
|
-
let obj = {
|
|
485
|
-
add: [],
|
|
486
|
-
remove: []
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
if (pos <= 0) {
|
|
490
|
-
obj.remove = this.to;
|
|
491
|
-
} else {
|
|
492
|
-
obj.add = this.to;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
if (pos >= 1) {
|
|
496
|
-
obj.remove = this.from;
|
|
497
|
-
} else {
|
|
498
|
-
obj.add = [...obj.add, ...this.from];
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
return obj;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
setValue(target, val) {
|
|
505
|
-
let { add, remove } = val;
|
|
506
|
-
add = add ?? [];
|
|
507
|
-
remove = remove ?? [];
|
|
508
|
-
|
|
509
|
-
if (!Array.isArray(add) || !Array.isArray(remove))
|
|
510
|
-
throw new Error('add or remove expected');
|
|
511
|
-
|
|
512
|
-
add.forEach(cls => {
|
|
513
|
-
const exists = this.states.get(cls);
|
|
514
|
-
if (!exists) {
|
|
515
|
-
target.addClass(cls);
|
|
516
|
-
this.states.set(cls, true);
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
remove.forEach(cls => {
|
|
521
|
-
const exists = this.states.get(cls);
|
|
522
|
-
if (exists) {
|
|
523
|
-
target.removeClass(cls);
|
|
524
|
-
this.states.set(cls, false);
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
removeValue(target) {
|
|
530
|
-
this.preStates.forEach((exists, cls) => {
|
|
531
|
-
if (exists)
|
|
532
|
-
target.addClass(cls);
|
|
533
|
-
else
|
|
534
|
-
target.removeClass(cls);
|
|
535
|
-
});
|
|
536
|
-
this.states = new Map(this.preStates);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
export function newProperty(prop, targetType = '') {
|
|
541
|
-
if (targetType !== 'dom')
|
|
542
|
-
throw new Error('only dom is supported as target');
|
|
543
|
-
|
|
544
|
-
if (prop in TRANSFORM_PROPS)
|
|
545
|
-
return new Transform(prop);
|
|
546
|
-
if (prop === 'xy')
|
|
547
|
-
return new TransformXY(prop);
|
|
548
|
-
if (prop.startsWith('--'))
|
|
549
|
-
return new StyleProp(prop);
|
|
550
|
-
if (prop in STYLE_PROPS)
|
|
551
|
-
return new StyleProp(prop);
|
|
552
|
-
if (prop === 'cls')
|
|
553
|
-
return new ClassNameProp(prop);
|
|
554
|
-
|
|
555
|
-
throw new Error('unknown prop ' + prop);
|
|
556
|
-
}
|