@officedk/pptxdk 0.2.0 → 0.2.1
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/build.d.ts +5 -8
- package/dist/build.js +44 -52
- package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
- package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
- package/dist/core/dist/capabilities/audio/entry.js +122 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box-codegen.js +7 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +14 -15
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +11 -18
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +891 -468
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +1 -1
- package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +73 -79
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +175 -113
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
- package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +28 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +3 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
- package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
- package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
- package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
- package/dist/core/dist/capabilities/comment/comment.js +141 -0
- package/dist/core/dist/capabilities/comment/entry.js +1 -0
- package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
- package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
- package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +113 -50
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
- package/dist/core/dist/capabilities/group/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-import.js +36 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group.js +17 -17
- package/dist/core/dist/capabilities/image/entry.js +4 -0
- package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
- package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
- package/dist/core/dist/capabilities/image/image-import.js +26 -0
- package/dist/core/dist/capabilities/image/image.js +57 -0
- package/dist/core/dist/capabilities/line/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-declaration.js +15 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-import.js +15 -95
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line.js +41 -43
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters-codegen.js +7 -26
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +23 -35
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +15 -35
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +25 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +17 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +79 -75
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +4 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +6 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +16 -41
- package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
- package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-codegen.js +5 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-schemas.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder.js +50 -107
- package/dist/core/dist/capabilities/shape/entry.js +6 -0
- package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
- package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +44 -30
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-embedding.js +5 -6
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-engine.js +34 -13
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-import.js +62 -23
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font.js +4 -4
- package/dist/core/dist/capabilities/shared/geometry-codegen.js +101 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +47 -44
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
- package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -79
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +16 -26
- package/dist/core/dist/capabilities/shared/line-match.js +78 -0
- package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
- package/dist/core/dist/capabilities/shared/media-import.js +156 -0
- package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
- package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
- package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
- package/dist/core/dist/capabilities/shared/media-source.js +107 -0
- package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
- package/dist/core/dist/capabilities/shared/media.js +134 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
- package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-api.js +112 -99
- package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-schemas.js +19 -5
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +97 -158
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/placeholder-import.js +50 -20
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1 -1
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/{capabilities/dist/text/text-codegen.js → core/dist/capabilities/shared/rich-text-codegen.js} +23 -102
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/{capabilities/dist/shape → core/dist/capabilities/shared}/shape-declaration.js +14 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +12 -5
- package/dist/{capabilities/dist/text → core/dist/capabilities/shared}/text-declaration.js +7 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-schemas.js +77 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-service.js +571 -260
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +137 -112
- package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
- package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-xml.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +27 -33
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-codegen.js +6 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +22 -57
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-schemas.js +40 -37
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +9 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +60 -45
- package/dist/core/dist/capabilities/text/entry.js +3 -0
- package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
- package/dist/core/dist/capabilities/text/text-import.js +468 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +61 -54
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
- package/dist/core/dist/capabilities/video/entry.js +77 -0
- package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
- package/dist/core/dist/capabilities/video/video-source.js +42 -0
- package/dist/{codegen/dist → core/dist/codegen}/assets.js +13 -8
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +54 -122
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +17 -1
- package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
- package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
- package/dist/core/dist/document/all.js +41 -0
- package/dist/core/dist/document/default.js +10 -0
- package/dist/core/dist/document/document.js +218 -0
- package/dist/core/dist/document/index.js +62 -0
- package/dist/core/dist/document/stages.js +54 -0
- package/dist/{emit/dist → core/dist/emit}/emit.js +122 -60
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/{import/dist → core/dist/import}/import.js +221 -187
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +253 -317
- package/dist/core/dist/import/media-timing.js +233 -0
- package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
- package/dist/core/dist/index.js +47 -15
- package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +1 -1
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +59 -98
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +109 -78
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/{codegen/dist/types.js → core/dist/kernel/codegen.js} +22 -2
- package/dist/core/dist/kernel/container-slots.js +104 -0
- package/dist/core/dist/kernel/date-time-format.js +18 -0
- package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
- package/dist/core/dist/{declaration.js → kernel/declaration.js} +1 -1
- package/dist/core/dist/{diagnostics.js → kernel/diagnostics.js} +22 -5
- package/dist/core/dist/{document-internals.js → kernel/document-internals.js} +1 -1
- package/dist/core/dist/{document.js → kernel/document.js} +6 -5
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/{font-seal.js → kernel/font-seal.js} +2 -2
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +2 -6
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +156 -55
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/{input-values.js → kernel/input-values.js} +4 -3
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +1 -1
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +2 -6
- package/dist/core/dist/{layout.js → kernel/layout.js} +37 -38
- package/dist/core/dist/{masters.js → kernel/masters.js} +32 -55
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/{placeholders.js → kernel/placeholders.js} +23 -9
- package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
- package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +1 -1
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +1 -1
- package/dist/core/dist/kernel/pptx-read/index.js +15 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
- package/dist/core/dist/kernel/pptx-read/media.js +26 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +5 -7
- package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
- package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +40 -5
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +94 -67
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-fragments.js +56 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
- package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
- package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
- package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +62 -274
- package/dist/core/dist/{query.js → kernel/query.js} +5 -1
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +1 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +226 -257
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/{stage-options.js → kernel/stage-options.js} +23 -11
- package/dist/core/dist/{theme.js → kernel/theme.js} +54 -36
- package/dist/core/dist/{transform-geometry.js → kernel/transform-geometry.js} +1 -1
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/{document-41spD7bq.d.ts → document-C0lPlH-L.d.ts} +614 -522
- package/dist/{capability-BbKW9w4O.d.ts → index-B9_OUeA-.d.ts} +660 -553
- package/dist/{index-BEwhk7c8.d.ts → index-BJEzQxWV.d.ts} +27 -24
- package/dist/{index-cK2KtukZ.d.ts → index-DA9flrlR.d.ts} +2 -17
- package/dist/{index-v77CTJev.d.ts → index-GSt0t9VO.d.ts} +3 -4
- package/dist/index.d.ts +7 -8
- package/dist/index.js +68 -66
- package/dist/node.d.ts +16 -14
- package/dist/node.js +86 -43
- package/dist/pptxdk/src/cli-commands.js +9 -5
- package/dist/pptxdk/src/compose.js +28 -29
- package/dist/pptxdk/src/preview-result.js +24 -0
- package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
- package/dist/preview/dist/index.js +84 -34
- package/dist/preview/dist/options.js +8 -4
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +8 -7
- package/dist/preview.d.ts +3 -9
- package/dist/preview.js +7 -25
- package/dist/react/dist/append.js +3 -3
- package/dist/react/dist/author/audio-elements.js +14 -0
- package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
- package/dist/react/dist/author/chart-elements.js +14 -0
- package/dist/react/dist/author/comment-elements.js +15 -0
- package/dist/react/dist/author/group-elements.js +14 -0
- package/dist/react/dist/author/image-elements.js +14 -0
- package/dist/react/dist/author/line-elements.js +14 -0
- package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
- package/dist/react/dist/author/notes-elements.js +14 -0
- package/dist/react/dist/author/placeholder-elements.js +14 -0
- package/dist/react/dist/author/shape-elements.js +14 -0
- package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
- package/dist/{capabilities/dist/text → react/dist/author}/text-elements.js +15 -5
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +4 -4
- package/dist/react/dist/elements.js +7 -4
- package/dist/react/dist/from-vanilla.js +3 -3
- package/dist/react/dist/index.js +17 -3
- package/dist/react/dist/reconciler.js +3 -3
- package/dist/react.d.ts +103 -69
- package/dist/react.js +28 -28
- package/dist/{index-1ag7U9Jt.d.ts → stages-DYHSHKt4.d.ts} +23 -6
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -15
- package/package.json +2 -5
- package/dist/build-zrZuX4fK.d.ts +0 -3
- package/dist/capabilities/dist/all.js +0 -34
- package/dist/capabilities/dist/chart/chart-elements.js +0 -12
- package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
- package/dist/capabilities/dist/document.js +0 -168
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/image/image-codegen.js +0 -164
- package/dist/capabilities/dist/image/image-declaration.js +0 -8
- package/dist/capabilities/dist/image/image-elements.js +0 -12
- package/dist/capabilities/dist/image/image-xml.js +0 -12
- package/dist/capabilities/dist/image/image.js +0 -552
- package/dist/capabilities/dist/line/line-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-xml.js +0 -38
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -13
- package/dist/capabilities/dist/shape/shape-codegen.js +0 -236
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -628
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/text/text-import.js +0 -1224
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -15
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/index.js +0 -16
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/transition-6n8GZxSg.d.ts +0 -9
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import "
|
|
3
|
-
import { CommonContainer } from "
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import "../../kernel/capability.js";
|
|
3
|
+
import { CommonContainer } from "../../kernel/document.js";
|
|
4
4
|
import { breatheOptionsShape, easingSchema, effectDelaySchema, effectDurationSchema, effectPresetSchema, entranceEffectShape, intervalMsSchema, maxRepeatCount, maximumTimeNodeValue, motionDirectionSchema, motionGranularitySchema, motionHexColorSchema, motionMomentOffsetSchema, motionMomentSchema, motionPropKeys, motionScopeAuthorPropKeys, motionScopeHandleSchema, motionScopeModeSchema, motionStepAuthorPropKeys, motionStepAuthorPropsSchema, ownerMotionSchema, repeatCountSchema, spinAngleSchema, spinOptionsSchema } from "./motion-schemas.js";
|
|
5
|
-
// ../
|
|
5
|
+
// ../core/dist/capabilities/shared/motion-api.js
|
|
6
6
|
/** Creates the editable orchestration scope shared by the command factory and the JSX entry. */
|
|
7
7
|
function createMotionScopeNode(props) {
|
|
8
8
|
return new CommonContainer("motion-scope", "motion-scope", props);
|
|
@@ -204,12 +204,12 @@ function onStep(n, effect) {
|
|
|
204
204
|
effect
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
function fail(code, message) {
|
|
208
|
-
throw new CapabilityError(code, message);
|
|
207
|
+
function fail(code, message, field, path) {
|
|
208
|
+
throw new CapabilityError(code, message, path, { field });
|
|
209
209
|
}
|
|
210
210
|
/** Validates the local motion enable flag during capability parsing. */
|
|
211
|
-
function validateMotionFlag(value) {
|
|
212
|
-
if (value !== void 0 && typeof value !== "boolean")
|
|
211
|
+
function validateMotionFlag(value, path) {
|
|
212
|
+
if (value !== void 0 && typeof value !== "boolean") throw new CapabilityError("invalid-motion", "motion must be a boolean", path, { field: "motion" });
|
|
213
213
|
}
|
|
214
214
|
function isRecord(value) {
|
|
215
215
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -250,7 +250,7 @@ function pickMotionProps(props) {
|
|
|
250
250
|
}
|
|
251
251
|
function normalizeColor(value, name, code = "invalid-breathe-color") {
|
|
252
252
|
const parsed = motionHexColorSchema.safeParse(value);
|
|
253
|
-
if (!parsed.success) return fail(code, `${name} must be a #RRGGBB color
|
|
253
|
+
if (!parsed.success) return fail(code, `${name} must be a #RRGGBB color`, name);
|
|
254
254
|
return parsed.data;
|
|
255
255
|
}
|
|
256
256
|
/** Computes WCAG relative luminance of a normalized `#RRGGBB` color string. */
|
|
@@ -262,144 +262,150 @@ function relativeLuminance(color) {
|
|
|
262
262
|
].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16) / 255).map((channel) => channel <= .04045 ? channel / 12.92 : ((channel + .055) / 1.055) ** 2.4);
|
|
263
263
|
return .2126 * (linear[0] ?? 0) + .7152 * (linear[1] ?? 0) + .0722 * (linear[2] ?? 0);
|
|
264
264
|
}
|
|
265
|
-
function validatedEffect(value, expected) {
|
|
265
|
+
function validatedEffect(value, expected, field) {
|
|
266
266
|
let repeatCount;
|
|
267
267
|
let repeatDeclared = false;
|
|
268
268
|
let effectValue = value;
|
|
269
269
|
if (isRecord(value) && value["type"] === "repeated-effect") {
|
|
270
270
|
repeatDeclared = true;
|
|
271
271
|
const unknownRepeatField = Object.keys(value).find((key) => key !== "type" && key !== "effect" && key !== "count");
|
|
272
|
-
if (unknownRepeatField !== void 0) return fail("unknown-parameter", `repeat declaration contains unimplemented parameter ${unknownRepeatField}`);
|
|
273
|
-
if (!isRecord(value["effect"]) || value["effect"]["type"] !== "effect") return fail("invalid-repeat", "repeat must directly wrap a single effect declaration");
|
|
272
|
+
if (unknownRepeatField !== void 0) return fail("unknown-parameter", `repeat declaration contains unimplemented parameter ${unknownRepeatField}`, `${field}.${unknownRepeatField}`);
|
|
274
273
|
repeatCount = value["count"];
|
|
275
274
|
effectValue = value["effect"];
|
|
276
275
|
}
|
|
277
|
-
|
|
276
|
+
const effectField = repeatDeclared ? `${field}.effect` : field;
|
|
277
|
+
if (!isRecord(effectValue) || effectValue["type"] !== "effect") return fail(repeatDeclared ? "invalid-repeat" : "invalid-motion", repeatDeclared ? "repeat must directly wrap a single effect declaration" : {
|
|
278
|
+
entrance: "enter must be an entrance effect declaration such as fade() or wipe()",
|
|
279
|
+
emphasis: "emphasis must be an emphasis effect declaration such as spin()",
|
|
280
|
+
exit: "exit must be an exit effect declaration such as fadeOut() or disappear()"
|
|
281
|
+
}[expected], isRecord(effectValue) ? `${effectField}.type` : effectField);
|
|
278
282
|
const unsupportedBreatheParameters = effectValue[breatheUnknownParameters];
|
|
279
|
-
if (unsupportedBreatheParameters?.length) return fail("unknown-parameter", `breathe declaration contains unimplemented parameter ${unsupportedBreatheParameters[0]}`);
|
|
283
|
+
if (unsupportedBreatheParameters?.length) return fail("unknown-parameter", `breathe declaration contains unimplemented parameter ${unsupportedBreatheParameters[0]}`, `${effectField}.${unsupportedBreatheParameters[0]}`);
|
|
280
284
|
const unknown = Object.keys(effectValue).find((key) => !effectKeys.includes(key));
|
|
281
|
-
if (unknown !== void 0) return fail("unknown-parameter", `Animation effect contains unimplemented parameter ${unknown}`);
|
|
285
|
+
if (unknown !== void 0) return fail("unknown-parameter", `Animation effect contains unimplemented parameter ${unknown}`, `${effectField}.${unknown}`);
|
|
282
286
|
if (effectValue["kind"] !== expected) {
|
|
283
287
|
const actualKind = effectValue["kind"];
|
|
284
288
|
const targetSlot = slotPropByKind[actualKind] ?? expected;
|
|
285
|
-
return fail("invalid-motion", `${String(effectValue["preset"])}() is an ${String(actualKind)} effect and should be passed to ${targetSlot}`);
|
|
289
|
+
return fail("invalid-motion", `${String(effectValue["preset"])}() is an ${String(actualKind)} effect and should be passed to ${targetSlot}`, `${effectField}.kind`);
|
|
286
290
|
}
|
|
287
291
|
const parsedPreset = effectPresetSchema.safeParse(effectValue["preset"]);
|
|
288
|
-
if (!parsedPreset.success) return fail("unsupported-effect", `Unsupported animation effect ${String(effectValue["preset"])}`);
|
|
292
|
+
if (!parsedPreset.success) return fail("unsupported-effect", `Unsupported animation effect ${String(effectValue["preset"])}`, `${effectField}.preset`);
|
|
289
293
|
const preset = parsedPreset.data;
|
|
290
294
|
if (preset !== "breathe" && presetKinds[preset] !== expected) {
|
|
291
295
|
const actualKind = presetKinds[preset];
|
|
292
|
-
return fail("invalid-motion", `${preset}() is an ${actualKind} effect and should be passed to ${slotPropByKind[actualKind]}`);
|
|
296
|
+
return fail("invalid-motion", `${preset}() is an ${actualKind} effect and should be passed to ${slotPropByKind[actualKind]}`, `${effectField}.preset`);
|
|
293
297
|
}
|
|
294
|
-
const parsedDuration = effectDurationSchema.safeParse(effectValue["duration"]);
|
|
295
|
-
if (!parsedDuration.success) return fail("invalid-duration",
|
|
298
|
+
const parsedDuration = (preset === "breathe" ? breatheOptionsShape.period : effectDurationSchema).safeParse(effectValue["duration"]);
|
|
299
|
+
if (!parsedDuration.success) return fail(preset === "breathe" ? "invalid-breathe-period" : "invalid-duration", parsedDuration.error.issues[0].message, `${effectField}.duration`);
|
|
296
300
|
const duration = parsedDuration.data;
|
|
297
|
-
if ((preset === "appear" || preset === "disappear") && (duration !== 1 || effectValue["easing"] !== void 0)) return fail("invalid-motion", `${preset}() is an instant effect and does not accept duration or easing`);
|
|
301
|
+
if ((preset === "appear" || preset === "disappear") && (duration !== 1 || effectValue["easing"] !== void 0)) return fail("invalid-motion", `${preset}() is an instant effect and does not accept duration or easing`, `${effectField}.${duration !== 1 ? "duration" : "easing"}`);
|
|
298
302
|
const parsedDelay = effectDelaySchema.safeParse(effectValue["delay"]);
|
|
299
|
-
if (!parsedDelay.success || !Number.isFinite(Math.round(parsedDelay.data) + Math.round(duration))) return fail("invalid-delay", "Animation delay must be writable as a finite non-negative integer in milliseconds");
|
|
303
|
+
if (!parsedDelay.success || !Number.isFinite(Math.round(parsedDelay.data) + Math.round(duration))) return fail("invalid-delay", "Animation delay must be writable as a finite non-negative integer in milliseconds", `${effectField}.delay`);
|
|
300
304
|
const delay = parsedDelay.data;
|
|
301
|
-
if (preset === "breathe" && Math.round(delay) > 4294967295) return fail("invalid-delay", "breathe delay exceeds native timing value range");
|
|
305
|
+
if (preset === "breathe" && Math.round(delay) > 4294967295) return fail("invalid-delay", "breathe delay exceeds native timing value range", `${effectField}.delay`);
|
|
302
306
|
const by = effectValue["by"];
|
|
303
307
|
const interval = effectValue["intervalMs"];
|
|
304
308
|
if (preset === "spin" && typeof by === "number") {
|
|
305
|
-
if (!spinAngleSchema.safeParse(by).success) return fail("invalid-rotation", "spin by converted value must fall within signed 32-bit angle range");
|
|
306
|
-
if (effectValue["from"] !== void 0 || effectValue["to"] !== void 0) return fail("invalid-motion", "spin from/to and by cannot be declared simultaneously");
|
|
307
|
-
} else if (by !== void 0 && !motionGranularitySchema.safeParse(by).success) return fail("invalid-motion", "by must be a supported text or chart granularity");
|
|
308
|
-
if (interval !== void 0 && (by !== "word" && by !== "letter" || !intervalMsSchema.safeParse(interval).success)) return fail("invalid-motion-interval", "intervalMs applies only to per-word or per-letter effects, and must be a positive integer in milliseconds");
|
|
309
|
-
if ((preset === "wipe" || preset === "wipeOut" || preset === "fly" || preset === "flyOut") && !motionDirectionSchema.safeParse(effectValue["from"]).success) return fail("invalid-direction", `${preset} from must be a valid direction`);
|
|
309
|
+
if (!spinAngleSchema.safeParse(by).success) return fail("invalid-rotation", "spin by converted value must fall within signed 32-bit angle range", `${effectField}.by`);
|
|
310
|
+
if (effectValue["from"] !== void 0 || effectValue["to"] !== void 0) return fail("invalid-motion", "spin from/to and by cannot be declared simultaneously", `${effectField}.by`);
|
|
311
|
+
} else if (by !== void 0 && !motionGranularitySchema.safeParse(by).success) return fail("invalid-motion", "by must be a supported text or chart granularity", `${effectField}.by`);
|
|
312
|
+
if (interval !== void 0 && (by !== "word" && by !== "letter" || !intervalMsSchema.safeParse(interval).success || Number(interval) > 4294967295)) return fail("invalid-motion-interval", "intervalMs applies only to per-word or per-letter effects, and must be a positive integer in milliseconds", `${effectField}.intervalMs`);
|
|
313
|
+
if ((preset === "wipe" || preset === "wipeOut" || preset === "fly" || preset === "flyOut") && !motionDirectionSchema.safeParse(effectValue["from"]).success) return fail("invalid-direction", `${preset} from must be a valid direction`, `${effectField}.from`);
|
|
310
314
|
if (preset === "spin") {
|
|
311
315
|
const from = effectValue["from"];
|
|
312
316
|
const to = effectValue["to"];
|
|
313
|
-
if (typeof by !== "number" && !spinAngleSchema.safeParse(from).success) return fail("invalid-rotation", "spin from converted value must fall within signed 32-bit angle range");
|
|
314
|
-
if (typeof by !== "number" && to !== void 0 && !spinAngleSchema.safeParse(to).success) return fail("invalid-rotation", "spin to converted value must fall within signed 32-bit angle range");
|
|
317
|
+
if (typeof by !== "number" && !spinAngleSchema.safeParse(from).success) return fail("invalid-rotation", "spin from converted value must fall within signed 32-bit angle range", `${effectField}.from`);
|
|
318
|
+
if (typeof by !== "number" && to !== void 0 && !spinAngleSchema.safeParse(to).success) return fail("invalid-rotation", "spin to converted value must fall within signed 32-bit angle range", `${effectField}.to`);
|
|
315
319
|
}
|
|
316
|
-
if (preset !== "wipe" && preset !== "wipeOut" && preset !== "fly" && preset !== "flyOut" && preset !== "spin" && effectValue["from"] !== void 0) return fail("invalid-motion", `${preset} does not accept from parameter`);
|
|
317
|
-
if (preset !== "spin" && effectValue["to"] !== void 0) return fail("invalid-motion", `${preset} does not accept to parameter`);
|
|
320
|
+
if (preset !== "wipe" && preset !== "wipeOut" && preset !== "fly" && preset !== "flyOut" && preset !== "spin" && effectValue["from"] !== void 0) return fail("invalid-motion", `${preset} does not accept from parameter`, `${effectField}.from`);
|
|
321
|
+
if (preset !== "spin" && effectValue["to"] !== void 0) return fail("invalid-motion", `${preset} does not accept to parameter`, `${effectField}.to`);
|
|
318
322
|
const easing = effectValue["easing"];
|
|
319
323
|
if (easing !== void 0) {
|
|
320
|
-
if (!isRecord(easing)) return fail("invalid-easing", "easing must be an object");
|
|
324
|
+
if (!isRecord(easing)) return fail("invalid-easing", "easing must be an object", `${effectField}.easing`);
|
|
321
325
|
const parsedEasing = easingSchema.safeParse(easing);
|
|
322
326
|
if (!parsedEasing.success) {
|
|
323
327
|
const issue = parsedEasing.error.issues[0];
|
|
324
|
-
if (issue?.code === "unrecognized_keys" && issue.keys[0] !== void 0) return fail("unknown-parameter", `easing contains unimplemented parameter ${issue.keys[0]}`);
|
|
325
|
-
return fail("invalid-easing", "easing accelerate and decelerate proportions must be non-negative and sum to at most 1");
|
|
328
|
+
if (issue?.code === "unrecognized_keys" && issue.keys[0] !== void 0) return fail("unknown-parameter", `easing contains unimplemented parameter ${issue.keys[0]}`, `${effectField}.easing.${issue.keys[0]}`);
|
|
329
|
+
return fail("invalid-easing", "easing accelerate and decelerate proportions must be non-negative and sum to at most 1", zodIssueField(issue, `${effectField}.easing`));
|
|
326
330
|
}
|
|
327
331
|
}
|
|
328
332
|
let fromColor;
|
|
329
333
|
let toColor;
|
|
330
334
|
if (preset === "breathe") {
|
|
331
|
-
if (expected !== "emphasis") return fail("invalid-motion", "breathe() must be passed to emphasis");
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
toColor
|
|
335
|
-
if (relativeLuminance(toColor) <= relativeLuminance(fromColor)) return fail("invalid-breathe-colors", "breathe.to must be brighter than breathe.from");
|
|
335
|
+
if (expected !== "emphasis") return fail("invalid-motion", "breathe() must be passed to emphasis", effectField);
|
|
336
|
+
fromColor = normalizeColor(effectValue["fromColor"], `${effectField}.fromColor`);
|
|
337
|
+
toColor = normalizeColor(effectValue["toColor"], `${effectField}.toColor`);
|
|
338
|
+
if (relativeLuminance(toColor) <= relativeLuminance(fromColor)) return fail("invalid-breathe-colors", "breathe.to must be brighter than breathe.from", `${effectField}.toColor`);
|
|
336
339
|
} else if (preset === "fillColor") {
|
|
337
|
-
fromColor = normalizeColor(effectValue["fromColor"],
|
|
338
|
-
toColor = normalizeColor(effectValue["toColor"],
|
|
339
|
-
if (by !== void 0 || interval !== void 0) return fail("invalid-motion", "fillColor does not support text or chart granularity");
|
|
340
|
-
} else if (effectValue["fromColor"] !== void 0 || effectValue["toColor"] !== void 0) return fail("invalid-motion", `${String(preset)} does not accept breathe color parameters`);
|
|
340
|
+
fromColor = normalizeColor(effectValue["fromColor"], `${effectField}.fromColor`, "invalid-fill-color");
|
|
341
|
+
toColor = normalizeColor(effectValue["toColor"], `${effectField}.toColor`, "invalid-fill-color");
|
|
342
|
+
if (by !== void 0 || interval !== void 0) return fail("invalid-motion", "fillColor does not support text or chart granularity", `${effectField}.${by === void 0 ? "intervalMs" : "by"}`);
|
|
343
|
+
} else if (effectValue["fromColor"] !== void 0 || effectValue["toColor"] !== void 0) return fail("invalid-motion", `${String(preset)} does not accept breathe color parameters`, `${effectField}.${effectValue["fromColor"] === void 0 ? "toColor" : "fromColor"}`);
|
|
341
344
|
if (repeatDeclared) {
|
|
342
|
-
if (preset !== "spin" && preset !== "breathe") return fail("unsupported-repeat", `${String(preset)} does not support repetition yet; currently only spin and breathe are supported
|
|
345
|
+
if (preset !== "spin" && preset !== "breathe") return fail("unsupported-repeat", `${String(preset)} does not support repetition yet; currently only spin and breathe are supported`, field);
|
|
343
346
|
if (repeatCount === "forever") {
|
|
344
|
-
if (preset !== "breathe") return fail("unsupported-repeat", "forever currently only supports complete breathe cycles");
|
|
345
|
-
} else if (!repeatCountSchema.safeParse(repeatCount).success) return fail("invalid-repeat-count", `repeat count must be total rounds between 1 and ${maxRepeatCount}`);
|
|
346
|
-
if (typeof repeatCount === "number" && (!Number.isSafeInteger(Math.round(delay) + Math.round(duration) * repeatCount) || Math.round(delay) > 4294967295 || (preset === "breathe" ? duration / 2 : Math.round(duration)) > 4294967295 || repeatCount * 1e3 > 4294967295)) return fail("invalid-repeat-duration", "Repeated total duration must remain an exact integer in milliseconds and single round must not exceed native timing range");
|
|
347
|
-
if (by !== void 0 && typeof by !== "number") return fail("unsupported-repeat-combination", "Repeated effects cannot currently be combined with per-paragraph, per-word, per-letter, or chart granularity");
|
|
348
|
-
if (!repeatCountSchema.safeParse(repeatCount).success) return fail("invalid-repeat-count", `repeat count must be total rounds between 1 and ${maxRepeatCount}`);
|
|
347
|
+
if (preset !== "breathe") return fail("unsupported-repeat", "forever currently only supports complete breathe cycles", `${field}.count`);
|
|
348
|
+
} else if (!repeatCountSchema.safeParse(repeatCount).success) return fail("invalid-repeat-count", `repeat count must be total rounds between 1 and ${maxRepeatCount}`, `${field}.count`);
|
|
349
|
+
if (typeof repeatCount === "number" && (!Number.isSafeInteger(Math.round(delay) + Math.round(duration) * repeatCount) || Math.round(delay) > 4294967295 || (preset === "breathe" ? duration / 2 : Math.round(duration)) > 4294967295 || repeatCount * 1e3 > 4294967295)) return fail("invalid-repeat-duration", "Repeated total duration must remain an exact integer in milliseconds and single round must not exceed native timing range", field);
|
|
350
|
+
if (by !== void 0 && typeof by !== "number") return fail("unsupported-repeat-combination", "Repeated effects cannot currently be combined with per-paragraph, per-word, per-letter, or chart granularity", `${effectField}.by`);
|
|
351
|
+
if (!repeatCountSchema.safeParse(repeatCount).success) return fail("invalid-repeat-count", `repeat count must be total rounds between 1 and ${maxRepeatCount}`, `${field}.count`);
|
|
349
352
|
}
|
|
350
353
|
return {
|
|
351
354
|
...effectValue,
|
|
355
|
+
authorField: effectField,
|
|
352
356
|
...repeatCount === void 0 ? {} : { repeatCount },
|
|
353
357
|
...fromColor === void 0 ? {} : { fromColor },
|
|
354
358
|
...toColor === void 0 ? {} : { toColor }
|
|
355
359
|
};
|
|
356
360
|
}
|
|
357
|
-
function stepDeclarationFromProps(props) {
|
|
361
|
+
function stepDeclarationFromProps(props, path) {
|
|
358
362
|
const number = props["n"];
|
|
359
363
|
if (number === void 0) {
|
|
360
364
|
const identity = props["stepIdentity"];
|
|
361
|
-
if (typeof identity !== "string" || identity === "") return fail("invalid-step", "Automatic click step lacks instance identity");
|
|
365
|
+
if (typeof identity !== "string" || identity === "") return fail("invalid-step", "Automatic click step lacks instance identity", void 0, path);
|
|
362
366
|
return Object.freeze({
|
|
363
367
|
mode: "automatic",
|
|
364
368
|
identity
|
|
365
369
|
});
|
|
366
370
|
}
|
|
367
371
|
const parsed = motionStepAuthorPropsSchema.safeParse({ n: number });
|
|
368
|
-
if (!parsed.success || parsed.data.n === void 0) return fail("invalid-step", "Explicit click step number must be a positive integer");
|
|
372
|
+
if (!parsed.success || parsed.data.n === void 0) return fail("invalid-step", "Explicit click step number must be a positive integer", "n", path);
|
|
369
373
|
return Object.freeze({
|
|
370
374
|
mode: "explicit",
|
|
371
375
|
number: parsed.data.n
|
|
372
376
|
});
|
|
373
377
|
}
|
|
374
|
-
function
|
|
378
|
+
function effectEntries(value, kind) {
|
|
379
|
+
const field = slotPropByKind[kind];
|
|
375
380
|
if (value === void 0) return [];
|
|
376
|
-
|
|
381
|
+
if (Array.isArray(value)) return value.map((entry, index) => validatedDeclaration(entry, kind, `${field}.${index}`));
|
|
382
|
+
return [validatedDeclaration(value, kind, field)];
|
|
377
383
|
}
|
|
378
|
-
function validatedMoment(value) {
|
|
384
|
+
function validatedMoment(value, field) {
|
|
379
385
|
const parsed = motionMomentSchema.safeParse(value);
|
|
380
386
|
if (!parsed.success) {
|
|
381
|
-
if (!isRecord(value) || value["type"] !== "motion-moment") return fail("invalid-moment", "Moment handle must come from a motion scope handle.");
|
|
382
|
-
return fail("invalid-moment", "Moment handle scope, type, or name is invalid");
|
|
387
|
+
if (!isRecord(value) || value["type"] !== "motion-moment") return fail("invalid-moment", "Moment handle must come from a motion scope handle.", field);
|
|
388
|
+
return fail("invalid-moment", "Moment handle scope, type, or name is invalid", zodIssueField(parsed.error.issues[0], field));
|
|
383
389
|
}
|
|
384
390
|
return parsed.data;
|
|
385
391
|
}
|
|
386
392
|
function validatedTiming(value) {
|
|
387
393
|
if (isRecord(value) && value["type"] === "motion-offset") {
|
|
388
|
-
const moment = validatedMoment(value["moment"]);
|
|
394
|
+
const moment = validatedMoment(value["moment"], "startAt.moment");
|
|
389
395
|
const parsed = motionMomentOffsetSchema.safeParse({
|
|
390
396
|
type: "motion-offset",
|
|
391
397
|
moment,
|
|
392
398
|
offsetMs: value["offsetMs"]
|
|
393
399
|
});
|
|
394
|
-
if (!parsed.success) return fail("invalid-delay", "Moment offset must be a finite non-negative integer in milliseconds");
|
|
400
|
+
if (!parsed.success) return fail("invalid-delay", "Moment offset must be a finite non-negative integer in milliseconds", "startAt.offsetMs");
|
|
395
401
|
return Object.freeze(parsed.data);
|
|
396
402
|
}
|
|
397
|
-
return validatedMoment(value);
|
|
403
|
+
return validatedMoment(value, "startAt");
|
|
398
404
|
}
|
|
399
|
-
function validatedPublisher(value) {
|
|
405
|
+
function validatedPublisher(value, field) {
|
|
400
406
|
if (value === void 0) return void 0;
|
|
401
|
-
const momentValue = validatedMoment(value);
|
|
402
|
-
if (momentValue.point !== "named") return fail("invalid-moment", "publishStart and publishEnd require named moment handles");
|
|
407
|
+
const momentValue = validatedMoment(value, field);
|
|
408
|
+
if (momentValue.point !== "named") return fail("invalid-moment", "publishStart and publishEnd require named moment handles", field);
|
|
403
409
|
return momentValue;
|
|
404
410
|
}
|
|
405
411
|
const motionScopeAllowedParameters = new Set(motionScopeAuthorPropKeys);
|
|
@@ -409,19 +415,19 @@ function localScopeDeclaration(props) {
|
|
|
409
415
|
if (unknown !== void 0) return fail("unknown-parameter", `MotionScope contains unimplemented parameter ${unknown}`);
|
|
410
416
|
validateMotionFlag(props["motion"]);
|
|
411
417
|
const parsedHandle = motionScopeHandleSchema.safeParse(props["scope"]);
|
|
412
|
-
if (!parsedHandle.success) return fail("invalid-scope", "MotionScope requires a handle created by createMotionScopeHandle() or useMotionScope()");
|
|
418
|
+
if (!parsedHandle.success) return fail("invalid-scope", "MotionScope requires a handle created by createMotionScopeHandle() or useMotionScope()", zodIssueField(parsedHandle.error.issues[0], "scope"));
|
|
413
419
|
const handle = parsedHandle.data;
|
|
414
420
|
const parsedMode = motionScopeModeSchema.safeParse(props["mode"] ?? "parallel");
|
|
415
|
-
if (!parsedMode.success) return fail("invalid-scope", "MotionScope mode must be parallel, sequence, or stagger");
|
|
421
|
+
if (!parsedMode.success) return fail("invalid-scope", "MotionScope mode must be parallel, sequence, or stagger", "mode");
|
|
416
422
|
const mode = parsedMode.data;
|
|
417
423
|
const parsedDelay = effectDelaySchema.safeParse(props["delay"] ?? 0);
|
|
418
|
-
if (!parsedDelay.success) return fail("invalid-delay", "MotionScope delay must be a finite non-negative integer in milliseconds");
|
|
424
|
+
if (!parsedDelay.success) return fail("invalid-delay", "MotionScope delay must be a finite non-negative integer in milliseconds", "delay");
|
|
419
425
|
const delay = parsedDelay.data;
|
|
420
426
|
const each = props["each"];
|
|
421
|
-
if (mode === "stagger" && (typeof each !== "number" || !Number.isFinite(each) || each < 0 || !Number.isSafeInteger(Math.round(each))) || mode !== "stagger" && each !== void 0) return fail("invalid-scope", "stagger requires non-negative integer each; other modes do not accept each");
|
|
427
|
+
if (mode === "stagger" && (typeof each !== "number" || !Number.isFinite(each) || each < 0 || !Number.isSafeInteger(Math.round(each))) || mode !== "stagger" && each !== void 0) return fail("invalid-scope", "stagger requires non-negative integer each; other modes do not accept each", "each");
|
|
422
428
|
const startAt = props["startAt"] === void 0 ? void 0 : validatedTiming(props["startAt"]);
|
|
423
|
-
const publishStart = validatedPublisher(props["publishStart"]);
|
|
424
|
-
const publishEnd = validatedPublisher(props["publishEnd"]);
|
|
429
|
+
const publishStart = validatedPublisher(props["publishStart"], "publishStart");
|
|
430
|
+
const publishEnd = validatedPublisher(props["publishEnd"], "publishEnd");
|
|
425
431
|
return Object.freeze({
|
|
426
432
|
identity: handle.identity,
|
|
427
433
|
mode,
|
|
@@ -446,10 +452,10 @@ function motionScopeAnnotation(input) {
|
|
|
446
452
|
};
|
|
447
453
|
}
|
|
448
454
|
/** Validates a Step declaration wrapper and extracts its formal click-step trigger. */
|
|
449
|
-
function parseStepDeclarationProps(input) {
|
|
455
|
+
function parseStepDeclarationProps(input, path) {
|
|
450
456
|
const unknown = Object.keys(input).find((key) => !motionStepAllowedParameters.has(key));
|
|
451
|
-
if (unknown !== void 0) return fail("unknown-parameter", `Step contains unimplemented parameter ${unknown}
|
|
452
|
-
return stepDeclarationFromProps(input);
|
|
457
|
+
if (unknown !== void 0) return fail("unknown-parameter", `Step contains unimplemented parameter ${unknown}`, unknown, path);
|
|
458
|
+
return stepDeclarationFromProps(input, path);
|
|
453
459
|
}
|
|
454
460
|
/** Validates Step wrapper parameters and emits a transparent step annotation resolved by tree order. */
|
|
455
461
|
function motionStepAnnotation(input) {
|
|
@@ -464,35 +470,37 @@ function motionStepAnnotation(input) {
|
|
|
464
470
|
resolveContributions: resolveMotionContributions
|
|
465
471
|
}];
|
|
466
472
|
}
|
|
467
|
-
function validatedDeclaration(value, expected) {
|
|
473
|
+
function validatedDeclaration(value, expected, field) {
|
|
468
474
|
if (isRecord(value) && value["type"] === "stepped-effect") {
|
|
469
475
|
const unknownStepField = Object.keys(value).find((key) => key !== "type" && key !== "step" && key !== "effect");
|
|
470
|
-
if (unknownStepField !== void 0) return fail("unknown-parameter", `onStep declaration contains unimplemented parameter ${unknownStepField}`);
|
|
476
|
+
if (unknownStepField !== void 0) return fail("unknown-parameter", `onStep declaration contains unimplemented parameter ${unknownStepField}`, `${field}.${unknownStepField}`);
|
|
471
477
|
const parsedStep = motionStepAuthorPropsSchema.safeParse({ n: value["step"] });
|
|
472
|
-
if (!parsedStep.success || parsedStep.data.n === void 0) return fail("invalid-step", "onStep click step number must be a positive integer");
|
|
473
|
-
if (isRecord(value["effect"]) && value["effect"]["type"] === "stepped-effect") return fail("invalid-motion", "onStep cannot be nested");
|
|
478
|
+
if (!parsedStep.success || parsedStep.data.n === void 0) return fail("invalid-step", "onStep click step number must be a positive integer", `${field}.step`);
|
|
479
|
+
if (isRecord(value["effect"]) && value["effect"]["type"] === "stepped-effect") return fail("invalid-motion", "onStep cannot be nested", `${field}.effect`);
|
|
474
480
|
return Object.freeze({
|
|
475
|
-
effect: validatedEffect(value["effect"], expected),
|
|
481
|
+
effect: validatedEffect(value["effect"], expected, `${field}.effect`),
|
|
476
482
|
step: Object.freeze({
|
|
477
483
|
mode: "explicit",
|
|
478
484
|
number: parsedStep.data.n
|
|
479
485
|
})
|
|
480
486
|
});
|
|
481
487
|
}
|
|
482
|
-
return Object.freeze({ effect: validatedEffect(value, expected) });
|
|
488
|
+
return Object.freeze({ effect: validatedEffect(value, expected, field) });
|
|
483
489
|
}
|
|
484
490
|
function localMotionValue(props, target, stepOverride) {
|
|
485
491
|
const enter = props["enter"];
|
|
486
492
|
const entries = [
|
|
487
|
-
...
|
|
488
|
-
...
|
|
489
|
-
...
|
|
493
|
+
...effectEntries(enter, "entrance"),
|
|
494
|
+
...effectEntries(props["emphasis"], "emphasis"),
|
|
495
|
+
...effectEntries(props["exit"], "exit")
|
|
490
496
|
];
|
|
491
|
-
|
|
492
|
-
if (
|
|
497
|
+
const breathe = entries.find(({ effect }) => effect.preset === "breathe");
|
|
498
|
+
if (breathe && (target.kind !== "shape" || target.range !== void 0 || !target.filled)) return fail("invalid-breathe-target", "breathe() requires native Shape with solid fill; Group requires effects declared on real members separately", breathe.effect.authorField);
|
|
499
|
+
const fillColor = entries.find(({ effect }) => effect.preset === "fillColor");
|
|
500
|
+
if (fillColor && (target.kind !== "shape" || target.range !== void 0 || !target.solidFilled)) return fail("invalid-fill-color-target", "fillColor() requires native Shape with solid fill", fillColor.effect.authorField);
|
|
493
501
|
const startAt = props["startAt"] === void 0 ? void 0 : validatedTiming(props["startAt"]);
|
|
494
|
-
const publishStart = validatedPublisher(props["publishStart"]);
|
|
495
|
-
const publishEnd = validatedPublisher(props["publishEnd"]);
|
|
502
|
+
const publishStart = validatedPublisher(props["publishStart"], "publishStart");
|
|
503
|
+
const publishEnd = validatedPublisher(props["publishEnd"], "publishEnd");
|
|
496
504
|
return Object.freeze({
|
|
497
505
|
target: Object.freeze({ ...target }),
|
|
498
506
|
enterDeclared: enter !== void 0,
|
|
@@ -522,16 +530,21 @@ function motionParagraphAnnotations(paragraphMotions, baseTarget, parentProps) {
|
|
|
522
530
|
if (parentProps["motion"] === false || paragraphMotions.length === 0) return [];
|
|
523
531
|
const annotations = [];
|
|
524
532
|
for (const item of paragraphMotions) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
533
|
+
let value;
|
|
534
|
+
try {
|
|
535
|
+
if (item.props["motion"] === false) continue;
|
|
536
|
+
value = localMotionValue(item.props, {
|
|
537
|
+
...baseTarget,
|
|
538
|
+
range: {
|
|
539
|
+
type: "paragraph",
|
|
540
|
+
start: item.paragraphIndex,
|
|
541
|
+
end: item.paragraphIndex
|
|
542
|
+
}
|
|
543
|
+
}, item.step);
|
|
544
|
+
} catch (error) {
|
|
545
|
+
if (error instanceof CapabilityError) throw new CapabilityError(error.code, error.message, item.path, error.details);
|
|
546
|
+
throw error;
|
|
547
|
+
}
|
|
535
548
|
const hasTimingProps = value.startAt !== void 0 || value.publishStart !== void 0 || value.publishEnd !== void 0;
|
|
536
549
|
if (value.entries.length === 0 && !hasTimingProps) continue;
|
|
537
550
|
annotations.push({
|
|
@@ -552,13 +565,13 @@ function motionContainerAnnotations(props, target, options = {}) {
|
|
|
552
565
|
const enabled = props["motion"] !== false;
|
|
553
566
|
const propagatesDefaultEnter = options.propagatesDefaultEnter === true;
|
|
554
567
|
const startAt = enabled && props["startAt"] !== void 0 ? validatedTiming(props["startAt"]) : void 0;
|
|
555
|
-
const publishStart = enabled ? validatedPublisher(props["publishStart"]) : void 0;
|
|
556
|
-
const publishEnd = enabled ? validatedPublisher(props["publishEnd"]) : void 0;
|
|
568
|
+
const publishStart = enabled ? validatedPublisher(props["publishStart"], "publishStart") : void 0;
|
|
569
|
+
const publishEnd = enabled ? validatedPublisher(props["publishEnd"], "publishEnd") : void 0;
|
|
557
570
|
const hasTimingProps = startAt !== void 0 || publishStart !== void 0 || publishEnd !== void 0;
|
|
558
571
|
const hasExplicitMotion = enabled && (props["enter"] !== void 0 || props["emphasis"] !== void 0 || props["exit"] !== void 0 || hasTimingProps || props["motion"] === true);
|
|
559
572
|
const groupsAsParallelUnit = options.groupsAsParallelUnit === true && hasExplicitMotion;
|
|
560
573
|
let defaultEnter;
|
|
561
|
-
if (enabled && propagatesDefaultEnter && props["enter"] !== void 0) defaultEnter = Object.freeze(
|
|
574
|
+
if (enabled && propagatesDefaultEnter && props["enter"] !== void 0) defaultEnter = Object.freeze(effectEntries(props["enter"], "entrance"));
|
|
562
575
|
const annotations = [];
|
|
563
576
|
if (!enabled || defaultEnter !== void 0 || groupsAsParallelUnit || hasTimingProps) annotations.push({
|
|
564
577
|
capability: "motion",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { colorValueSchema } from "
|
|
2
|
-
import "
|
|
1
|
+
import { colorValueSchema } from "../../kernel/theme.js";
|
|
2
|
+
import "../../kernel/capability.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
// ../
|
|
4
|
+
// ../core/dist/capabilities/shared/motion-schemas.js
|
|
5
5
|
/** ST_TLTime uses unsignedInt; repeatCount unit is one thousandth of a round. */
|
|
6
6
|
const maximumTimeNodeValue = 4294967295;
|
|
7
7
|
const maxRepeatCount = Math.floor(maximumTimeNodeValue / 1e3);
|
|
@@ -98,7 +98,7 @@ const rawEasingSchema = z.strictObject({
|
|
|
98
98
|
const easingSchema = rawEasingSchema;
|
|
99
99
|
/** Hex RGB color (`#RRGGBB`) validated against core's color value domain and normalized to uppercase. */
|
|
100
100
|
const motionHexColorSchema = colorValueSchema.pipe(z.string().regex(/^#[0-9a-f]{6}$/iu, "color must be a #RRGGBB color")).transform((value) => value.toUpperCase());
|
|
101
|
-
const effectDurationSchema = z.number().finite().positive().refine((value) => Math.round(value) >= 1 &&
|
|
101
|
+
const effectDurationSchema = z.number().finite().positive().refine((value) => Math.round(value) >= 1 && Math.round(value) <= 4294967295, "Animation duration must be writable as a finite positive integer in milliseconds");
|
|
102
102
|
const effectDelaySchema = z.number().finite().min(0).refine((value) => Number.isSafeInteger(Math.round(value)), "Animation delay must be writable as a finite non-negative integer in milliseconds");
|
|
103
103
|
const intervalMsSchema = z.number().int().min(1);
|
|
104
104
|
const spinAngleSchema = z.number().finite().refine((value) => {
|
|
@@ -169,8 +169,12 @@ const rawEntranceEffectSchema = entranceEffectObjectSchema.readonly();
|
|
|
169
169
|
const entranceEffectSchema = rawEntranceEffectSchema;
|
|
170
170
|
const emphasisEffectObjectSchema = z.strictObject({
|
|
171
171
|
...effectCommonFields,
|
|
172
|
+
duration: z.number(),
|
|
172
173
|
kind: z.literal("emphasis"),
|
|
173
174
|
preset: emphasisPresetSchema
|
|
175
|
+
}).refine(({ preset, duration }) => (preset === "breathe" ? breatheOptionsShape.period : effectDurationSchema).safeParse(duration).success, {
|
|
176
|
+
path: ["duration"],
|
|
177
|
+
message: "Effect duration exceeds its native timing range"
|
|
174
178
|
});
|
|
175
179
|
const rawEmphasisEffectSchema = emphasisEffectObjectSchema.readonly();
|
|
176
180
|
const emphasisEffectSchema = rawEmphasisEffectSchema;
|
|
@@ -185,6 +189,7 @@ z.strictObject({
|
|
|
185
189
|
...effectCommonFields,
|
|
186
190
|
kind: z.literal("emphasis"),
|
|
187
191
|
preset: z.literal("breathe"),
|
|
192
|
+
duration: breatheOptionsShape.period,
|
|
188
193
|
fromColor: motionHexColorSchema,
|
|
189
194
|
toColor: motionHexColorSchema
|
|
190
195
|
}).readonly();
|
|
@@ -255,7 +260,7 @@ z.strictObject({
|
|
|
255
260
|
}).readonly();
|
|
256
261
|
z.discriminatedUnion("kind", [
|
|
257
262
|
entranceEffectObjectSchema.extend({ repeatCount: rawRepeatCountSchema.optional() }).readonly(),
|
|
258
|
-
emphasisEffectObjectSchema.
|
|
263
|
+
emphasisEffectObjectSchema.safeExtend({ repeatCount: rawRepeatCountSchema.optional() }).readonly(),
|
|
259
264
|
exitEffectObjectSchema.extend({ repeatCount: rawRepeatCountSchema.optional() }).readonly()
|
|
260
265
|
]);
|
|
261
266
|
const rawMotionScopeModeSchema = z.enum([
|
|
@@ -330,6 +335,15 @@ const rawOwnerMotionEffectSchema = z.strictObject({
|
|
|
330
335
|
rawRepeatedExitSchema
|
|
331
336
|
]),
|
|
332
337
|
range: rawMotionTargetRangeSchema.optional()
|
|
338
|
+
}).superRefine(({ effect: declaration }, ctx) => {
|
|
339
|
+
const repeated = declaration.type === "repeated-effect";
|
|
340
|
+
const effect = repeated ? declaration.effect : declaration;
|
|
341
|
+
const path = repeated ? ["effect", "effect"] : ["effect"];
|
|
342
|
+
for (const [field, value] of [["delay", Math.round(effect.delay)], ["intervalMs", effect.intervalMs]]) if (value !== void 0 && value > 4294967295) ctx.addIssue({
|
|
343
|
+
code: "custom",
|
|
344
|
+
path: [...path, field],
|
|
345
|
+
message: `Effect ${field} exceeds the native timing range`
|
|
346
|
+
});
|
|
333
347
|
}).readonly();
|
|
334
348
|
const rawOwnerMotionStepSchema = z.strictObject({
|
|
335
349
|
trigger: z.enum(["auto", "click"]),
|