@freelensapp/animate 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2024 Freelens Authors.
2
+
3
+ Copyright (c) 2022 OpenLens Authors.
4
+
5
+ Portions of this software are licensed as follows:
6
+
7
+ * All content residing under the "docs/" directory of this repository, if that
8
+ directory exists, is licensed under "Creative Commons: CC BY-SA 4.0 license".
9
+ * Content outside of the above mentioned directories or restrictions above is
10
+ available under the "MIT" license as defined below.
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @freelensapp/animate
2
+
3
+ This package contains stuff related to creating Lens-applications.
4
+
5
+ # Usage
6
+
7
+ ```bash
8
+ $ npm install @freelensapp/animate
9
+ ```
10
+
11
+ ```typescript
12
+ import { animateFeature } from "@freelensapp/animate";
13
+ import { animateFeature, requestAnimationFrameInjectable } from "@freelensapp/animate";
14
+ import { Animate } from "@freelensapp/animate";
15
+ import type { AnimateName } from "@freelensapp/animate";
16
+ import type { RequestAnimationFrame } from "@freelensapp/animate";
17
+ ```
18
+
19
+ ## Extendability
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .Animate:empty{display:none}.Animate.opacity{opacity:0}.Animate.opacity.enter{transition-property:opacity;transition-duration:var(--enter-duration);opacity:1}.Animate.opacity.leave{transition-duration:var(--leave-duration);transition-timing-function:ease-out;opacity:0}.Animate.slide-right{transform:translateX(100%);will-change:transform}.Animate.slide-right.enter{transform:translateX(0);transition:transform var(--enter-duration);transition-timing-function:ease-in-out}.Animate.slide-right.leave{transform:translateX(100%);transition:transform var(--leave-duration)}.Animate.opacity-scale{opacity:0}.Animate.opacity-scale.enter{transition:opacity var(--enter-duration);opacity:1}.Animate.opacity-scale.leave{will-change:opacity,transform;opacity:0;transform:scale(1.25);transition:transform var(--leave-duration) ease-in,opacity var(--leave-duration) ease-out}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ export type { AnimateName, AnimateProps } from "./src/animate";
6
+ export { Animate } from "./src/animate";
7
+ export { defaultEnterDurationForAnimatedInjectable } from "./src/default-enter-duration.injectable";
8
+ export { defaultLeaveDurationForAnimatedInjectable } from "./src/default-leave-duration.injectable";
9
+ export type { RequestAnimationFrame } from "./src/request-animation-frame.injectable";
10
+ export { requestAnimationFrameInjectable } from "./src/request-animation-frame.injectable";
11
+ export { animateFeature } from "./src/feature";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ (()=>{var e={638:(e,t,r)=>{"use strict";r.r(t),r.d(t,{defaultEnterDurationForAnimatedInjectable:()=>n});const n=(0,r(178).getInjectable)({id:"default-enter-duration-for-animated",instantiate:()=>100})},496:(e,t,r)=>{"use strict";r.r(t),r.d(t,{defaultLeaveDurationForAnimatedInjectable:()=>n});const n=(0,r(178).getInjectable)({id:"default-leave-duration-for-animated",instantiate:()=>100})},791:(e,t,r)=>{"use strict";r.d(t,{T:()=>o});const n=require("@freelensapp/feature-core"),a=require("@ogre-tools/injectable-extension-for-auto-registration");e=r.hmd(e);const o=(0,n.getFeature)({id:"animate-feature",register:t=>{(0,a.autoRegister)({di:t,targetModule:e,getRequireContexts:()=>[r(888)]})}})},312:(e,t,r)=>{"use strict";r.r(t),r.d(t,{requestAnimationFrameInjectable:()=>n});const n=(0,r(178).getInjectable)({id:"request-animation-frame",instantiate:()=>e=>requestAnimationFrame(e),causesSideEffects:!0})},888:(e,t,r)=>{var n={"./default-enter-duration.injectable.ts":638,"./default-leave-duration.injectable.ts":496,"./request-animation-frame.injectable.ts":312};function a(e){var t=o(e);return r(t)}function o(e){if(!r.o(n,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n[e]}a.keys=function(){return Object.keys(n)},a.resolve=o,e.exports=a,a.id=888},178:e=>{"use strict";e.exports=require("@ogre-tools/injectable")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n](o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{Animate:()=>l,animateFeature:()=>d.T,defaultEnterDurationForAnimatedInjectable:()=>u.defaultEnterDurationForAnimatedInjectable,defaultLeaveDurationForAnimatedInjectable:()=>s.defaultLeaveDurationForAnimatedInjectable,requestAnimationFrameInjectable:()=>i.requestAnimationFrameInjectable});const e=require("react");var t=r.n(e);const a=require("@freelensapp/utilities"),o=require("@ogre-tools/injectable-react");var i=r(312),u=r(638),s=r(496);const l=(0,o.withInjectables)((r=>{const{requestAnimationFrame:n,defaultEnterDuration:o,defaultLeaveDuration:i,...u}=r,{children:s,enter:l=!0,enterDuration:d=o,leaveDuration:c=i,name:m="opacity",onEnter:f=a.noop,onLeave:p=a.noop}=u,[b,j]=(0,e.useState)(!1),[v,g]=(0,e.useState)(!1),[y,F]=(0,e.useState)(!1),A=t().Children.only(s),q=(0,a.cssNames)("Animate",m,A.props.className,{enter:v,leave:y});if((0,e.useEffect)((()=>{if(l)return j(!0),n((()=>{g(!0),f()})),a.noop;if(b){F(!0),p();const e=setTimeout((()=>{j(!1),g(!1),F(!1)}),c);return()=>clearTimeout(e)}return a.noop}),[l]),!b)return null;const D={"--enter-duration":`${d}ms`,"--leave-duration":`${c}ms`};return t().cloneElement(A,{className:q,children:A.props.children,style:{...A.props.style,...D}})}),{getProps:(e,t)=>({...t,requestAnimationFrame:e.inject(i.requestAnimationFrameInjectable),defaultEnterDuration:e.inject(u.defaultEnterDurationForAnimatedInjectable),defaultLeaveDuration:e.inject(s.defaultLeaveDurationForAnimatedInjectable)})});var d=r(791)})(),module.exports=n})();
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ import "./animate.scss";
6
+ import React from "react";
7
+ import type { StrictReactNode } from "@freelensapp/utilities";
8
+ export type AnimateName = "opacity" | "slide-right" | "opacity-scale" | string;
9
+ export interface AnimateProps {
10
+ name?: AnimateName;
11
+ enter?: boolean;
12
+ onEnter?: () => void;
13
+ onLeave?: () => void;
14
+ enterDuration?: number;
15
+ leaveDuration?: number;
16
+ children?: StrictReactNode;
17
+ }
18
+ export declare const Animate: React.FunctionComponent<AnimateProps>;
@@ -0,0 +1 @@
1
+ export declare const defaultEnterDurationForAnimatedInjectable: import("@ogre-tools/injectable").Injectable<number, unknown, void>;
@@ -0,0 +1 @@
1
+ export declare const defaultLeaveDurationForAnimatedInjectable: import("@ogre-tools/injectable").Injectable<number, unknown, void>;
@@ -0,0 +1 @@
1
+ export declare const animateFeature: import("@freelensapp/feature-core").Feature;
@@ -0,0 +1,2 @@
1
+ export type RequestAnimationFrame = (callback: () => void) => void;
2
+ export declare const requestAnimationFrameInjectable: import("@ogre-tools/injectable").Injectable<RequestAnimationFrame, unknown, void>;
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@freelensapp/animate",
3
+ "private": false,
4
+ "version": "0.1.0",
5
+ "description": "Highly extendable animate in the Lens.",
6
+ "type": "commonjs",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "publishConfig": {
11
+ "access": "public",
12
+ "registry": "https://registry.npmjs.org/"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/freelensapp/freelens.git"
17
+ },
18
+ "main": "dist/index.js",
19
+ "exports": {
20
+ ".": "./dist/index.js",
21
+ "./styles": "./dist/index.css"
22
+ },
23
+ "types": "dist/index.d.ts",
24
+ "author": {
25
+ "name": "Freelens Authors",
26
+ "email": "freelens@freelens.app"
27
+ },
28
+ "license": "MIT",
29
+ "homepage": "https://github.com/freelensapp/freelens",
30
+ "scripts": {
31
+ "build": "lens-webpack-build",
32
+ "lint": "lens-lint",
33
+ "lint:fix": "lens-lint --fix"
34
+ },
35
+ "peerDependencies": {
36
+ "@freelensapp/feature-core": "^0.1.0",
37
+ "@freelensapp/utilities": "^0.1.0",
38
+ "@ogre-tools/injectable": "^17.2.0",
39
+ "@ogre-tools/injectable-extension-for-auto-registration": "^17.2.0",
40
+ "@ogre-tools/injectable-react": "^17.2.0",
41
+ "react": "^17.0.2"
42
+ },
43
+ "devDependencies": {
44
+ "@freelensapp/eslint-config": "^0.1.0",
45
+ "@freelensapp/webpack": "^0.1.0"
46
+ },
47
+ "gitHead": "de60759713d6e0e01eb480706a8daf7cb836b589"
48
+ }