@canonical/motion-control 0.0.0-stage → 0.48.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 +166 -0
- package/README.md +300 -2
- package/cast.schema.json +101 -0
- package/dist/esm/cli.js +30 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/global.js +7 -0
- package/dist/esm/global.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/cast/checkCasts.js +34 -0
- package/dist/esm/lib/cast/checkCasts.js.map +1 -0
- package/dist/esm/lib/cast/checkScene.js +58 -0
- package/dist/esm/lib/cast/checkScene.js.map +1 -0
- package/dist/esm/lib/cast/checkStep.js +73 -0
- package/dist/esm/lib/cast/checkStep.js.map +1 -0
- package/dist/esm/lib/cast/constants.js +53 -0
- package/dist/esm/lib/cast/constants.js.map +1 -0
- package/dist/esm/lib/cast/formatReport.js +22 -0
- package/dist/esm/lib/cast/formatReport.js.map +1 -0
- package/dist/esm/lib/cast/index.js +10 -0
- package/dist/esm/lib/cast/index.js.map +1 -0
- package/dist/esm/lib/cast/listFrameNames.js +19 -0
- package/dist/esm/lib/cast/listFrameNames.js.map +1 -0
- package/dist/esm/lib/cast/measureScene.js +11 -0
- package/dist/esm/lib/cast/measureScene.js.map +1 -0
- package/dist/esm/lib/cast/measureStep.js +21 -0
- package/dist/esm/lib/cast/measureStep.js.map +1 -0
- package/dist/esm/lib/cast/measureTyping.js +13 -0
- package/dist/esm/lib/cast/measureTyping.js.map +1 -0
- package/dist/esm/lib/cast/types.js +2 -0
- package/dist/esm/lib/cast/types.js.map +1 -0
- package/dist/esm/lib/gif/compressLzw.js +61 -0
- package/dist/esm/lib/gif/compressLzw.js.map +1 -0
- package/dist/esm/lib/gif/constants.js +9 -0
- package/dist/esm/lib/gif/constants.js.map +1 -0
- package/dist/esm/lib/gif/encodeGif.js +45 -0
- package/dist/esm/lib/gif/encodeGif.js.map +1 -0
- package/dist/esm/lib/gif/index.js +6 -0
- package/dist/esm/lib/gif/index.js.map +1 -0
- package/dist/esm/lib/gif/mergeStills.js +32 -0
- package/dist/esm/lib/gif/mergeStills.js.map +1 -0
- package/dist/esm/lib/gif/quantizePictures.js +75 -0
- package/dist/esm/lib/gif/quantizePictures.js.map +1 -0
- package/dist/esm/lib/gif/types.js +2 -0
- package/dist/esm/lib/gif/types.js.map +1 -0
- package/dist/esm/lib/index.js +3 -0
- package/dist/esm/lib/index.js.map +1 -0
- package/dist/esm/lib/moment/constants.js +33 -0
- package/dist/esm/lib/moment/constants.js.map +1 -0
- package/dist/esm/lib/moment/describeAction.js +20 -0
- package/dist/esm/lib/moment/describeAction.js.map +1 -0
- package/dist/esm/lib/moment/describeKeyRun.js +53 -0
- package/dist/esm/lib/moment/describeKeyRun.js.map +1 -0
- package/dist/esm/lib/moment/describeMoment.js +323 -0
- package/dist/esm/lib/moment/describeMoment.js.map +1 -0
- package/dist/esm/lib/moment/easeInOut.js +12 -0
- package/dist/esm/lib/moment/easeInOut.js.map +1 -0
- package/dist/esm/lib/moment/index.js +8 -0
- package/dist/esm/lib/moment/index.js.map +1 -0
- package/dist/esm/lib/moment/resolveStates.js +82 -0
- package/dist/esm/lib/moment/resolveStates.js.map +1 -0
- package/dist/esm/lib/moment/takeSpan.js +12 -0
- package/dist/esm/lib/moment/takeSpan.js.map +1 -0
- package/dist/esm/lib/moment/types.js +2 -0
- package/dist/esm/lib/moment/types.js.map +1 -0
- package/dist/esm/lib/player/Player.js +498 -0
- package/dist/esm/lib/player/Player.js.map +1 -0
- package/dist/esm/lib/player/announceHeight.js +30 -0
- package/dist/esm/lib/player/announceHeight.js.map +1 -0
- package/dist/esm/lib/player/applyMoment.js +155 -0
- package/dist/esm/lib/player/applyMoment.js.map +1 -0
- package/dist/esm/lib/player/assertPresent.js +14 -0
- package/dist/esm/lib/player/assertPresent.js.map +1 -0
- package/dist/esm/lib/player/collectFrames.js +30 -0
- package/dist/esm/lib/player/collectFrames.js.map +1 -0
- package/dist/esm/lib/player/collectStyles.js +24 -0
- package/dist/esm/lib/player/collectStyles.js.map +1 -0
- package/dist/esm/lib/player/constants.js +101 -0
- package/dist/esm/lib/player/constants.js.map +1 -0
- package/dist/esm/lib/player/defaultProfile.js +50 -0
- package/dist/esm/lib/player/defaultProfile.js.map +1 -0
- package/dist/esm/lib/player/drawMarkup.js +36 -0
- package/dist/esm/lib/player/drawMarkup.js.map +1 -0
- package/dist/esm/lib/player/drawScene.js +32 -0
- package/dist/esm/lib/player/drawScene.js.map +1 -0
- package/dist/esm/lib/player/drawSprites.js +122 -0
- package/dist/esm/lib/player/drawSprites.js.map +1 -0
- package/dist/esm/lib/player/fitEmbeds.js +42 -0
- package/dist/esm/lib/player/fitEmbeds.js.map +1 -0
- package/dist/esm/lib/player/fitSlide.js +27 -0
- package/dist/esm/lib/player/fitSlide.js.map +1 -0
- package/dist/esm/lib/player/formatKey.js +13 -0
- package/dist/esm/lib/player/formatKey.js.map +1 -0
- package/dist/esm/lib/player/formatKeySign.js +12 -0
- package/dist/esm/lib/player/formatKeySign.js.map +1 -0
- package/dist/esm/lib/player/formatSpeed.js +11 -0
- package/dist/esm/lib/player/formatSpeed.js.map +1 -0
- package/dist/esm/lib/player/formatTime.js +18 -0
- package/dist/esm/lib/player/formatTime.js.map +1 -0
- package/dist/esm/lib/player/index.js +30 -0
- package/dist/esm/lib/player/index.js.map +1 -0
- package/dist/esm/lib/player/installStateRules.js +25 -0
- package/dist/esm/lib/player/installStateRules.js.map +1 -0
- package/dist/esm/lib/player/listHidden.js +24 -0
- package/dist/esm/lib/player/listHidden.js.map +1 -0
- package/dist/esm/lib/player/makeElement.js +15 -0
- package/dist/esm/lib/player/makeElement.js.map +1 -0
- package/dist/esm/lib/player/mergeProfile.js +17 -0
- package/dist/esm/lib/player/mergeProfile.js.map +1 -0
- package/dist/esm/lib/player/mirrorStates.js +23 -0
- package/dist/esm/lib/player/mirrorStates.js.map +1 -0
- package/dist/esm/lib/player/mountScenes.js +100 -0
- package/dist/esm/lib/player/mountScenes.js.map +1 -0
- package/dist/esm/lib/player/readLayerBox.js +20 -0
- package/dist/esm/lib/player/readLayerBox.js.map +1 -0
- package/dist/esm/lib/player/recordGif.js +63 -0
- package/dist/esm/lib/player/recordGif.js.map +1 -0
- package/dist/esm/lib/player/recordVideo.js +114 -0
- package/dist/esm/lib/player/recordVideo.js.map +1 -0
- package/dist/esm/lib/player/renderLegend.js +27 -0
- package/dist/esm/lib/player/renderLegend.js.map +1 -0
- package/dist/esm/lib/player/saveFile.js +22 -0
- package/dist/esm/lib/player/saveFile.js.map +1 -0
- package/dist/esm/lib/player/serializeElement.js +36 -0
- package/dist/esm/lib/player/serializeElement.js.map +1 -0
- package/dist/esm/lib/player/types.js +2 -0
- package/dist/esm/lib/player/types.js.map +1 -0
- package/dist/esm/lib/player/wrapSlide.js +28 -0
- package/dist/esm/lib/player/wrapSlide.js.map +1 -0
- package/dist/esm/lib/timeline/advanceClock.js +24 -0
- package/dist/esm/lib/timeline/advanceClock.js.map +1 -0
- package/dist/esm/lib/timeline/buildTimeline.js +47 -0
- package/dist/esm/lib/timeline/buildTimeline.js.map +1 -0
- package/dist/esm/lib/timeline/constants.js +3 -0
- package/dist/esm/lib/timeline/constants.js.map +1 -0
- package/dist/esm/lib/timeline/findKeyframe.js +11 -0
- package/dist/esm/lib/timeline/findKeyframe.js.map +1 -0
- package/dist/esm/lib/timeline/index.js +7 -0
- package/dist/esm/lib/timeline/index.js.map +1 -0
- package/dist/esm/lib/timeline/locateTime.js +21 -0
- package/dist/esm/lib/timeline/locateTime.js.map +1 -0
- package/dist/esm/lib/timeline/stepKeyframe.js +20 -0
- package/dist/esm/lib/timeline/stepKeyframe.js.map +1 -0
- package/dist/esm/lib/timeline/types.js +2 -0
- package/dist/esm/lib/timeline/types.js.map +1 -0
- package/dist/esm/lib/video/constants.js +7 -0
- package/dist/esm/lib/video/constants.js.map +1 -0
- package/dist/esm/lib/video/index.js +4 -0
- package/dist/esm/lib/video/index.js.map +1 -0
- package/dist/esm/lib/video/types.js +2 -0
- package/dist/esm/lib/video/types.js.map +1 -0
- package/dist/esm/lib/video/writeBox.js +21 -0
- package/dist/esm/lib/video/writeBox.js.map +1 -0
- package/dist/esm/lib/video/writeMp4.js +45 -0
- package/dist/esm/lib/video/writeMp4.js.map +1 -0
- package/dist/motion.css +581 -0
- package/dist/motion.global.js +1502 -0
- package/dist/types/cli.d.ts +3 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/global.d.ts +2 -0
- package/dist/types/global.d.ts.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/cast/checkCasts.d.ts +15 -0
- package/dist/types/lib/cast/checkCasts.d.ts.map +1 -0
- package/dist/types/lib/cast/checkScene.d.ts +11 -0
- package/dist/types/lib/cast/checkScene.d.ts.map +1 -0
- package/dist/types/lib/cast/checkStep.d.ts +12 -0
- package/dist/types/lib/cast/checkStep.d.ts.map +1 -0
- package/dist/types/lib/cast/constants.d.ts +20 -0
- package/dist/types/lib/cast/constants.d.ts.map +1 -0
- package/dist/types/lib/cast/formatReport.d.ts +11 -0
- package/dist/types/lib/cast/formatReport.d.ts.map +1 -0
- package/dist/types/lib/cast/index.d.ts +11 -0
- package/dist/types/lib/cast/index.d.ts.map +1 -0
- package/dist/types/lib/cast/listFrameNames.d.ts +8 -0
- package/dist/types/lib/cast/listFrameNames.d.ts.map +1 -0
- package/dist/types/lib/cast/measureScene.d.ts +9 -0
- package/dist/types/lib/cast/measureScene.d.ts.map +1 -0
- package/dist/types/lib/cast/measureStep.d.ts +13 -0
- package/dist/types/lib/cast/measureStep.d.ts.map +1 -0
- package/dist/types/lib/cast/measureTyping.d.ts +12 -0
- package/dist/types/lib/cast/measureTyping.d.ts.map +1 -0
- package/dist/types/lib/cast/types.d.ts +87 -0
- package/dist/types/lib/cast/types.d.ts.map +1 -0
- package/dist/types/lib/gif/compressLzw.d.ts +9 -0
- package/dist/types/lib/gif/compressLzw.d.ts.map +1 -0
- package/dist/types/lib/gif/constants.d.ts +9 -0
- package/dist/types/lib/gif/constants.d.ts.map +1 -0
- package/dist/types/lib/gif/encodeGif.d.ts +13 -0
- package/dist/types/lib/gif/encodeGif.d.ts.map +1 -0
- package/dist/types/lib/gif/index.d.ts +7 -0
- package/dist/types/lib/gif/index.d.ts.map +1 -0
- package/dist/types/lib/gif/mergeStills.d.ts +12 -0
- package/dist/types/lib/gif/mergeStills.d.ts.map +1 -0
- package/dist/types/lib/gif/quantizePictures.d.ts +13 -0
- package/dist/types/lib/gif/quantizePictures.d.ts.map +1 -0
- package/dist/types/lib/gif/types.d.ts +22 -0
- package/dist/types/lib/gif/types.d.ts.map +1 -0
- package/dist/types/lib/index.d.ts +3 -0
- package/dist/types/lib/index.d.ts.map +1 -0
- package/dist/types/lib/moment/constants.d.ts +33 -0
- package/dist/types/lib/moment/constants.d.ts.map +1 -0
- package/dist/types/lib/moment/describeAction.d.ts +9 -0
- package/dist/types/lib/moment/describeAction.d.ts.map +1 -0
- package/dist/types/lib/moment/describeKeyRun.d.ts +18 -0
- package/dist/types/lib/moment/describeKeyRun.d.ts.map +1 -0
- package/dist/types/lib/moment/describeMoment.d.ts +16 -0
- package/dist/types/lib/moment/describeMoment.d.ts.map +1 -0
- package/dist/types/lib/moment/easeInOut.d.ts +8 -0
- package/dist/types/lib/moment/easeInOut.d.ts.map +1 -0
- package/dist/types/lib/moment/index.d.ts +9 -0
- package/dist/types/lib/moment/index.d.ts.map +1 -0
- package/dist/types/lib/moment/resolveStates.d.ts +18 -0
- package/dist/types/lib/moment/resolveStates.d.ts.map +1 -0
- package/dist/types/lib/moment/takeSpan.d.ts +10 -0
- package/dist/types/lib/moment/takeSpan.d.ts.map +1 -0
- package/dist/types/lib/moment/types.d.ts +187 -0
- package/dist/types/lib/moment/types.d.ts.map +1 -0
- package/dist/types/lib/player/Player.d.ts +134 -0
- package/dist/types/lib/player/Player.d.ts.map +1 -0
- package/dist/types/lib/player/announceHeight.d.ts +12 -0
- package/dist/types/lib/player/announceHeight.d.ts.map +1 -0
- package/dist/types/lib/player/applyMoment.d.ts +21 -0
- package/dist/types/lib/player/applyMoment.d.ts.map +1 -0
- package/dist/types/lib/player/assertPresent.d.ts +10 -0
- package/dist/types/lib/player/assertPresent.d.ts.map +1 -0
- package/dist/types/lib/player/collectFrames.d.ts +11 -0
- package/dist/types/lib/player/collectFrames.d.ts.map +1 -0
- package/dist/types/lib/player/collectStyles.d.ts +12 -0
- package/dist/types/lib/player/collectStyles.d.ts.map +1 -0
- package/dist/types/lib/player/constants.d.ts +80 -0
- package/dist/types/lib/player/constants.d.ts.map +1 -0
- package/dist/types/lib/player/defaultProfile.d.ts +8 -0
- package/dist/types/lib/player/defaultProfile.d.ts.map +1 -0
- package/dist/types/lib/player/drawMarkup.d.ts +15 -0
- package/dist/types/lib/player/drawMarkup.d.ts.map +1 -0
- package/dist/types/lib/player/drawScene.d.ts +23 -0
- package/dist/types/lib/player/drawScene.d.ts.map +1 -0
- package/dist/types/lib/player/drawSprites.d.ts +35 -0
- package/dist/types/lib/player/drawSprites.d.ts.map +1 -0
- package/dist/types/lib/player/fitEmbeds.d.ts +13 -0
- package/dist/types/lib/player/fitEmbeds.d.ts.map +1 -0
- package/dist/types/lib/player/fitSlide.d.ts +24 -0
- package/dist/types/lib/player/fitSlide.d.ts.map +1 -0
- package/dist/types/lib/player/formatKey.d.ts +9 -0
- package/dist/types/lib/player/formatKey.d.ts.map +1 -0
- package/dist/types/lib/player/formatKeySign.d.ts +9 -0
- package/dist/types/lib/player/formatKeySign.d.ts.map +1 -0
- package/dist/types/lib/player/formatSpeed.d.ts +9 -0
- package/dist/types/lib/player/formatSpeed.d.ts.map +1 -0
- package/dist/types/lib/player/formatTime.d.ts +12 -0
- package/dist/types/lib/player/formatTime.d.ts.map +1 -0
- package/dist/types/lib/player/index.d.ts +31 -0
- package/dist/types/lib/player/index.d.ts.map +1 -0
- package/dist/types/lib/player/installStateRules.d.ts +12 -0
- package/dist/types/lib/player/installStateRules.d.ts.map +1 -0
- package/dist/types/lib/player/listHidden.d.ts +12 -0
- package/dist/types/lib/player/listHidden.d.ts.map +1 -0
- package/dist/types/lib/player/makeElement.d.ts +10 -0
- package/dist/types/lib/player/makeElement.d.ts.map +1 -0
- package/dist/types/lib/player/mergeProfile.d.ts +9 -0
- package/dist/types/lib/player/mergeProfile.d.ts.map +1 -0
- package/dist/types/lib/player/mirrorStates.d.ts +12 -0
- package/dist/types/lib/player/mirrorStates.d.ts.map +1 -0
- package/dist/types/lib/player/mountScenes.d.ts +25 -0
- package/dist/types/lib/player/mountScenes.d.ts.map +1 -0
- package/dist/types/lib/player/readLayerBox.d.ts +23 -0
- package/dist/types/lib/player/readLayerBox.d.ts.map +1 -0
- package/dist/types/lib/player/recordGif.d.ts +16 -0
- package/dist/types/lib/player/recordGif.d.ts.map +1 -0
- package/dist/types/lib/player/recordVideo.d.ts +19 -0
- package/dist/types/lib/player/recordVideo.d.ts.map +1 -0
- package/dist/types/lib/player/renderLegend.d.ts +8 -0
- package/dist/types/lib/player/renderLegend.d.ts.map +1 -0
- package/dist/types/lib/player/saveFile.d.ts +13 -0
- package/dist/types/lib/player/saveFile.d.ts.map +1 -0
- package/dist/types/lib/player/serializeElement.d.ts +14 -0
- package/dist/types/lib/player/serializeElement.d.ts.map +1 -0
- package/dist/types/lib/player/types.d.ts +321 -0
- package/dist/types/lib/player/types.d.ts.map +1 -0
- package/dist/types/lib/player/wrapSlide.d.ts +17 -0
- package/dist/types/lib/player/wrapSlide.d.ts.map +1 -0
- package/dist/types/lib/timeline/advanceClock.d.ts +16 -0
- package/dist/types/lib/timeline/advanceClock.d.ts.map +1 -0
- package/dist/types/lib/timeline/buildTimeline.d.ts +15 -0
- package/dist/types/lib/timeline/buildTimeline.d.ts.map +1 -0
- package/dist/types/lib/timeline/constants.d.ts +3 -0
- package/dist/types/lib/timeline/constants.d.ts.map +1 -0
- package/dist/types/lib/timeline/findKeyframe.d.ts +10 -0
- package/dist/types/lib/timeline/findKeyframe.d.ts.map +1 -0
- package/dist/types/lib/timeline/index.d.ts +8 -0
- package/dist/types/lib/timeline/index.d.ts.map +1 -0
- package/dist/types/lib/timeline/locateTime.d.ts +10 -0
- package/dist/types/lib/timeline/locateTime.d.ts.map +1 -0
- package/dist/types/lib/timeline/stepKeyframe.d.ts +12 -0
- package/dist/types/lib/timeline/stepKeyframe.d.ts.map +1 -0
- package/dist/types/lib/timeline/types.d.ts +40 -0
- package/dist/types/lib/timeline/types.d.ts.map +1 -0
- package/dist/types/lib/video/constants.d.ts +5 -0
- package/dist/types/lib/video/constants.d.ts.map +1 -0
- package/dist/types/lib/video/index.d.ts +5 -0
- package/dist/types/lib/video/index.d.ts.map +1 -0
- package/dist/types/lib/video/types.d.ts +21 -0
- package/dist/types/lib/video/types.d.ts.map +1 -0
- package/dist/types/lib/video/writeBox.d.ts +9 -0
- package/dist/types/lib/video/writeBox.d.ts.map +1 -0
- package/dist/types/lib/video/writeMp4.d.ts +10 -0
- package/dist/types/lib/video/writeMp4.d.ts.map +1 -0
- package/package.json +106 -4
- package/skills/design-motion-frames/SKILL.md +183 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
166
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,301 @@
|
|
|
1
|
-
#
|
|
1
|
+
# motion
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@canonical/motion-control` plays short looping clips of interactions over a page's own HTML frames. A page draws its screens as HTML and names each one with `data-frame`. A cast lists, in order, the frames to show and the interactions that lead from one to the next, and the player draws it as a figure a reader can play, step through and scrub. Each kind of interaction has one symbol, the same in every clip: a finger is a ring, a mouse is a pointer, a key is a keycap. Nothing is redrawn for the animation, so when a frame changes, every clip that uses it changes with it.
|
|
4
|
+
|
|
5
|
+
The package has two halves. The cast half needs no browser: `checkCasts` reads a list of scenes and says what cannot be played and what a reviewer would question, `listFrameNames` reads the names frames answer to from a catalogue, and `formatReport` writes the outcome as lines to print. The `motion` executable is those three behind one command. The player half runs in a page: `collectFrames` gathers every element that names itself as a frame, `mountScenes` puts one figure per scene on the page and returns the players with two ways to look at them from outside, and `fitEmbeds` gives an iframe the height the page inside it announces.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @canonical/motion-control
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## The 90-second example
|
|
14
|
+
|
|
15
|
+
Name two frames, and give the clips a place:
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<div data-frame="list.rest">…the frame's HTML…</div>
|
|
19
|
+
<div data-frame="list.removed">…</div>
|
|
20
|
+
<div id="clips"></div>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Write one scene and mount it:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { mountScenes, type Scene } from "@canonical/motion-control";
|
|
27
|
+
import "@canonical/motion-control/style.css";
|
|
28
|
+
|
|
29
|
+
const scenes: Scene[] = [
|
|
30
|
+
{
|
|
31
|
+
id: "remove",
|
|
32
|
+
title: "Sliding a row away",
|
|
33
|
+
steps: [
|
|
34
|
+
{ frame: "list.rest", hold: 1000, say: "At rest." },
|
|
35
|
+
{ do: "slide", on: ".row", to: "end", depth: "deep", say: "A slide all the way to the end." },
|
|
36
|
+
{ frame: "list.removed", hold: 2000, say: "Removed, with the way back." },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
mountScenes({
|
|
42
|
+
scenes,
|
|
43
|
+
into: document.querySelector("#clips"),
|
|
44
|
+
profile: { slideTarget: (element) => element.closest(".row") ?? element },
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The figure shows the first frame, a finger slides the row to the end, the second frame cuts in, and the clip starts again. Under the screen, one panel names the scene, the frame in view and the interaction while it happens, carries the caption, and holds the controls: back and forward from frame to frame with play between them, a bar to scrub, and at the bar's end the speed, which goes on to the next one as it is pressed, and the time, which reads elapsed, total or remaining as it is pressed. Three dots at the end of the title's row open a menu with a way to save the scene as a GIF.
|
|
49
|
+
|
|
50
|
+
## Common tasks
|
|
51
|
+
|
|
52
|
+
### Check casts before they are published
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
motion-control check casts.json --frames frames.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The command exits with 1 when something cannot be played, such as a frame that does not exist, and prints a warning for what a reviewer would question, such as an interaction whose effect no frame shows. The frames file is a list of names, or of objects with an `id` and perhaps a `code`. A selector that matches nothing cannot be found without the frames themselves; in a page, `mountScenes(…).audit()` lists each one.
|
|
59
|
+
|
|
60
|
+
### Tell the player about your frames
|
|
61
|
+
|
|
62
|
+
The player cannot guess what scrolls, what stays in place while it scrolls, or where typed words go. A profile says so, and only what differs from the default needs saying:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
mountScenes({
|
|
66
|
+
scenes,
|
|
67
|
+
into,
|
|
68
|
+
profile: {
|
|
69
|
+
shells: { phone: '<div class="phone"><div class="mo-screen"></div></div>' },
|
|
70
|
+
line: ".input .field",
|
|
71
|
+
scroll: { touch: ".list", wheel: ".list" },
|
|
72
|
+
stick: (list) => {
|
|
73
|
+
const head = list.querySelector<HTMLElement>(".heading");
|
|
74
|
+
return head ? { box: list, head } : undefined;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Put the title under the screen
|
|
81
|
+
|
|
82
|
+
The title stands in a bar over the screen, with the menu's three dots at its end; the panel under the screen keeps the frame, the caption and the controls. To have the title as the first row of that panel instead, mount with `title`:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
mountScenes({ scenes, into, title: "below" });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The figure is then one screen with one panel under it.
|
|
89
|
+
|
|
90
|
+
### Embed one clip in another page
|
|
91
|
+
|
|
92
|
+
Make a page that mounts with `solo` and `embedded`, and point an iframe at it:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
mountScenes({ scenes, into, solo: "remove", embedded: true });
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
On the page that holds the iframe, `fitEmbeds()` gives each iframe the height its page announces, so nothing scrolls inside a frame. The two pages find each other whichever loads first. A clip plays only while it is in view, inside an iframe as well, and not at all for a reader who asks for reduced motion.
|
|
99
|
+
|
|
100
|
+
### Put a clip in one self-contained file
|
|
101
|
+
|
|
102
|
+
A page that cannot import modules loads `@canonical/motion-control/global`, one classic script that puts the same exports on `globalThis.Motion`. `examples/04-single-file/build.mjs` inlines that script, the stylesheet, the frames and the casts into a single HTML file that makes no requests.
|
|
103
|
+
|
|
104
|
+
### Choose what a figure shows beside its screen
|
|
105
|
+
|
|
106
|
+
A figure shows three sections beside its screen: the title's row, the caption's rows, and the controls' row. Each can be hidden whole, or part by part, with `show`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
mountScenes({
|
|
110
|
+
scenes,
|
|
111
|
+
into,
|
|
112
|
+
show: {
|
|
113
|
+
title: { kind: false },
|
|
114
|
+
caption: { code: false, count: false },
|
|
115
|
+
timeline: false,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Section | Parts |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `title` | `kind` (Scene or Clip), `about`, `menu` (the three dots). The title itself shows whenever the row does. |
|
|
123
|
+
| `caption` | `code`, `frame` (its name), `interaction`, `count` (the step or the chapter), `words` (the caption). |
|
|
124
|
+
| `timeline` | `steps` (back, play, forward), `bar`, `speed`, `time`. |
|
|
125
|
+
|
|
126
|
+
A section left out shows whole; `false` hides it whole. A scene with its controls hidden still plays when it comes into view, and `player.exportGif()` still records it when the menu is hidden.
|
|
127
|
+
|
|
128
|
+
### Show the keys as they are pressed
|
|
129
|
+
|
|
130
|
+
Typing shows as a small sign that words are arriving, and a named key as a keycap in a corner of the screen. Keys pressed one after another stay in one row, so each can be read: the newest in the corner, the earlier ones beside it and fainter by age. The row fades once a step that is not a key starts, or 1.5 s after the last press. To show the keys themselves, the way a recording of a screen shows its keystrokes, mount with `keys`:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
mountScenes({ scenes, into, keys: "letters" });
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
A strip of keystrokes then carries what was typed and pressed on the frame, the newest marked: letters as they are and keys by the sign keyboards print on them, so a typo taken back reads `Fix the bikr⌫e`. A key being pressed stands at the end as a cap with its name. The strip stands just over the frame's line, so the words being typed stay in view, or at the foot of the screen when the frame has no line. `--mo-keys-gap` sets how far over the line, `10px` when left out:
|
|
137
|
+
|
|
138
|
+
```css
|
|
139
|
+
.motion-figure {
|
|
140
|
+
--mo-keys-gap: 24px;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Outline what a step acts on
|
|
145
|
+
|
|
146
|
+
While words arrive or a key is pressed, what they go to, the element in focus, is outlined in the colour of the interactions, so a reader sees where the keys land. A click or a tap can outline what it presses too; it does not unless the page asks:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
mountScenes({ scenes, into, outline: { keys: true, click: true } });
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`outline: { keys: false }` turns the first off. The outline is a box drawn over the frame, `.mo-outline` in the stylesheet, so the frame's own styles cannot hide it; the outlined element also carries `data-mo-outline`, for a page that wants to style it as well.
|
|
153
|
+
|
|
154
|
+
### Choose the speeds a scene can be played at
|
|
155
|
+
|
|
156
|
+
The speed beside the time goes through half speed, the speed as written and double. To offer others, mount with `speeds`:
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
mountScenes({ scenes, into, speeds: [0.25, 0.5, 2, 4] });
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
A press goes through them slowest first, and 1, the speed a scene starts at, is always among them.
|
|
163
|
+
|
|
164
|
+
### Play once or again
|
|
165
|
+
|
|
166
|
+
A scene starts again when it ends, unless its cast says `"loop": false`. To set it for every scene on the page, whatever the casts say, mount with `loop`:
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
mountScenes({ scenes, into, loop: false });
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The reader can still turn it on and off for one scene with Loop in the menu behind the three dots, and a script with `player.setLoop(true)`. A GIF saved from the scene does the same as the scene: it plays again, or once and stops on its last picture. `recordGif` takes `loop` to choose for the file alone. A video has no such setting; the program that plays it decides.
|
|
173
|
+
|
|
174
|
+
### Show what is hovered, pressed and focused
|
|
175
|
+
|
|
176
|
+
A clip has no real pointer and no real focus, so a page's `:hover`, `:active`, `:focus` and `:visited` rules never apply in it as they would for a reader. The player works the states out from the steps and marks the frame's elements instead, and when scenes are mounted it gives the page a twin of each of those rules that answers to the marks. A page's CSS needs no change.
|
|
177
|
+
|
|
178
|
+
| State | Mark | When |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| `:hover` | `data-mo-hover` | On the target the mouse pointer rests on, and on what holds it. Never by touch. |
|
|
181
|
+
| `:active` | `data-mo-active` | On the target of a click or a tap while it is pressed, and of a hold, a slide or a drag for the whole step. |
|
|
182
|
+
| `:focus` | `data-mo-focus` | On the last thing clicked, tapped or held that can hold the focus, or on the line while words are typed. It stays until the next one. |
|
|
183
|
+
| `:focus-visible` | `data-mo-focus-visible` | With the focus, when it came from typing or is on a field words go into. |
|
|
184
|
+
| `:focus-within` | `data-mo-focus-within` | On what is focused and on everything that holds it. |
|
|
185
|
+
| `:visited` | `data-mo-visited` | On a link once a click or a tap has pressed it or something inside it, for the rest of the scene. |
|
|
186
|
+
|
|
187
|
+
A frame can carry a mark in its own markup, to be drawn in that state from the start: `<button data-mo-hover>`.
|
|
188
|
+
|
|
189
|
+
The twins are made from the stylesheets the page may read, as a recording is. The pointer's hover follows the steps, not what is under it: when a wheel rolls the page under a resting pointer, the hover stays on the element the pointer was moved to.
|
|
190
|
+
|
|
191
|
+
### Let the reader do a step
|
|
192
|
+
|
|
193
|
+
A scene can stop at a tap, a click or a hold and wait for the reader to do it on the frame. Mark the step in the cast, and mount for practice:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{ "do": "tap", "on": ".row.focus", "practice": true, "say": "Tap the task to open it." }
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
mountScenes({ scenes, into, practice: true });
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
The scene plays up to the step, shows its symbol where the press is wanted, says it is the reader's turn, and goes on when they press what the step aims at. Without `practice` in the mount, the same cast plays through as a demonstration.
|
|
204
|
+
|
|
205
|
+
### Follow a scene from the page, and take it down
|
|
206
|
+
|
|
207
|
+
`onStep` and `onEnd` say where a scene is; `destroy` stops every scene, takes the figures off the page and stops listening to the window.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
const mounted = mountScenes({
|
|
211
|
+
scenes,
|
|
212
|
+
into,
|
|
213
|
+
onStep: (sceneId, index) => console.log(sceneId, index),
|
|
214
|
+
onEnd: (sceneId) => console.log(sceneId, "ended"),
|
|
215
|
+
});
|
|
216
|
+
mounted.destroy();
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Draw scenes with a renderer of your own
|
|
220
|
+
|
|
221
|
+
The player on the page is one renderer over layers that need none. A renderer of another kind, a component of a framework for instance, uses the same layers and draws what they describe.
|
|
222
|
+
|
|
223
|
+
| Entry | What it holds | Needs a browser |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| `@canonical/motion-control/cast` | The cast's types, how long a step lasts, the checker. | No |
|
|
226
|
+
| `@canonical/motion-control/timeline` | A scene laid out in time: `buildTimeline`, `locateTime`, `findKeyframe`, `stepKeyframe`, `advanceClock`. | No |
|
|
227
|
+
| `@canonical/motion-control/moment` | `describeMoment`: for a step and a progress, the frame in view, the symbols and where they are, what the step changes in the frame, the states, and what the panel reads. | No |
|
|
228
|
+
| `@canonical/motion-control/gif` | The GIF encoder. | No |
|
|
229
|
+
| `@canonical/motion-control/dom` | `applyMoment`, which makes a frame show a moment and gives back a function that undoes it; `drawSprites`; the state rules; the recorder; the player itself. | Yes |
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { describeMoment } from "@canonical/motion-control/moment";
|
|
233
|
+
import { buildTimeline, locateTime } from "@canonical/motion-control/timeline";
|
|
234
|
+
|
|
235
|
+
const timeline = buildTimeline(scene, (frameName) => "");
|
|
236
|
+
const { index, progress } = locateTime(timeline, 1200);
|
|
237
|
+
const moment = describeMoment(index, progress, { timeline, measure, rightToLeft: false, label, scroll });
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
`measure` says where an aim lands in the layer the symbols are drawn in; it is the one thing a description needs from the page. These entries are new and may still change shape before 1.0.
|
|
241
|
+
|
|
242
|
+
### Look at one moment of a clip
|
|
243
|
+
|
|
244
|
+
A headless browser does not advance a clip's clock reliably, so a screenshot taken after a wait proves nothing. Show the moment directly, then look:
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
const mounted = mountScenes({ scenes, into });
|
|
248
|
+
mounted.pose("remove", 1, 0.6); // the second step of "remove", at 60% of its duration
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Save a scene as a GIF
|
|
252
|
+
|
|
253
|
+
The three dots at the end of the title's row open a menu, and its first entry is Download as GIF. It records the scene from its first moment to its last, ten pictures a second, and hands the reader `<scene id>.gif`: the screen and the panel, without the controls, playing again when it ends if the scene does. To get the bytes without the menu, ask the player:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
const mounted = mountScenes({ scenes, into });
|
|
257
|
+
const bytes = await mounted.players[0].exportGif((done) => console.log(done));
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The recording draws the figure with the page's own style rules, and it can only read the rules of stylesheets the page may read: serve the page over HTTP, and keep the stylesheets on the page's own origin or served with CORS headers. A font fetched from another site is not drawn, and text then shows in a font the browser already has. A page inside a sandbox that forbids downloads still records, but the menu's entry saves nothing there; use `exportGif` and do with the bytes what the sandbox allows.
|
|
261
|
+
|
|
262
|
+
### Record a scene as a video, at any size and speed
|
|
263
|
+
|
|
264
|
+
`recordGif` and `recordVideo` record any element that shows a scene's moments: a player's figure, or a slide built round one. Both take the pictures per second, how many times faster than written the scene plays, and the size of the file:
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
import { recordVideo } from "@canonical/motion-control/dom";
|
|
268
|
+
|
|
269
|
+
const bytes = await recordVideo(mounted.players[0], {
|
|
270
|
+
size: { width: 3840, height: 2400 },
|
|
271
|
+
speed: 2,
|
|
272
|
+
fps: 30,
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
To record a scene for a slide deck, give a `slide` in place of a size: the recording is then of a slide of that size, with the scene centred on it and scaled to fill it, a title over it and a caption under it. A `framed` slide shows the whole figure; a `bare` one shows the screen alone, with the symbols over it.
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
const bytes = await recordVideo(mounted.players[0], {
|
|
280
|
+
slide: { width: 3840, height: 2400, mode: "bare", title: "Sliding a task away" },
|
|
281
|
+
speed: 2,
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The slide is laid out by the stylesheet's `.mo-slide` rules, in hundredths of its height, so a slide is the same at any size; `--mo-slide-paper` and `--mo-slide-ink` set its colours.
|
|
286
|
+
|
|
287
|
+
The video is H.264 in an MP4 file, which presentation software and video players open. It is encoded by the browser's own encoder, so it records where the browser offers one, as Chrome and Edge do; elsewhere `recordVideo` says it cannot, and `recordGif` records the same scene. The file is written by `writeMp4` (`@canonical/motion-control/video`), which needs no browser.
|
|
288
|
+
|
|
289
|
+
## Reference
|
|
290
|
+
|
|
291
|
+
Every export carries a doc comment, and the types say the rest: `Scene` and `Step` for a cast, `Profile` for what a page says about its frames, `MountOptions` for `mountScenes`. A cast as JSON is described by `@canonical/motion-control/cast.schema.json`. The stylesheet reads its colours from custom properties, each with a fallback: `--mo` for the interaction layer, `--mo-paper` and `--mo-rule` for the screen and the legend, and `--mo-bg`, `--mo-fg` and `--mo-edge` for the panel and the frame round a figure.
|
|
292
|
+
|
|
293
|
+
`examples/` sets the same four scenes up four ways: a script tag, a module import, clips in iframes, and one self-contained file.
|
|
294
|
+
|
|
295
|
+
## Stability
|
|
296
|
+
|
|
297
|
+
The version is below 1.0: the cast format, the profile and the exports can change between minor versions.
|
|
298
|
+
|
|
299
|
+
## License
|
|
300
|
+
|
|
301
|
+
MIT
|
package/cast.schema.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "motion casts",
|
|
4
|
+
"type": "array",
|
|
5
|
+
"items": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["id", "title", "steps"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
|
|
11
|
+
"title": { "type": "string" },
|
|
12
|
+
"device": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The name of a shell in the profile. phone and wide exist by default."
|
|
15
|
+
},
|
|
16
|
+
"clip": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "A longer end-to-end story (20 to 30 s) with chapters."
|
|
19
|
+
},
|
|
20
|
+
"loop": { "type": "boolean" },
|
|
21
|
+
"about": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["kind", "name"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"kind": { "type": "string" },
|
|
26
|
+
"name": { "type": "string" }
|
|
27
|
+
},
|
|
28
|
+
"description": "What the scene shows in the product's own model: a journey, a situation, a requirement."
|
|
29
|
+
},
|
|
30
|
+
"steps": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"minItems": 1,
|
|
33
|
+
"items": {
|
|
34
|
+
"oneOf": [
|
|
35
|
+
{
|
|
36
|
+
"type": "object",
|
|
37
|
+
"required": ["frame"],
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"properties": {
|
|
40
|
+
"frame": { "type": "string" },
|
|
41
|
+
"hold": { "type": "number", "minimum": 0 },
|
|
42
|
+
"type": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Type the frame's line in, letter by letter."
|
|
45
|
+
},
|
|
46
|
+
"cps": { "type": "number" },
|
|
47
|
+
"say": { "type": "string" },
|
|
48
|
+
"chapter": { "type": "string" }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "object",
|
|
53
|
+
"required": ["do"],
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"properties": {
|
|
56
|
+
"do": {
|
|
57
|
+
"enum": [
|
|
58
|
+
"tap",
|
|
59
|
+
"hold",
|
|
60
|
+
"slide",
|
|
61
|
+
"drag",
|
|
62
|
+
"move",
|
|
63
|
+
"click",
|
|
64
|
+
"wheel",
|
|
65
|
+
"key",
|
|
66
|
+
"type",
|
|
67
|
+
"wait"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"on": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "A CSS selector inside the frame in view."
|
|
73
|
+
},
|
|
74
|
+
"at": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
77
|
+
"minItems": 2,
|
|
78
|
+
"maxItems": 2
|
|
79
|
+
},
|
|
80
|
+
"ms": { "type": "number", "minimum": 0 },
|
|
81
|
+
"to": { "enum": ["start", "end"] },
|
|
82
|
+
"depth": { "enum": ["short", "deep"] },
|
|
83
|
+
"dy": { "type": "number" },
|
|
84
|
+
"move": { "type": "string" },
|
|
85
|
+
"k": { "type": "string" },
|
|
86
|
+
"text": { "type": "string" },
|
|
87
|
+
"cps": { "type": "number" },
|
|
88
|
+
"practice": {
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"description": "For a tap, a click or a hold: wait for the reader to do it on the frame before going on, where the page plays its scenes for practice."
|
|
91
|
+
},
|
|
92
|
+
"say": { "type": "string" },
|
|
93
|
+
"chapter": { "type": "string" }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
package/dist/esm/cli.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* motion-control check <casts.json> [--frames <frames.json>]
|
|
4
|
+
*
|
|
5
|
+
* Checks casts without a browser. The frames file is a list of frame names, or of objects with an id and perhaps
|
|
6
|
+
* a code. Exits with 1 when something cannot be played, 2 when the command is not understood.
|
|
7
|
+
*
|
|
8
|
+
* @note Impure: it reads files, prints, and sets the exit code.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { checkCasts, formatReport, listFrameNames } from "./lib/index.js";
|
|
12
|
+
const [command, castsPath, ...rest] = process.argv.slice(2);
|
|
13
|
+
const flag = rest.indexOf("--frames");
|
|
14
|
+
const framesPath = flag >= 0 ? rest.at(flag + 1) : undefined;
|
|
15
|
+
if (command !== "check" || castsPath === undefined) {
|
|
16
|
+
console.error("usage: motion-control check <casts.json> [--frames <frames.json>]");
|
|
17
|
+
process.exitCode = 2;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const casts = JSON.parse(readFileSync(castsPath, "utf8"));
|
|
21
|
+
const names = framesPath === undefined
|
|
22
|
+
? undefined
|
|
23
|
+
: listFrameNames(JSON.parse(readFileSync(framesPath, "utf8")));
|
|
24
|
+
const result = checkCasts(casts, names);
|
|
25
|
+
for (const line of formatReport(casts, result, names !== undefined)) {
|
|
26
|
+
console.log(line);
|
|
27
|
+
}
|
|
28
|
+
process.exitCode = result.errors.length > 0 ? 1 : 0;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE1E,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAE7D,IAAI,OAAO,KAAK,OAAO,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;IACnD,OAAO,CAAC,KAAK,CACX,mEAAmE,CACpE,CAAC;IACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;KAAM,CAAC;IACN,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACnE,MAAM,KAAK,GACT,UAAU,KAAK,SAAS;QACtB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,KAAK,SAAS,CAAC,EAAE,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The published surface as one classic script: it puts the exports of the package on `globalThis.Motion`, for a
|
|
3
|
+
* page that cannot import modules, such as a single self-contained HTML file.
|
|
4
|
+
*/
|
|
5
|
+
import * as Motion from "./index.js";
|
|
6
|
+
globalThis.Motion = Motion;
|
|
7
|
+
//# sourceMappingURL=global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/global.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,YAAY,CAAC;AAEpC,UAAyC,CAAC,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAuCA,OAAO,EACL,UAAU,EACV,aAAa,EACb,SAAS,EACT,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import checkScene from "./checkScene.js";
|
|
2
|
+
/**
|
|
3
|
+
* Checks a list of scenes without a browser.
|
|
4
|
+
*
|
|
5
|
+
* Errors are things the player cannot play: a frame that does not exist, a step that is neither a frame nor an
|
|
6
|
+
* interaction, an id used twice. Warnings are things a reviewer would question: an interaction whose effect is
|
|
7
|
+
* never shown, a scene far from its intended length. A selector that matches nothing cannot be found here,
|
|
8
|
+
* since that needs the frames themselves: the player's `audit` finds those in a browser.
|
|
9
|
+
*
|
|
10
|
+
* @param casts - The scenes, as read from a file: nothing about them is taken for granted.
|
|
11
|
+
* @param frameNames - The names of the frames that exist. Leave out to skip checking frame names.
|
|
12
|
+
* @returns What cannot be played, and what a reviewer would question, as sentences.
|
|
13
|
+
*/
|
|
14
|
+
export default function checkCasts(casts, frameNames) {
|
|
15
|
+
if (!Array.isArray(casts)) {
|
|
16
|
+
return { errors: ["The casts must be a list of scenes."], warnings: [] };
|
|
17
|
+
}
|
|
18
|
+
const names = frameNames ? new Set(frameNames) : undefined;
|
|
19
|
+
const errors = [];
|
|
20
|
+
const warnings = [];
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
casts.forEach((scene, index) => {
|
|
23
|
+
const found = checkScene(scene, index + 1, names);
|
|
24
|
+
errors.push(...found.errors);
|
|
25
|
+
warnings.push(...found.warnings);
|
|
26
|
+
const id = scene?.id;
|
|
27
|
+
if (id != null && seen.has(id)) {
|
|
28
|
+
errors.push(`scene ${String(id)}: this id is used twice.`);
|
|
29
|
+
}
|
|
30
|
+
seen.add(id);
|
|
31
|
+
});
|
|
32
|
+
return { errors, warnings };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=checkCasts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkCasts.js","sourceRoot":"","sources":["../../../../src/lib/cast/checkCasts.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAGzC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,KAAc,EACd,UAA6B;IAE7B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,MAAM,EAAE,CAAC,qCAAqC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC3E,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAW,CAAC;IAChC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,EAAE,GAAI,KAAiC,EAAE,EAAE,CAAC;QAClD,IAAI,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
|