keyframekit 1.0.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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -0
  3. package/dist/KeyframeKit.d.ts +139 -0
  4. package/dist/KeyframeKit.d.ts.map +1 -0
  5. package/dist/KeyframeKit.js +294 -0
  6. package/dist/KeyframeKit.js.map +1 -0
  7. package/docs/.vitepress/components/Playground/Playground.js +243 -0
  8. package/docs/.vitepress/components/Playground/Playground.vue +206 -0
  9. package/docs/.vitepress/components/Playground/defaultExample.js +175 -0
  10. package/docs/.vitepress/components/Playground/interFont.js +14 -0
  11. package/docs/.vitepress/components/Playground/themes/githubDark.js +402 -0
  12. package/docs/.vitepress/components/Playground/themes/githubLight.js +399 -0
  13. package/docs/.vitepress/components/Playground/themes.js +24 -0
  14. package/docs/.vitepress/config.ts +64 -0
  15. package/docs/.vitepress/referenceNavigation.ts +37 -0
  16. package/docs/.vitepress/theme/base-styles.css +91 -0
  17. package/docs/.vitepress/theme/env.d.ts +5 -0
  18. package/docs/.vitepress/theme/index.ts +40 -0
  19. package/docs/docs/index.md +136 -0
  20. package/docs/docs/public/icon.png +0 -0
  21. package/docs/docs/public/playground/KeyframeKit/dist/KeyframeKit.d.ts +139 -0
  22. package/docs/docs/public/playground/KeyframeKit/dist/KeyframeKit.d.ts.map +1 -0
  23. package/docs/docs/public/playground/KeyframeKit/dist/KeyframeKit.js +294 -0
  24. package/docs/docs/public/playground/KeyframeKit/dist/KeyframeKit.js.map +1 -0
  25. package/docs/docs/reference/_media/LICENSE +21 -0
  26. package/docs/docs/reference/classes/KeyframeEffectParameters.md +95 -0
  27. package/docs/docs/reference/classes/ParsedKeyframes.md +49 -0
  28. package/docs/docs/reference/index.md +20 -0
  29. package/docs/docs/reference/interfaces/KeyframesFactory.md +151 -0
  30. package/docs/docs/reference/navigation.json +64 -0
  31. package/docs/docs/reference/type-aliases/KeyframeArgument.md +9 -0
  32. package/docs/docs/reference/type-aliases/KeyframesFactorySource.md +9 -0
  33. package/docs/docs/reference/type-aliases/ParsedKeyframesRules.md +15 -0
  34. package/docs/docs/reference/variables/default.md +7 -0
  35. package/docs/package.json +25 -0
  36. package/docs/typedoc/plugin-param-names.js +52 -0
  37. package/docs/typedoc.json +63 -0
  38. package/package.json +37 -0
  39. package/src/KeyframeKit.ts +508 -0
  40. package/tsconfig.json +47 -0
  41. package/vercel.json +13 -0
@@ -0,0 +1,95 @@
1
+ [KeyframeKit](../index.md) / KeyframeEffectParameters
2
+
3
+ # Class: KeyframeEffectParameters
4
+
5
+ https://drafts.csswg.org/web-animations-1/#the-keyframeeffect-interface
6
+
7
+ ## Constructors
8
+
9
+ ### Constructor
10
+
11
+ ```ts
12
+ new KeyframeEffectParameters(obj: {
13
+ keyframes: KeyframeArgument;
14
+ options?: number | KeyframeEffectOptions;
15
+ }): KeyframeEffectParameters;
16
+ ```
17
+
18
+ #### Parameters
19
+
20
+ ##### obj
21
+
22
+ ###### keyframes
23
+
24
+ [`KeyframeArgument`](../type-aliases/KeyframeArgument.md)
25
+
26
+ [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats)
27
+
28
+ ###### options?
29
+
30
+ `number` \| `KeyframeEffectOptions` = `{}`
31
+
32
+ [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/KeyframeEffect#options)
33
+
34
+ #### Returns
35
+
36
+ `KeyframeEffectParameters`
37
+
38
+ ## Properties
39
+
40
+ ### keyframes
41
+
42
+ ```ts
43
+ keyframes: KeyframeArgument;
44
+ ```
45
+
46
+ ***
47
+
48
+ ### options
49
+
50
+ ```ts
51
+ options: KeyframeEffectOptions;
52
+ ```
53
+
54
+ ## Methods
55
+
56
+ ### toAnimation()
57
+
58
+ ```ts
59
+ toAnimation(obj: {
60
+ options?: number | KeyframeEffectOptions;
61
+ target: Element | null;
62
+ timeline?: AnimationTimeline;
63
+ }): Animation;
64
+ ```
65
+
66
+ #### Parameters
67
+
68
+ ##### obj
69
+
70
+ ###### options?
71
+
72
+ `number` \| `KeyframeEffectOptions` = `{}`
73
+
74
+ Additional keyframe effect options. Can override existing keys.
75
+ [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/KeyframeEffect#options)
76
+
77
+ ###### target
78
+
79
+ [`Element`](https://developer.mozilla.org/docs/Web/API/Element) \| `null`
80
+
81
+ An element to attach the animation to.
82
+
83
+ ###### timeline?
84
+
85
+ [`AnimationTimeline`](https://developer.mozilla.org/docs/Web/API/AnimationTimeline) = `document.timeline`
86
+
87
+ #### Returns
88
+
89
+ [`Animation`](https://developer.mozilla.org/docs/Web/API/Animation)
90
+
91
+ #### See
92
+
93
+ Specifications:
94
+ - https://drafts.csswg.org/web-animations-1/#the-keyframeeffect-interface
95
+ - https://drafts.csswg.org/web-animations-1/#the-animation-interface
@@ -0,0 +1,49 @@
1
+ [KeyframeKit](../index.md) / ParsedKeyframes
2
+
3
+ # Class: ParsedKeyframes
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ ```ts
10
+ new ParsedKeyframes(keyframes: Keyframe[]): ParsedKeyframes;
11
+ ```
12
+
13
+ #### Parameters
14
+
15
+ ##### keyframes
16
+
17
+ `Keyframe`[]
18
+
19
+ #### Returns
20
+
21
+ `ParsedKeyframes`
22
+
23
+ ## Properties
24
+
25
+ ### keyframes
26
+
27
+ ```ts
28
+ keyframes: Keyframe[];
29
+ ```
30
+
31
+ ## Methods
32
+
33
+ ### toKeyframeEffect()
34
+
35
+ ```ts
36
+ toKeyframeEffect(options: number | KeyframeEffectOptions | null): KeyframeEffectParameters;
37
+ ```
38
+
39
+ #### Parameters
40
+
41
+ ##### options
42
+
43
+ [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/KeyframeEffect#options)
44
+
45
+ `number` | `KeyframeEffectOptions` | `null`
46
+
47
+ #### Returns
48
+
49
+ [`KeyframeEffectParameters`](KeyframeEffectParameters.md)
@@ -0,0 +1,20 @@
1
+ # KeyframeKit
2
+
3
+ ## Classes
4
+
5
+ - [KeyframeEffectParameters](classes/KeyframeEffectParameters.md)
6
+ - [ParsedKeyframes](classes/ParsedKeyframes.md)
7
+
8
+ ## Interfaces
9
+
10
+ - [KeyframesFactory](interfaces/KeyframesFactory.md)
11
+
12
+ ## Type Aliases
13
+
14
+ - [KeyframeArgument](type-aliases/KeyframeArgument.md)
15
+ - [KeyframesFactorySource](type-aliases/KeyframesFactorySource.md)
16
+ - [ParsedKeyframesRules](type-aliases/ParsedKeyframesRules.md)
17
+
18
+ ## Variables
19
+
20
+ - [default](variables/default.md)
@@ -0,0 +1,151 @@
1
+ [KeyframeKit](../index.md) / KeyframesFactory
2
+
3
+ # Interface: KeyframesFactory
4
+
5
+ ## Properties
6
+
7
+ ### Error
8
+
9
+ ```ts
10
+ readonly Error: {
11
+ KeyframesRuleNameTypeError: typeof KeyframesRuleNameTypeError;
12
+ SourceTypeError: typeof SourceTypeError;
13
+ StyleSheetImportError: typeof StyleSheetImportError;
14
+ };
15
+ ```
16
+
17
+ #### KeyframesRuleNameTypeError
18
+
19
+ ```ts
20
+ readonly KeyframesRuleNameTypeError: typeof KeyframesRuleNameTypeError;
21
+ ```
22
+
23
+ #### SourceTypeError
24
+
25
+ ```ts
26
+ readonly SourceTypeError: typeof SourceTypeError;
27
+ ```
28
+
29
+ #### StyleSheetImportError
30
+
31
+ ```ts
32
+ readonly StyleSheetImportError: typeof StyleSheetImportError;
33
+ ```
34
+
35
+ ## Methods
36
+
37
+ ### getAllStyleSheetKeyframesRules()
38
+
39
+ ```ts
40
+ getAllStyleSheetKeyframesRules(obj: {
41
+ in: KeyframesFactorySource;
42
+ }): ParsedKeyframesRules;
43
+ ```
44
+
45
+ #### Parameters
46
+
47
+ ##### obj
48
+
49
+ ###### in
50
+
51
+ [`KeyframesFactorySource`](../type-aliases/KeyframesFactorySource.md)
52
+
53
+ #### Returns
54
+
55
+ [`ParsedKeyframesRules`](../type-aliases/ParsedKeyframesRules.md)
56
+
57
+ ***
58
+
59
+ ### getDocumentStyleSheetsOnLoad()
60
+
61
+ ```ts
62
+ getDocumentStyleSheetsOnLoad(obj?: {
63
+ document?: Document;
64
+ }): Promise<StyleSheetList>;
65
+ ```
66
+
67
+ #### Parameters
68
+
69
+ ##### obj?
70
+
71
+ ###### document?
72
+
73
+ [`Document`](https://developer.mozilla.org/docs/Web/API/Document) = `window.document`
74
+
75
+ #### Returns
76
+
77
+ [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`StyleSheetList`](https://developer.mozilla.org/docs/Web/API/StyleSheetList)\>
78
+
79
+ ***
80
+
81
+ ### getStyleSheetKeyframes()
82
+
83
+ ```ts
84
+ getStyleSheetKeyframes(obj: {
85
+ in: KeyframesFactorySource;
86
+ of: string;
87
+ }): ParsedKeyframes | undefined;
88
+ ```
89
+
90
+ #### Parameters
91
+
92
+ ##### obj
93
+
94
+ ###### in
95
+
96
+ [`KeyframesFactorySource`](../type-aliases/KeyframesFactorySource.md)
97
+
98
+ ###### of
99
+
100
+ `string`
101
+
102
+ The name of the `@keyframes` rule to get keyframes from.
103
+
104
+ #### Returns
105
+
106
+ [`ParsedKeyframes`](../classes/ParsedKeyframes.md) \| `undefined`
107
+
108
+ ***
109
+
110
+ ### importStyleSheet()
111
+
112
+ ```ts
113
+ importStyleSheet(url: string): Promise<CSSStyleSheet>;
114
+ ```
115
+
116
+ #### Parameters
117
+
118
+ ##### url
119
+
120
+ `string`
121
+
122
+ #### Returns
123
+
124
+ [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CSSStyleSheet`](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet)\>
125
+
126
+ #### Remarks
127
+
128
+ Note: `@import` rules won't be resolved in imported stylesheets.
129
+ See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418.
130
+
131
+ ***
132
+
133
+ ### parseKeyframesRule()
134
+
135
+ ```ts
136
+ parseKeyframesRule(obj: {
137
+ rule: CSSKeyframesRule;
138
+ }): ParsedKeyframes;
139
+ ```
140
+
141
+ #### Parameters
142
+
143
+ ##### obj
144
+
145
+ ###### rule
146
+
147
+ [`CSSKeyframesRule`](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule)
148
+
149
+ #### Returns
150
+
151
+ [`ParsedKeyframes`](../classes/ParsedKeyframes.md)
@@ -0,0 +1,64 @@
1
+ [
2
+ {
3
+ "title": "Classes",
4
+ "children": [
5
+ {
6
+ "title": "KeyframeEffectParameters",
7
+ "kind": 128,
8
+ "path": "classes/KeyframeEffectParameters.md",
9
+ "isDeprecated": false
10
+ },
11
+ {
12
+ "title": "ParsedKeyframes",
13
+ "kind": 128,
14
+ "path": "classes/ParsedKeyframes.md",
15
+ "isDeprecated": false
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "title": "Interfaces",
21
+ "children": [
22
+ {
23
+ "title": "KeyframesFactory",
24
+ "kind": 256,
25
+ "path": "interfaces/KeyframesFactory.md",
26
+ "isDeprecated": false
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ "title": "Type Aliases",
32
+ "children": [
33
+ {
34
+ "title": "KeyframeArgument",
35
+ "kind": 2097152,
36
+ "path": "type-aliases/KeyframeArgument.md",
37
+ "isDeprecated": false
38
+ },
39
+ {
40
+ "title": "KeyframesFactorySource",
41
+ "kind": 2097152,
42
+ "path": "type-aliases/KeyframesFactorySource.md",
43
+ "isDeprecated": false
44
+ },
45
+ {
46
+ "title": "ParsedKeyframesRules",
47
+ "kind": 2097152,
48
+ "path": "type-aliases/ParsedKeyframesRules.md",
49
+ "isDeprecated": false
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "title": "Variables",
55
+ "children": [
56
+ {
57
+ "title": "default",
58
+ "kind": 32,
59
+ "path": "variables/default.md",
60
+ "isDeprecated": false
61
+ }
62
+ ]
63
+ }
64
+ ]
@@ -0,0 +1,9 @@
1
+ [KeyframeKit](../index.md) / KeyframeArgument
2
+
3
+ # Type Alias: KeyframeArgument
4
+
5
+ ```ts
6
+ type KeyframeArgument = Keyframe[] | PropertyIndexedKeyframes;
7
+ ```
8
+
9
+ https://drafts.csswg.org/web-animations-1/#processing-a-keyframes-argument
@@ -0,0 +1,9 @@
1
+ [KeyframeKit](../index.md) / KeyframesFactorySource
2
+
3
+ # Type Alias: KeyframesFactorySource
4
+
5
+ ```ts
6
+ type KeyframesFactorySource =
7
+ | StyleSheetList
8
+ | CSSStyleSheet;
9
+ ```
@@ -0,0 +1,15 @@
1
+ [KeyframeKit](../index.md) / ParsedKeyframesRules
2
+
3
+ # Type Alias: ParsedKeyframesRules
4
+
5
+ ```ts
6
+ type ParsedKeyframesRules = {
7
+ [ruleName: string]: ParsedKeyframes;
8
+ };
9
+ ```
10
+
11
+ ## Index Signature
12
+
13
+ ```ts
14
+ [ruleName: string]: ParsedKeyframes
15
+ ```
@@ -0,0 +1,7 @@
1
+ [KeyframeKit](../index.md) / default
2
+
3
+ # Variable: default
4
+
5
+ ```ts
6
+ default: KeyframesFactory;
7
+ ```
@@ -0,0 +1,25 @@
1
+ {
2
+ "scripts": {
3
+ "dev": "vitepress dev",
4
+ "build": "vitepress build",
5
+ "preview": "vitepress preview",
6
+ "bump": "npm run reference && npm run playground:bumplib",
7
+ "reference": "typedoc && rm ./docs/reference/README.md",
8
+ "playground:bumplib": "mkdir -p ./docs/public/playground/KeyframeKit && cp -r ../dist ./docs/public/playground/KeyframeKit/"
9
+ },
10
+ "devDependencies": {
11
+ "remark-collapse": "^0.1.2",
12
+ "remark-insert-headings": "^0.0.0",
13
+ "remark-toc": "^9.0.0",
14
+ "typedoc": "^0.28.17",
15
+ "typedoc-plugin-inline-sources": "^1.3.0",
16
+ "typedoc-plugin-markdown": "^4.10.0",
17
+ "typedoc-plugin-mdn-links": "^5.1.1",
18
+ "typedoc-plugin-remark": "^0.0.0",
19
+ "vitepress": "^2.0.0-alpha.16",
20
+ "vue": "^3.5.28"
21
+ },
22
+ "dependencies": {
23
+ "@monaco-editor/loader": "^1.7.0"
24
+ }
25
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.load = void 0;
4
+ const typedoc_1 = require("typedoc");
5
+ const paramNameOption = 'namedParamName';
6
+ const detectFromCommentsOption = 'detectNamedParamFromComments';
7
+ const changeParamTagOption = 'changeNamedParamTag';
8
+ const load = (app) => {
9
+ app.options.addDeclaration({
10
+ name: paramNameOption,
11
+ help: 'Specifies the name to replace __namedParameters with, if a @param tag isn’t found.',
12
+ type: typedoc_1.ParameterType.String,
13
+ defaultValue: 'options'
14
+ });
15
+ app.options.addDeclaration({
16
+ name: detectFromCommentsOption,
17
+ help: 'Whether to detect the name of parameters from the documentation comments.',
18
+ type: typedoc_1.ParameterType.Boolean,
19
+ defaultValue: true
20
+ });
21
+ app.options.addDeclaration({
22
+ name: changeParamTagOption,
23
+ help: `Whether to change the name of the @param tag to ${paramNameOption} so documentation is shown for a corresponding __namedParameters parameter. Ignored if ${detectFromCommentsOption} is true.`,
24
+ type: typedoc_1.ParameterType.Boolean,
25
+ defaultValue: true
26
+ });
27
+ let paramName;
28
+ let detectFromComments;
29
+ let changeParamTag;
30
+ app.converter.on(typedoc_1.Converter.EVENT_BEGIN, () => {
31
+ paramName = app.options.getValue(paramNameOption);
32
+ detectFromComments = app.options.getValue(detectFromCommentsOption);
33
+ changeParamTag = app.options.getValue(changeParamTagOption);
34
+ if (!changeParamTag && detectFromComments) {
35
+ app.logger.warn(`${changeParamTagOption} is ignored when ${detectFromCommentsOption} is true`);
36
+ }
37
+ });
38
+ app.converter.on(typedoc_1.Converter.EVENT_CREATE_SIGNATURE, (context, sig) => {
39
+ var _a, _b;
40
+
41
+ if (!sig.parameters)
42
+ return;
43
+ for (const [i, param] of sig.parameters.entries()) {
44
+ if (param.name !== '__namedParameters')
45
+ continue;
46
+ else {
47
+ param.name = 'obj';
48
+ }
49
+ }
50
+ });
51
+ };
52
+ exports.load = load;
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "KeyframeKit",
3
+
4
+ "plugin": [
5
+ "./typedoc/plugin-param-names.js",
6
+ "typedoc-plugin-mdn-links",
7
+ "typedoc-plugin-inline-sources",
8
+ "typedoc-plugin-markdown",
9
+ "typedoc-plugin-remark",
10
+ //"typedoc-github-wiki-theme",
11
+ //"typedoc-plugin-missing-exports"
12
+ ],
13
+
14
+ "entryPoints": ["../src/KeyframeKit.ts"],
15
+ "out": "docs/reference",
16
+
17
+ "validation": {
18
+ "notExported": false
19
+ },
20
+
21
+ //"excludeExternals": true,
22
+ //"placeInternalsInOwningModule": true,
23
+
24
+ "disableSources": true,
25
+
26
+ //"flattenOutputFiles": false,
27
+
28
+ "router": "member", // "module"
29
+
30
+ //"readme": "none",
31
+
32
+ //"sidebar": {
33
+ //"autoConfiguration": false,
34
+ //"heading": "[KeyframeKit](../wiki)"
35
+ //},
36
+
37
+ "remarkPlugins": [
38
+ ["remark-insert-headings", { "text": "Contents", "minHeadingCount": 1 }],
39
+ ["remark-toc", { "maxDepth": 3, "tight": true }],
40
+ //["remark-collapse", {"test": "Contents"}]
41
+ ],
42
+
43
+ "modulesFileName": "index", // KeyframeKit
44
+
45
+ "expandParameters": true,
46
+ "expandObjects": true,
47
+
48
+ //"parametersFormat": "htmlTable",
49
+
50
+ "useCodeBlocks": true,
51
+
52
+ //"hidePageTitle": true,
53
+ "hidePageHeader": true,
54
+
55
+ //"namedParamName": "obj"
56
+
57
+ "navigationJson": "docs/reference/navigation.json",
58
+ "navigation": {
59
+ "includeCategories": true,
60
+ "includeGroups": true,
61
+ "includeFolders": true,
62
+ }
63
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "keyframekit",
3
+ "version": "1.0.0",
4
+ "description": "Intuitive, powerful and performant tools for working with CSS animations in JavaScript.",
5
+ "main": "./dist/KeyframeKit.js",
6
+ "scripts": {
7
+ "build": "npx tsc",
8
+ "docs:bump": "(cd docs && npm run bump)",
9
+ "docs:build": "(cd docs && npm run build)"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/benhatsor/KeyframeKit.git"
14
+ },
15
+ "keywords": [
16
+ "css",
17
+ "js",
18
+ "javascript",
19
+ "animation",
20
+ "keyframe",
21
+ "stylesheet",
22
+ "framework",
23
+ "tools",
24
+ "performance",
25
+ "typescript"
26
+ ],
27
+ "author": "Ben Hatsor",
28
+ "license": "MIT",
29
+ "types": "./dist/KeyframeKit.d.ts",
30
+ "bugs": {
31
+ "url": "https://github.com/benhatsor/KeyframeKit/issues"
32
+ },
33
+ "homepage": "https://keyframekit.berryscript.com",
34
+ "devDependencies": {
35
+ "typescript": "^5.9.3"
36
+ }
37
+ }