@knime/kds-components 1.1.1 → 1.1.2

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/index.js CHANGED
@@ -1708,6 +1708,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
1708
1708
  to: {},
1709
1709
  label: {},
1710
1710
  title: {},
1711
+ size: { default: "medium" },
1711
1712
  disabled: { type: Boolean, default: false },
1712
1713
  download: { type: Boolean, default: false },
1713
1714
  target: {},
@@ -1782,7 +1783,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
1782
1783
  }
1783
1784
  return (_ctx, _cache) => {
1784
1785
  return withDirectives((openBlock(), createBlock(resolveDynamicComponent(component.value), {
1785
- class: normalizeClass(["kds-link", `variant-${variant.value}`, { disabled: __props.disabled }]),
1786
+ class: normalizeClass(["kds-link", `variant-${variant.value}`, `size-${__props.size}`, { disabled: __props.disabled }]),
1786
1787
  to: effectiveTo.value,
1787
1788
  download: __props.disabled ? void 0 : __props.download,
1788
1789
  target: effectiveTarget.value,
@@ -1807,7 +1808,13 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
1807
1808
  }
1808
1809
  });
1809
1810
 
1810
- const KdsLink = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-6f9a0cf6"]]);
1811
+ const KdsLink = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-3d5dda8c"]]);
1812
+
1813
+ const kdsLinkSize = {
1814
+ SMALL: "small",
1815
+ MEDIUM: "medium"
1816
+ };
1817
+ const kdsLinkSizes = Object.values(kdsLinkSize);
1811
1818
 
1812
1819
  const _sfc_main$1v = /* @__PURE__ */ defineComponent({
1813
1820
  __name: "KdsToggleButton",
@@ -4879,7 +4886,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
4879
4886
  }
4880
4887
  });
4881
4888
 
4882
- const BaseInput = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-2e12b7e4"]]);
4889
+ const BaseInput = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-a45e012a"]]);
4883
4890
 
4884
4891
  const _sfc_main$1c = /* @__PURE__ */ defineComponent({
4885
4892
  __name: "KdsTextInput",
@@ -7826,8 +7833,15 @@ const transformPropOrder = [
7826
7833
  ];
7827
7834
  /**
7828
7835
  * A quick lookup for transform props.
7836
+ *
7837
+ * `pathRotation` is a transform for routing purposes (skipped from raw
7838
+ * style application, wired to the transform composite, flags transform
7839
+ * dirty) but is intentionally NOT in `transformPropOrder` — it is
7840
+ * composed onto `rotate` at the build sites, not serialized in its own
7841
+ * slot, and must stay out of the order-array consumers (parse-transform,
7842
+ * unit-conversion, keys-position).
7829
7843
  */
7830
- const transformProps = /*@__PURE__*/ (() => new Set(transformPropOrder))();
7844
+ const transformProps = /*@__PURE__*/ (() => new Set([...transformPropOrder, "pathRotation"]))();
7831
7845
 
7832
7846
  const isNumOrPxType = (v) => v === number || v === px;
7833
7847
  const transformKeys = new Set(["x", "y", "z"]);
@@ -8796,339 +8810,74 @@ class GroupAnimationWithThen extends GroupAnimation {
8796
8810
  }
8797
8811
 
8798
8812
  /**
8799
- * Parse Framer's special CSS variable format into a CSS token and a fallback.
8800
- *
8801
- * ```
8802
- * `var(--foo, #fff)` => [`--foo`, '#fff']
8803
- * ```
8804
- *
8805
- * @param current
8806
- */
8807
- const splitCSSVariableRegex =
8808
- // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
8809
- /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
8810
- function parseCSSVariable(current) {
8811
- const match = splitCSSVariableRegex.exec(current);
8812
- if (!match)
8813
- return [,];
8814
- const [, token1, token2, fallback] = match;
8815
- return [`--${token1 ?? token2}`, fallback];
8816
- }
8817
- const maxDepth = 4;
8818
- function getVariableValue(current, element, depth = 1) {
8819
- invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
8820
- const [token, fallback] = parseCSSVariable(current);
8821
- // No CSS variable detected
8822
- if (!token)
8823
- return;
8824
- // Attempt to read this CSS variable off the element
8825
- const resolved = window.getComputedStyle(element).getPropertyValue(token);
8826
- if (resolved) {
8827
- const trimmed = resolved.trim();
8828
- return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
8829
- }
8830
- return isCSSVariableToken(fallback)
8831
- ? getVariableValue(fallback, element, depth + 1)
8832
- : fallback;
8833
- }
8834
-
8835
- const underDampedSpring = {
8836
- type: "spring",
8837
- stiffness: 500,
8838
- damping: 25,
8839
- restSpeed: 10,
8840
- };
8841
- const criticallyDampedSpring = (target) => ({
8842
- type: "spring",
8843
- stiffness: 550,
8844
- damping: target === 0 ? 2 * Math.sqrt(550) : 30,
8845
- restSpeed: 10,
8846
- });
8847
- const keyframesTransition = {
8848
- type: "keyframes",
8849
- duration: 0.8,
8850
- };
8851
- /**
8852
- * Default easing curve is a slightly shallower version of
8853
- * the default browser easing curve.
8813
+ * Maximum time between the value of two frames, beyond which we
8814
+ * assume the velocity has since been 0.
8854
8815
  */
8855
- const ease = {
8856
- type: "keyframes",
8857
- ease: [0.25, 0.1, 0.35, 1],
8858
- duration: 0.3,
8859
- };
8860
- const getDefaultTransition = (valueKey, { keyframes }) => {
8861
- if (keyframes.length > 2) {
8862
- return keyframesTransition;
8863
- }
8864
- else if (transformProps.has(valueKey)) {
8865
- return valueKey.startsWith("scale")
8866
- ? criticallyDampedSpring(keyframes[1])
8867
- : underDampedSpring;
8868
- }
8869
- return ease;
8816
+ const MAX_VELOCITY_DELTA = 30;
8817
+ const isFloat = (value) => {
8818
+ return !isNaN(parseFloat(value));
8870
8819
  };
8871
-
8872
- /**
8873
- * If `transition` has `inherit: true`, shallow-merge it with
8874
- * `parentTransition` (child keys win) and strip the `inherit` key.
8875
- * Otherwise return `transition` unchanged.
8876
- */
8877
- function resolveTransition(transition, parentTransition) {
8878
- if (transition?.inherit && parentTransition) {
8879
- const { inherit: _, ...rest } = transition;
8880
- return { ...parentTransition, ...rest };
8881
- }
8882
- return transition;
8883
- }
8884
-
8885
- function getValueTransition$1(transition, key) {
8886
- const valueTransition = transition?.[key] ??
8887
- transition?.["default"] ??
8888
- transition;
8889
- if (valueTransition !== transition) {
8890
- return resolveTransition(valueTransition, transition);
8891
- }
8892
- return valueTransition;
8893
- }
8894
-
8895
- const orchestrationKeys = new Set([
8896
- "when",
8897
- "delay",
8898
- "delayChildren",
8899
- "staggerChildren",
8900
- "staggerDirection",
8901
- "repeat",
8902
- "repeatType",
8903
- "repeatDelay",
8904
- "from",
8905
- "elapsed",
8906
- ]);
8907
8820
  /**
8908
- * Decide whether a transition is defined on a given Transition.
8909
- * This filters out orchestration options and returns true
8910
- * if any options are left.
8821
+ * `MotionValue` is used to track the state and velocity of motion values.
8822
+ *
8823
+ * @public
8911
8824
  */
8912
- function isTransitionDefined(transition) {
8913
- for (const key in transition) {
8914
- if (!orchestrationKeys.has(key))
8915
- return true;
8916
- }
8917
- return false;
8918
- }
8919
-
8920
- const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
8921
- const valueTransition = getValueTransition$1(transition, name) || {};
8922
- /**
8923
- * Most transition values are currently completely overwritten by value-specific
8924
- * transitions. In the future it'd be nicer to blend these transitions. But for now
8925
- * delay actually does inherit from the root transition if not value-specific.
8926
- */
8927
- const delay = valueTransition.delay || transition.delay || 0;
8928
- /**
8929
- * Elapsed isn't a public transition option but can be passed through from
8930
- * optimized appear effects in milliseconds.
8931
- */
8932
- let { elapsed = 0 } = transition;
8933
- elapsed = elapsed - secondsToMilliseconds(delay);
8934
- const options = {
8935
- keyframes: Array.isArray(target) ? target : [null, target],
8936
- ease: "easeOut",
8937
- velocity: value.getVelocity(),
8938
- ...valueTransition,
8939
- delay: -elapsed,
8940
- onUpdate: (v) => {
8941
- value.set(v);
8942
- valueTransition.onUpdate && valueTransition.onUpdate(v);
8943
- },
8944
- onComplete: () => {
8945
- onComplete();
8946
- valueTransition.onComplete && valueTransition.onComplete();
8947
- },
8948
- name,
8949
- motionValue: value,
8950
- element: isHandoff ? undefined : element,
8951
- };
8952
- /**
8953
- * If there's no transition defined for this value, we can generate
8954
- * unique transition settings for this value.
8955
- */
8956
- if (!isTransitionDefined(valueTransition)) {
8957
- Object.assign(options, getDefaultTransition(name, options));
8958
- }
8959
- /**
8960
- * Both WAAPI and our internal animation functions use durations
8961
- * as defined by milliseconds, while our external API defines them
8962
- * as seconds.
8963
- */
8964
- options.duration && (options.duration = secondsToMilliseconds(options.duration));
8965
- options.repeatDelay && (options.repeatDelay = secondsToMilliseconds(options.repeatDelay));
8825
+ class MotionValue {
8966
8826
  /**
8967
- * Support deprecated way to set initial value. Prefer keyframe syntax.
8827
+ * @param init - The initiating value
8828
+ * @param config - Optional configuration options
8829
+ *
8830
+ * - `transformer`: A function to transform incoming values with.
8968
8831
  */
8969
- if (options.from !== undefined) {
8970
- options.keyframes[0] = options.from;
8832
+ constructor(init, options = {}) {
8833
+ /**
8834
+ * Tracks whether this value can output a velocity. Currently this is only true
8835
+ * if the value is numerical, but we might be able to widen the scope here and support
8836
+ * other value types.
8837
+ *
8838
+ * @internal
8839
+ */
8840
+ this.canTrackVelocity = null;
8841
+ /**
8842
+ * An object containing a SubscriptionManager for each active event.
8843
+ */
8844
+ this.events = {};
8845
+ this.updateAndNotify = (v) => {
8846
+ const currentTime = time.now();
8847
+ /**
8848
+ * If we're updating the value during another frame or eventloop
8849
+ * than the previous frame, then the we set the previous frame value
8850
+ * to current.
8851
+ */
8852
+ if (this.updatedAt !== currentTime) {
8853
+ this.setPrevFrameValue();
8854
+ }
8855
+ this.prev = this.current;
8856
+ this.setCurrent(v);
8857
+ // Update update subscribers
8858
+ if (this.current !== this.prev) {
8859
+ this.events.change?.notify(this.current);
8860
+ if (this.dependents) {
8861
+ for (const dependent of this.dependents) {
8862
+ dependent.dirty();
8863
+ }
8864
+ }
8865
+ }
8866
+ };
8867
+ this.hasAnimated = false;
8868
+ this.setCurrent(init);
8869
+ this.owner = options.owner;
8971
8870
  }
8972
- let shouldSkip = false;
8973
- if (options.type === false ||
8974
- (options.duration === 0 && !options.repeatDelay)) {
8975
- makeAnimationInstant(options);
8976
- if (options.delay === 0) {
8977
- shouldSkip = true;
8871
+ setCurrent(current) {
8872
+ this.current = current;
8873
+ this.updatedAt = time.now();
8874
+ if (this.canTrackVelocity === null && current !== undefined) {
8875
+ this.canTrackVelocity = isFloat(this.current);
8978
8876
  }
8979
8877
  }
8980
- if (MotionGlobalConfig.instantAnimations ||
8981
- MotionGlobalConfig.skipAnimations ||
8982
- element?.shouldSkipAnimations ||
8983
- valueTransition.skipAnimations) {
8984
- shouldSkip = true;
8985
- makeAnimationInstant(options);
8986
- options.delay = 0;
8987
- }
8988
- /**
8989
- * If the transition type or easing has been explicitly set by the user
8990
- * then we don't want to allow flattening the animation.
8991
- */
8992
- options.allowFlatten = !valueTransition.type && !valueTransition.ease;
8993
- /**
8994
- * If we can or must skip creating the animation, and apply only
8995
- * the final keyframe, do so. We also check once keyframes are resolved but
8996
- * this early check prevents the need to create an animation at all.
8997
- */
8998
- if (shouldSkip && !isHandoff && value.get() !== undefined) {
8999
- const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
9000
- if (finalKeyframe !== undefined) {
9001
- frame.update(() => {
9002
- options.onUpdate(finalKeyframe);
9003
- options.onComplete();
9004
- });
9005
- return;
9006
- }
9007
- }
9008
- return valueTransition.isSync
9009
- ? new JSAnimation(options)
9010
- : new AsyncMotionValueAnimation(options);
9011
- };
9012
-
9013
- function getValueState(visualElement) {
9014
- const state = [{}, {}];
9015
- visualElement?.values.forEach((value, key) => {
9016
- state[0][key] = value.get();
9017
- state[1][key] = value.getVelocity();
9018
- });
9019
- return state;
9020
- }
9021
- function resolveVariantFromProps(props, definition, custom, visualElement) {
9022
- /**
9023
- * If the variant definition is a function, resolve.
9024
- */
9025
- if (typeof definition === "function") {
9026
- const [current, velocity] = getValueState(visualElement);
9027
- definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
9028
- }
9029
- /**
9030
- * If the variant definition is a variant label, or
9031
- * the function returned a variant label, resolve.
9032
- */
9033
- if (typeof definition === "string") {
9034
- definition = props.variants && props.variants[definition];
9035
- }
9036
- /**
9037
- * At this point we've resolved both functions and variant labels,
9038
- * but the resolved variant label might itself have been a function.
9039
- * If so, resolve. This can only have returned a valid target object.
9040
- */
9041
- if (typeof definition === "function") {
9042
- const [current, velocity] = getValueState(visualElement);
9043
- definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
9044
- }
9045
- return definition;
9046
- }
9047
-
9048
- function resolveVariant(visualElement, definition, custom) {
9049
- const props = visualElement.getProps();
9050
- return resolveVariantFromProps(props, definition, props.custom, visualElement);
9051
- }
9052
-
9053
- const positionalKeys = new Set([
9054
- "width",
9055
- "height",
9056
- "top",
9057
- "left",
9058
- "right",
9059
- "bottom",
9060
- ...transformPropOrder,
9061
- ]);
9062
-
9063
- /**
9064
- * Maximum time between the value of two frames, beyond which we
9065
- * assume the velocity has since been 0.
9066
- */
9067
- const MAX_VELOCITY_DELTA = 30;
9068
- const isFloat = (value) => {
9069
- return !isNaN(parseFloat(value));
9070
- };
9071
- /**
9072
- * `MotionValue` is used to track the state and velocity of motion values.
9073
- *
9074
- * @public
9075
- */
9076
- class MotionValue {
9077
- /**
9078
- * @param init - The initiating value
9079
- * @param config - Optional configuration options
9080
- *
9081
- * - `transformer`: A function to transform incoming values with.
9082
- */
9083
- constructor(init, options = {}) {
9084
- /**
9085
- * Tracks whether this value can output a velocity. Currently this is only true
9086
- * if the value is numerical, but we might be able to widen the scope here and support
9087
- * other value types.
9088
- *
9089
- * @internal
9090
- */
9091
- this.canTrackVelocity = null;
9092
- /**
9093
- * An object containing a SubscriptionManager for each active event.
9094
- */
9095
- this.events = {};
9096
- this.updateAndNotify = (v) => {
9097
- const currentTime = time.now();
9098
- /**
9099
- * If we're updating the value during another frame or eventloop
9100
- * than the previous frame, then the we set the previous frame value
9101
- * to current.
9102
- */
9103
- if (this.updatedAt !== currentTime) {
9104
- this.setPrevFrameValue();
9105
- }
9106
- this.prev = this.current;
9107
- this.setCurrent(v);
9108
- // Update update subscribers
9109
- if (this.current !== this.prev) {
9110
- this.events.change?.notify(this.current);
9111
- if (this.dependents) {
9112
- for (const dependent of this.dependents) {
9113
- dependent.dirty();
9114
- }
9115
- }
9116
- }
9117
- };
9118
- this.hasAnimated = false;
9119
- this.setCurrent(init);
9120
- this.owner = options.owner;
9121
- }
9122
- setCurrent(current) {
9123
- this.current = current;
9124
- this.updatedAt = time.now();
9125
- if (this.canTrackVelocity === null && current !== undefined) {
9126
- this.canTrackVelocity = isFloat(this.current);
9127
- }
9128
- }
9129
- setPrevFrameValue(prevFrameValue = this.current) {
9130
- this.prevFrameValue = prevFrameValue;
9131
- this.prevUpdatedAt = this.updatedAt;
8878
+ setPrevFrameValue(prevFrameValue = this.current) {
8879
+ this.prevFrameValue = prevFrameValue;
8880
+ this.prevUpdatedAt = this.updatedAt;
9132
8881
  }
9133
8882
  /**
9134
8883
  * Adds a function that will be notified when the `MotionValue` is updated.
@@ -9372,6 +9121,271 @@ function motionValue(init, options) {
9372
9121
  return new MotionValue(init, options);
9373
9122
  }
9374
9123
 
9124
+ /**
9125
+ * If `transition` has `inherit: true`, shallow-merge it with
9126
+ * `parentTransition` (child keys win) and strip the `inherit` key.
9127
+ * Otherwise return `transition` unchanged.
9128
+ */
9129
+ function resolveTransition(transition, parentTransition) {
9130
+ if (transition?.inherit && parentTransition) {
9131
+ const { inherit: _, ...rest } = transition;
9132
+ return { ...parentTransition, ...rest };
9133
+ }
9134
+ return transition;
9135
+ }
9136
+
9137
+ function getValueTransition$1(transition, key) {
9138
+ const valueTransition = transition?.[key] ??
9139
+ transition?.["default"] ??
9140
+ transition;
9141
+ if (valueTransition !== transition) {
9142
+ return resolveTransition(valueTransition, transition);
9143
+ }
9144
+ return valueTransition;
9145
+ }
9146
+
9147
+ const underDampedSpring = {
9148
+ type: "spring",
9149
+ stiffness: 500,
9150
+ damping: 25,
9151
+ restSpeed: 10,
9152
+ };
9153
+ const criticallyDampedSpring = (target) => ({
9154
+ type: "spring",
9155
+ stiffness: 550,
9156
+ damping: target === 0 ? 2 * Math.sqrt(550) : 30,
9157
+ restSpeed: 10,
9158
+ });
9159
+ const keyframesTransition = {
9160
+ type: "keyframes",
9161
+ duration: 0.8,
9162
+ };
9163
+ /**
9164
+ * Default easing curve is a slightly shallower version of
9165
+ * the default browser easing curve.
9166
+ */
9167
+ const ease = {
9168
+ type: "keyframes",
9169
+ ease: [0.25, 0.1, 0.35, 1],
9170
+ duration: 0.3,
9171
+ };
9172
+ const getDefaultTransition = (valueKey, { keyframes }) => {
9173
+ if (keyframes.length > 2) {
9174
+ return keyframesTransition;
9175
+ }
9176
+ else if (transformProps.has(valueKey)) {
9177
+ return valueKey.startsWith("scale")
9178
+ ? criticallyDampedSpring(keyframes[1])
9179
+ : underDampedSpring;
9180
+ }
9181
+ return ease;
9182
+ };
9183
+
9184
+ const orchestrationKeys = new Set([
9185
+ "when",
9186
+ "delay",
9187
+ "delayChildren",
9188
+ "staggerChildren",
9189
+ "staggerDirection",
9190
+ "repeat",
9191
+ "repeatType",
9192
+ "repeatDelay",
9193
+ "from",
9194
+ "elapsed",
9195
+ ]);
9196
+ /**
9197
+ * Decide whether a transition is defined on a given Transition.
9198
+ * This filters out orchestration options and returns true
9199
+ * if any options are left.
9200
+ */
9201
+ function isTransitionDefined(transition) {
9202
+ for (const key in transition) {
9203
+ if (!orchestrationKeys.has(key))
9204
+ return true;
9205
+ }
9206
+ return false;
9207
+ }
9208
+
9209
+ const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
9210
+ const valueTransition = getValueTransition$1(transition, name) || {};
9211
+ /**
9212
+ * Most transition values are currently completely overwritten by value-specific
9213
+ * transitions. In the future it'd be nicer to blend these transitions. But for now
9214
+ * delay actually does inherit from the root transition if not value-specific.
9215
+ */
9216
+ const delay = valueTransition.delay || transition.delay || 0;
9217
+ /**
9218
+ * Elapsed isn't a public transition option but can be passed through from
9219
+ * optimized appear effects in milliseconds.
9220
+ */
9221
+ let { elapsed = 0 } = transition;
9222
+ elapsed = elapsed - secondsToMilliseconds(delay);
9223
+ const options = {
9224
+ keyframes: Array.isArray(target) ? target : [null, target],
9225
+ ease: "easeOut",
9226
+ velocity: value.getVelocity(),
9227
+ ...valueTransition,
9228
+ delay: -elapsed,
9229
+ onUpdate: (v) => {
9230
+ value.set(v);
9231
+ valueTransition.onUpdate && valueTransition.onUpdate(v);
9232
+ },
9233
+ onComplete: () => {
9234
+ onComplete();
9235
+ valueTransition.onComplete && valueTransition.onComplete();
9236
+ },
9237
+ name,
9238
+ motionValue: value,
9239
+ element: isHandoff ? undefined : element,
9240
+ };
9241
+ /**
9242
+ * If there's no transition defined for this value, we can generate
9243
+ * unique transition settings for this value.
9244
+ */
9245
+ if (!isTransitionDefined(valueTransition)) {
9246
+ Object.assign(options, getDefaultTransition(name, options));
9247
+ }
9248
+ /**
9249
+ * Both WAAPI and our internal animation functions use durations
9250
+ * as defined by milliseconds, while our external API defines them
9251
+ * as seconds.
9252
+ */
9253
+ options.duration && (options.duration = secondsToMilliseconds(options.duration));
9254
+ options.repeatDelay && (options.repeatDelay = secondsToMilliseconds(options.repeatDelay));
9255
+ /**
9256
+ * Support deprecated way to set initial value. Prefer keyframe syntax.
9257
+ */
9258
+ if (options.from !== undefined) {
9259
+ options.keyframes[0] = options.from;
9260
+ }
9261
+ let shouldSkip = false;
9262
+ if (options.type === false ||
9263
+ (options.duration === 0 && !options.repeatDelay)) {
9264
+ makeAnimationInstant(options);
9265
+ if (options.delay === 0) {
9266
+ shouldSkip = true;
9267
+ }
9268
+ }
9269
+ if (MotionGlobalConfig.instantAnimations ||
9270
+ MotionGlobalConfig.skipAnimations ||
9271
+ element?.shouldSkipAnimations ||
9272
+ valueTransition.skipAnimations) {
9273
+ shouldSkip = true;
9274
+ makeAnimationInstant(options);
9275
+ options.delay = 0;
9276
+ }
9277
+ /**
9278
+ * If the transition type or easing has been explicitly set by the user
9279
+ * then we don't want to allow flattening the animation.
9280
+ */
9281
+ options.allowFlatten = !valueTransition.type && !valueTransition.ease;
9282
+ /**
9283
+ * If we can or must skip creating the animation, and apply only
9284
+ * the final keyframe, do so. We also check once keyframes are resolved but
9285
+ * this early check prevents the need to create an animation at all.
9286
+ */
9287
+ if (shouldSkip && !isHandoff && value.get() !== undefined) {
9288
+ const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
9289
+ if (finalKeyframe !== undefined) {
9290
+ frame.update(() => {
9291
+ options.onUpdate(finalKeyframe);
9292
+ options.onComplete();
9293
+ });
9294
+ return;
9295
+ }
9296
+ }
9297
+ return valueTransition.isSync
9298
+ ? new JSAnimation(options)
9299
+ : new AsyncMotionValueAnimation(options);
9300
+ };
9301
+
9302
+ /**
9303
+ * Parse Framer's special CSS variable format into a CSS token and a fallback.
9304
+ *
9305
+ * ```
9306
+ * `var(--foo, #fff)` => [`--foo`, '#fff']
9307
+ * ```
9308
+ *
9309
+ * @param current
9310
+ */
9311
+ const splitCSSVariableRegex =
9312
+ // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
9313
+ /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
9314
+ function parseCSSVariable(current) {
9315
+ const match = splitCSSVariableRegex.exec(current);
9316
+ if (!match)
9317
+ return [,];
9318
+ const [, token1, token2, fallback] = match;
9319
+ return [`--${token1 ?? token2}`, fallback];
9320
+ }
9321
+ const maxDepth = 4;
9322
+ function getVariableValue(current, element, depth = 1) {
9323
+ invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
9324
+ const [token, fallback] = parseCSSVariable(current);
9325
+ // No CSS variable detected
9326
+ if (!token)
9327
+ return;
9328
+ // Attempt to read this CSS variable off the element
9329
+ const resolved = window.getComputedStyle(element).getPropertyValue(token);
9330
+ if (resolved) {
9331
+ const trimmed = resolved.trim();
9332
+ return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
9333
+ }
9334
+ return isCSSVariableToken(fallback)
9335
+ ? getVariableValue(fallback, element, depth + 1)
9336
+ : fallback;
9337
+ }
9338
+
9339
+ function getValueState(visualElement) {
9340
+ const state = [{}, {}];
9341
+ visualElement?.values.forEach((value, key) => {
9342
+ state[0][key] = value.get();
9343
+ state[1][key] = value.getVelocity();
9344
+ });
9345
+ return state;
9346
+ }
9347
+ function resolveVariantFromProps(props, definition, custom, visualElement) {
9348
+ /**
9349
+ * If the variant definition is a function, resolve.
9350
+ */
9351
+ if (typeof definition === "function") {
9352
+ const [current, velocity] = getValueState(visualElement);
9353
+ definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
9354
+ }
9355
+ /**
9356
+ * If the variant definition is a variant label, or
9357
+ * the function returned a variant label, resolve.
9358
+ */
9359
+ if (typeof definition === "string") {
9360
+ definition = props.variants && props.variants[definition];
9361
+ }
9362
+ /**
9363
+ * At this point we've resolved both functions and variant labels,
9364
+ * but the resolved variant label might itself have been a function.
9365
+ * If so, resolve. This can only have returned a valid target object.
9366
+ */
9367
+ if (typeof definition === "function") {
9368
+ const [current, velocity] = getValueState(visualElement);
9369
+ definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
9370
+ }
9371
+ return definition;
9372
+ }
9373
+
9374
+ function resolveVariant(visualElement, definition, custom) {
9375
+ const props = visualElement.getProps();
9376
+ return resolveVariantFromProps(props, definition, props.custom, visualElement);
9377
+ }
9378
+
9379
+ const positionalKeys = new Set([
9380
+ "width",
9381
+ "height",
9382
+ "top",
9383
+ "left",
9384
+ "right",
9385
+ "bottom",
9386
+ ...transformPropOrder,
9387
+ ]);
9388
+
9375
9389
  const isKeyframesTarget = (v) => {
9376
9390
  return Array.isArray(v);
9377
9391
  };
@@ -9460,6 +9474,11 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
9460
9474
  const animationTypeState = type &&
9461
9475
  visualElement.animationState &&
9462
9476
  visualElement.animationState.getState()[type];
9477
+ const path = transition?.path;
9478
+ if (path) {
9479
+ // path mutates `target` to claim x/y; loop below skips them.
9480
+ path.animateVisualElement(visualElement, target, transition, delay, animations);
9481
+ }
9463
9482
  for (const key in target) {
9464
9483
  const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);
9465
9484
  const valueTarget = target[key];
@@ -9603,6 +9622,12 @@ const int = {
9603
9622
 
9604
9623
  const transformValueTypes = {
9605
9624
  rotate: degrees,
9625
+ /**
9626
+ * Internal channel for `transition.path` orientToPath. Composed onto
9627
+ * `rotate` at the transform-build sites so the user's `rotate` is
9628
+ * never read or overwritten. Not part of `transformPropOrder`.
9629
+ */
9630
+ pathRotation: degrees,
9606
9631
  rotateX: degrees,
9607
9632
  rotateY: degrees,
9608
9633
  rotateZ: degrees,
@@ -10694,6 +10719,14 @@ function buildTransform(latestValues, transform, transformTemplate) {
10694
10719
  }
10695
10720
  }
10696
10721
  }
10722
+ // `pathRotation` composes onto `rotate` as a separate additive term so
10723
+ // the user's `rotate` is never clobbered. Deliberately not a slot in
10724
+ // `transformPropOrder`.
10725
+ const pathRotation = latestValues.pathRotation;
10726
+ if (pathRotation) {
10727
+ transformIsDefault = false;
10728
+ transformString += `rotate(${getValueAsType(pathRotation, numberValueTypes.pathRotation)}) `;
10729
+ }
10697
10730
  transformString = transformString.trim();
10698
10731
  // If we have a custom `transform` template, pass our transform values and
10699
10732
  // generated transformString to that before returning
@@ -26903,5 +26936,5 @@ const useKdsLegacyMode = (initialValue = false) => {
26903
26936
  };
26904
26937
  };
26905
26938
 
26906
- export { KdsAccordion, KdsAvatar, KdsAvatarCounter, KdsBadge, KdsBreadcrumb, _sfc_main$1y as KdsButton, _sfc_main$f as KdsCard, _sfc_main$15 as KdsCheckbox, KdsCheckboxGroup, KdsClickableCard, _sfc_main$S as KdsColorInput, KdsColorSwatch, _sfc_main$1h as KdsContextMenu, KdsDataType, _sfc_main$L as KdsDateInput, _sfc_main$J as KdsDateTimeFormatInput, KdsDateTimeInput, KdsDescription, KdsDivider, KdsDonutChart, _sfc_main$y as KdsDropdown, KdsDynamicModalProvider, KdsEmptyState, KdsFileExplorer, KdsIcon, KdsInfoToggleButton, KdsInlineMessage, _sfc_main$C as KdsIntervalInput, KdsLabel, KdsLink, _sfc_main$1x as KdsLinkButton, KdsLinkCard, KdsListContainer, KdsLiveStatus, KdsLoadingSkeleton, KdsLoadingSpinner, _sfc_main$1i as KdsMenu, _sfc_main$1n as KdsMenuButton, KdsMissingValueIcon, KdsModal, KdsModalLayout, _sfc_main$u as KdsMultiSelectDropdown, KdsNavItem, KdsNavigation, _sfc_main$V as KdsNumberInput, KdsPanel, _sfc_main$R as KdsPasswordInput, _sfc_main$I as KdsPatternInput, KdsPopover, KdsPreviewList, KdsProgressBar, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, KdsResponsiveButtonGroup, KdsSearchInput, KdsSelectableCard, KdsSideDrawer, KdsSortableListBox, KdsSplitButton, KdsSubText, KdsTabBar, KdsTextInput, KdsTextarea, _sfc_main$E as KdsTimeInput, _sfc_main$1v as KdsToggleButton, KdsToggleSwitch, KdsTwinList, _sfc_main$Q as KdsUsernameInput, KdsValueSwitch, KdsVariableToggleButton, KdsZonedDateTimeInput, kdsActionButtonType, kdsActionButtonTypes, kdsAvatarSize, kdsAvatarSizes, kdsBadgeSize, kdsBadgeSizes, kdsBadgeVariant, kdsBadgeVariants, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsDateFormatCategories, kdsDateFormatCategory, kdsFileExplorerDraggingAnimationMode, kdsFileExplorerDraggingAnimationModes, kdsFileExplorerSize, kdsFileExplorerSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsInlineMessageVariant, kdsInlineMessageVariants, kdsIntervalDirectionalities, kdsIntervalDirectionality, kdsIntervalInputFormat, kdsIntervalInputFormats, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSkeletonVariant, kdsLoadingSkeletonVariants, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPanelBodyOverflow, kdsPanelBodyOverflows, kdsPanelBodyVariant, kdsPanelBodyVariants, kdsPasswordInputAutocomplete, kdsPasswordInputAutocompletes, kdsPasswordInputVariant, kdsPasswordInputVariants, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsPopoverType, kdsPopoverTypes, kdsProgressBarSize, kdsProgressBarSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsResponsiveButtonGroupAlignment, kdsResponsiveButtonGroupAlignments, kdsTabBarSize, kdsTabBarSizes, kdsTemporalType, kdsTemporalTypes, kdsTimeInputGranularities, kdsTimeInputGranularity, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsToggleSwitchLabelPosition, kdsToggleSwitchLabelPositions, kdsToggleSwitchSize, kdsToggleSwitchSizes, kdsTwinListSearchMode, kdsTwinListSearchModes, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsUsernameInputAutocomplete, kdsUsernameInputAutocompletes, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode, vKdsTooltip };
26939
+ export { KdsAccordion, KdsAvatar, KdsAvatarCounter, KdsBadge, KdsBreadcrumb, _sfc_main$1y as KdsButton, _sfc_main$f as KdsCard, _sfc_main$15 as KdsCheckbox, KdsCheckboxGroup, KdsClickableCard, _sfc_main$S as KdsColorInput, KdsColorSwatch, _sfc_main$1h as KdsContextMenu, KdsDataType, _sfc_main$L as KdsDateInput, _sfc_main$J as KdsDateTimeFormatInput, KdsDateTimeInput, KdsDescription, KdsDivider, KdsDonutChart, _sfc_main$y as KdsDropdown, KdsDynamicModalProvider, KdsEmptyState, KdsFileExplorer, KdsIcon, KdsInfoToggleButton, KdsInlineMessage, _sfc_main$C as KdsIntervalInput, KdsLabel, KdsLink, _sfc_main$1x as KdsLinkButton, KdsLinkCard, KdsListContainer, KdsLiveStatus, KdsLoadingSkeleton, KdsLoadingSpinner, _sfc_main$1i as KdsMenu, _sfc_main$1n as KdsMenuButton, KdsMissingValueIcon, KdsModal, KdsModalLayout, _sfc_main$u as KdsMultiSelectDropdown, KdsNavItem, KdsNavigation, _sfc_main$V as KdsNumberInput, KdsPanel, _sfc_main$R as KdsPasswordInput, _sfc_main$I as KdsPatternInput, KdsPopover, KdsPreviewList, KdsProgressBar, KdsProgressButton, KdsRadioButton, KdsRadioButtonGroup, KdsResponsiveButtonGroup, KdsSearchInput, KdsSelectableCard, KdsSideDrawer, KdsSortableListBox, KdsSplitButton, KdsSubText, KdsTabBar, KdsTextInput, KdsTextarea, _sfc_main$E as KdsTimeInput, _sfc_main$1v as KdsToggleButton, KdsToggleSwitch, KdsTwinList, _sfc_main$Q as KdsUsernameInput, KdsValueSwitch, KdsVariableToggleButton, KdsZonedDateTimeInput, kdsActionButtonType, kdsActionButtonTypes, kdsAvatarSize, kdsAvatarSizes, kdsBadgeSize, kdsBadgeSizes, kdsBadgeVariant, kdsBadgeVariants, kdsButtonSize, kdsButtonSizes, kdsButtonVariant, kdsButtonVariants, kdsCardVariant, kdsCardVariants, kdsCheckboxGroupAlignment, kdsCheckboxGroupAlignments, kdsCheckboxValue, kdsCheckboxValues, kdsColorSwatchSize, kdsColorSwatchSizes, kdsColorSwatchType, kdsColorSwatchTypes, kdsDarkModeType, kdsDarkModeTypes, kdsDataTypeSize, kdsDataTypeSizes, kdsDateFormatCategories, kdsDateFormatCategory, kdsFileExplorerDraggingAnimationMode, kdsFileExplorerDraggingAnimationModes, kdsFileExplorerSize, kdsFileExplorerSizes, kdsIconName, iconNames as kdsIconNames, kdsIconSize, kdsIconSizes, kdsInlineMessageVariant, kdsInlineMessageVariants, kdsIntervalDirectionalities, kdsIntervalDirectionality, kdsIntervalInputFormat, kdsIntervalInputFormats, kdsLinkSize, kdsLinkSizes, kdsLiveStatusSize, kdsLiveStatusSizes, kdsLiveStatusStatus, kdsLiveStatusStatuses, kdsLoadingSkeletonVariant, kdsLoadingSkeletonVariants, kdsLoadingSpinnerVariant, kdsLoadingSpinnerVariants, kdsModalClosedBy, kdsModalClosedByOptions, kdsModalHeight, kdsModalHeightSizes, kdsModalVariant, kdsModalVariants, kdsModalWidth, kdsModalWidthSizes, kdsPanelBodyOverflow, kdsPanelBodyOverflows, kdsPanelBodyVariant, kdsPanelBodyVariants, kdsPasswordInputAutocomplete, kdsPasswordInputAutocompletes, kdsPasswordInputVariant, kdsPasswordInputVariants, kdsPopoverPlacement, kdsPopoverPlacements, kdsPopoverRole, kdsPopoverRoles, kdsPopoverType, kdsPopoverTypes, kdsProgressBarSize, kdsProgressBarSizes, kdsProgressButtonState, kdsProgressButtonStates, kdsRadioButtonGroupAlignment, kdsRadioButtonGroupAlignments, kdsResponsiveButtonGroupAlignment, kdsResponsiveButtonGroupAlignments, kdsTabBarSize, kdsTabBarSizes, kdsTemporalType, kdsTemporalTypes, kdsTimeInputGranularities, kdsTimeInputGranularity, kdsToggleButtonVariant, kdsToggleButtonVariants, kdsToggleSwitchLabelPosition, kdsToggleSwitchLabelPositions, kdsToggleSwitchSize, kdsToggleSwitchSizes, kdsTwinListSearchMode, kdsTwinListSearchModes, kdsTypeIconName, typeIconNames as kdsTypeIconNames, kdsUsernameInputAutocomplete, kdsUsernameInputAutocompletes, kdsValueSwitchSize, kdsValueSwitchSizes, kdsValueSwitchVariant, kdsValueSwitchVariants, useKdsDarkMode, useKdsDynamicModal, useKdsIsTruncated, useKdsLegacyMode, vKdsTooltip };
26907
26940
  //# sourceMappingURL=index.js.map