@cyca/react-timeline-editor 0.2.3-alpha.7 → 0.2.4-alpha.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/dist/styles.css CHANGED
@@ -1 +1 @@
1
- @layer base,components;@layer components{.timeline-editor{min-height:2rem;position:relative;font-size:.75rem;line-height:1rem;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#0c0c0c;overflow:hidden;transition:all .3s ease-in-out}.timeline-editor [data-slot=scroll-area]{position:relative}.timeline-editor [data-slot=scroll-area-viewport]{width:100%;height:100%;border-radius:inherit;outline:none;transition-property:color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.timeline-editor [data-slot=scroll-area-viewport]>div{position:relative;height:100%}.timeline-editor [data-slot=scroll-area-viewport]:focus-visible{outline-width:1px;outline-style:solid;outline-color:#3b3b3b;box-shadow:0 0 0 3px #3b3b3b80}.timeline-editor [data-slot=scroll-area-scrollbar]{display:flex;touch-action:none;padding:1px;transition-property:color;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;-webkit-user-select:none;user-select:none}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=vertical]{height:100%;width:.625rem;border-left-width:1px;border-left-style:solid;border-left-color:transparent;transition:width .15s ease-in-out}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=vertical]:hover{width:1rem}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=horizontal]{height:.625rem;flex-direction:column;border-top-width:1px;border-top-style:solid;border-top-color:transparent;transition:height .15s ease-in-out}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=horizontal]:hover{height:1rem}.timeline-editor [data-slot=scroll-area-thumb]{position:relative;flex:1 1 0%;border-radius:9999px;background-color:#3b3b3b}.timeline-editor-edit-area{margin-top:.625rem;min-height:calc(100% - 42px);background-repeat:no-repeat,repeat;background-image:linear-gradient(transparent,transparent),linear-gradient(90deg,oklch(100% 0 0 / .08) 1px,transparent 0)}.timeline-editor-edit-row{display:flex;flex-direction:row}.timeline-editor-action{position:absolute;left:0;top:0;background-color:#3b3b3b}.timeline-editor-action-left-stretch,.timeline-editor-action-right-stretch{position:absolute;width:.625rem;height:100%;top:0;cursor:ew-resize}.timeline-editor-action-left-stretch:after,.timeline-editor-action-right-stretch:after{position:absolute;width:.25rem;background:#737373;top:20%;bottom:20%;border-radius:1rem}.timeline-editor-action-left-stretch{left:0}.timeline-editor-action-left-stretch:hover:after{opacity:1}.timeline-editor-action-left-stretch:after{content:"";opacity:1;transition:opacity .1s ease-in-out;left:.2rem}.timeline-editor-action-right-stretch{right:0}.timeline-editor-action-right-stretch:hover:after{opacity:1}.timeline-editor-action-right-stretch:after{content:"";opacity:1;right:.2rem;transition:opacity .1s ease-in-out}.timeline-editor-time-area{cursor:crosshair;z-index:3;background-color:#0c0c0ccc;position:sticky;top:0;height:2rem;text-align:center;font-weight:700;font-size:1.125rem;line-height:1.75rem;overflow:clip}.timeline-editor-time-unit{box-sizing:content-box;position:absolute;left:0;border-right-width:1px;border-right-style:solid;border-right-color:#3b3b3b;bottom:0;top:auto;pointer-events:none}.timeline-editor-time-unit-big{height:.5rem}.timeline-editor-time-unit-small{height:.25rem}.timeline-editor-time-unit-scale{position:absolute;top:0;right:0;transform:translate(50%) translateY(-100%);pointer-events:none;color:#737373;font-size:.75rem;line-height:1rem;font-weight:300}.timeline-editor-cursor{cursor:ew-resize;position:absolute;box-sizing:border-box;transform:translate(-50%) scaleX(.5);top:2rem;min-height:calc(100% - 32px);z-index:2}.timeline-editor-cursor-top{position:sticky;transform:translate(0) translateY(0) scaleX(2);color:#0092fb;color:oklch(65.1% .197 250.3);top:2rem}.timeline-editor-cursor-area{box-sizing:content-box;border-left-width:1px;border-left-style:solid;border-left-color:#0092fb;border-left-color:oklch(65.1% .197 250.3);border-right-width:1px;border-right-style:solid;border-right-color:#0092fb;border-right-color:oklch(65.1% .197 250.3);width:0px;height:calc(100% - 2px);cursor:ew-resize;position:absolute;top:1px;left:-1px;transform:translate(200%)}.timeline-editor-drag-line-container{position:absolute;height:100%;left:0;top:0}.timeline-editor-drag-line{width:0;position:absolute;height:99%;border-left-color:#647485;border-left-width:1px;border-left-style:dashed;top:0}}
1
+ @layer base,components;@layer components{.timeline-editor{min-height:2rem;position:relative;font-size:.75rem;line-height:1rem;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#0c0c0c;overflow:hidden;transition:all .3s ease-in-out}.timeline-editor [data-slot=scroll-area]{position:relative}.timeline-editor [data-slot=scroll-area-viewport]{width:100%;height:100%;border-radius:inherit;outline:none;transition-property:color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.timeline-editor [data-slot=scroll-area-viewport]>div{position:relative;height:100%}.timeline-editor [data-slot=scroll-area-viewport]:focus-visible{outline-width:1px;outline-style:solid;outline-color:#3b3b3b;box-shadow:0 0 0 3px #3b3b3b80}.timeline-editor [data-slot=scroll-area-scrollbar]{display:flex;touch-action:none;padding:1px;transition-property:color;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;-webkit-user-select:none;user-select:none}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=vertical]{height:100%;width:.625rem;border-left-width:1px;border-left-style:solid;border-left-color:transparent;transition:width .15s ease-in-out}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=vertical]:hover{width:1rem}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=horizontal]{height:.625rem;flex-direction:column;border-top-width:1px;border-top-style:solid;border-top-color:transparent;transition:height .15s ease-in-out}.timeline-editor [data-slot=scroll-area-scrollbar][data-orientation=horizontal]:hover{height:1rem}.timeline-editor [data-slot=scroll-area-thumb]{position:relative;flex:1 1 0%;border-radius:9999px;background-color:#3b3b3b}.timeline-editor-edit-area{margin-top:.625rem;min-height:calc(100% - 42px);background-repeat:no-repeat,repeat;background-image:linear-gradient(transparent,transparent),linear-gradient(90deg,oklch(100% 0 0 / .08) 1px,transparent 0)}.timeline-editor-edit-row{display:flex;flex-direction:row}.timeline-editor-action{position:absolute;left:0;top:0;background-color:#3b3b3b}.timeline-editor-action-left-stretch,.timeline-editor-action-right-stretch{position:absolute;width:.625rem;height:100%;top:0;cursor:ew-resize}.timeline-editor-action-left-stretch:after,.timeline-editor-action-right-stretch:after{position:absolute;width:.25rem;background:#737373;top:20%;bottom:20%;border-radius:1rem}.timeline-editor-action-left-stretch{left:0}.timeline-editor-action-left-stretch:hover:after{opacity:1}.timeline-editor-action-left-stretch:after{content:"";opacity:1;transition:opacity .1s ease-in-out;left:.2rem}.timeline-editor-action-right-stretch{right:0}.timeline-editor-action-right-stretch:hover:after{opacity:1}.timeline-editor-action-right-stretch:after{content:"";opacity:1;right:.2rem;transition:opacity .1s ease-in-out}.timeline-editor-time-area{cursor:crosshair;z-index:3;background-color:#0c0c0ccc;position:sticky;top:0;height:2rem;text-align:center;font-weight:700;font-size:1.125rem;line-height:1.75rem;overflow:clip}.timeline-editor-time-unit{box-sizing:content-box;position:absolute;left:0;border-right-width:1px;border-right-style:solid;border-right-color:#3b3b3b;bottom:0;top:auto;pointer-events:none}.timeline-editor-time-unit-big{height:.5rem}.timeline-editor-time-unit-small{height:.25rem}.timeline-editor-time-unit-scale{position:absolute;top:0;right:0;transform:translate(50%) translateY(-100%);pointer-events:none;color:#737373;font-size:.75rem;line-height:1rem;font-weight:300}.timeline-editor-cursor{cursor:ew-resize;position:absolute;box-sizing:border-box;transform:translate(-50%) scaleX(.5);top:2rem;min-height:calc(100% - 32px);z-index:2}.timeline-editor-cursor-top{position:sticky;transform:translate(0) translateY(0) scaleX(2);color:#0092fb;color:oklch(65.1% .197 250.3);top:2rem}.timeline-editor-cursor-area{box-sizing:content-box;border-left-width:1px;border-left-style:solid;border-left-color:#0092fb;border-left-color:oklch(65.1% .197 250.3);border-right-width:1px;border-right-style:solid;border-right-color:#0092fb;border-right-color:oklch(65.1% .197 250.3);width:0px;height:calc(100% - 2px);cursor:ew-resize;position:absolute;top:1px;left:-1px;transform:translate(200%)}.timeline-editor-snap-line-container{position:absolute;height:100%;left:0;top:0}.timeline-editor-snap-line{width:0;position:absolute;height:99%;border-left-color:#647485;border-left-width:1px;border-left-style:dashed;top:0}}
package/dist/utils.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-HslTC57T.cjs");exports.getScaleCountByPixel=e.getScaleCountByPixel;exports.getScaleCountByRows=e.getScaleCountByRows;exports.parserActionsToPositions=e.parserActionsToPositions;exports.parserPixelToTime=e.parserPixelToTime;exports.parserTimeToPixel=e.parserTimeToPixel;exports.parserTimeToTransform=e.parserTimeToTransform;exports.parserTransformToTime=e.parserTransformToTime;
@@ -0,0 +1,107 @@
1
+ /** Get current scale count based on time */
2
+ export declare function getScaleCountByPixel(data: number, param: {
3
+ startLeft: number;
4
+ scaleWidth: number;
5
+ scaleCount: number;
6
+ }): number;
7
+
8
+ /** Get scale count based on data */
9
+ export declare function getScaleCountByRows(data: TimelineRow[], param: {
10
+ scale: number;
11
+ pad?: number;
12
+ }): number;
13
+
14
+ /** Get position set of all times for actions */
15
+ export declare function parserActionsToPositions(actions: TimelineAction[], param: {
16
+ startLeft: number;
17
+ scale: number;
18
+ scaleWidth: number;
19
+ }): number[];
20
+
21
+ /** Convert pixels to time */
22
+ export declare function parserPixelToTime(data: number, param: {
23
+ startLeft: number;
24
+ scale: number;
25
+ scaleWidth: number;
26
+ }): number;
27
+
28
+ /** Convert time to pixels */
29
+ export declare function parserTimeToPixel(data: number, param: {
30
+ startLeft: number;
31
+ scale: number;
32
+ scaleWidth: number;
33
+ }): number;
34
+
35
+ /** Convert start + end to position + width */
36
+ export declare function parserTimeToTransform(data: {
37
+ start: number;
38
+ end: number;
39
+ }, param: {
40
+ startLeft: number;
41
+ scale: number;
42
+ scaleWidth: number;
43
+ }): {
44
+ left: number;
45
+ width: number;
46
+ };
47
+
48
+ /** Convert position + width to start + end */
49
+ export declare function parserTransformToTime(data: {
50
+ left: number;
51
+ width: number;
52
+ }, param: {
53
+ startLeft: number;
54
+ scale: number;
55
+ scaleWidth: number;
56
+ }): {
57
+ start: number;
58
+ end: number;
59
+ };
60
+
61
+ /**
62
+ * Basic parameters of action
63
+ * @export
64
+ * @interface TimelineAction
65
+ */
66
+ declare interface TimelineAction {
67
+ /** Action id */
68
+ id: string;
69
+ /** Action start time */
70
+ start: number;
71
+ /** Action end time */
72
+ end: number;
73
+ /** Effect ID corresponding to the action */
74
+ effectId: string;
75
+ /** Whether the action is selected */
76
+ selected?: boolean;
77
+ /** Whether the action is resizable */
78
+ flexible?: boolean;
79
+ /** Whether the action is movable */
80
+ movable?: boolean;
81
+ /** Whether the action is disabled */
82
+ disable?: boolean;
83
+ /** Minimum start time limit for the action */
84
+ minStart?: number;
85
+ /** Maximum end time limit for the action */
86
+ maxEnd?: number;
87
+ }
88
+
89
+ /**
90
+ * Basic parameters of action row
91
+ * @export
92
+ * @interface TimelineRow
93
+ */
94
+ declare interface TimelineRow {
95
+ /** Action row id */
96
+ id: string;
97
+ /** List of actions in the row */
98
+ actions: TimelineAction[];
99
+ /** Custom row height */
100
+ rowHeight?: number;
101
+ /** Whether the row is selected */
102
+ selected?: boolean;
103
+ /** Extended class names of the row */
104
+ classNames?: string[];
105
+ }
106
+
107
+ export { }
package/dist/utils.js ADDED
@@ -0,0 +1,10 @@
1
+ import { i as a, l as r, k as o, j as i, p as T, g as m, h as p } from "./index-Do2XgyZc.js";
2
+ export {
3
+ a as getScaleCountByPixel,
4
+ r as getScaleCountByRows,
5
+ o as parserActionsToPositions,
6
+ i as parserPixelToTime,
7
+ T as parserTimeToPixel,
8
+ m as parserTimeToTransform,
9
+ p as parserTransformToTime
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyca/react-timeline-editor",
3
- "version": "0.2.3-alpha.7",
3
+ "version": "0.2.4-alpha.0",
4
4
  "author": "cyca",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -26,8 +26,7 @@
26
26
  "lint:package": "npx --yes @arethetypeswrong/cli -P",
27
27
  "typecheck": "tsc --noEmit",
28
28
  "build-storybook": "storybook build",
29
- "publish": "npm run build && npm publish --access public",
30
- "publish:alpha": "npm run build && npm publish --access public --tag alpha"
29
+ "publish": "npm run build && npm publish --access public --tag alpha"
31
30
  },
32
31
  "files": [
33
32
  "dist"
@@ -42,6 +41,11 @@
42
41
  "import": "./dist/react-timeline-editor.js",
43
42
  "require": "./dist/react-timeline-editor.cjs"
44
43
  },
44
+ "./utils": {
45
+ "types": "./dist/utils.d.ts",
46
+ "import": "./dist/utils.js",
47
+ "require": "./dist/utils.cjs"
48
+ },
45
49
  "./styles.css": "./dist/styles.css",
46
50
  "./package.json": "./package.json"
47
51
  },