@fiddle-digital/string-tune 1.2.0 → 1.2.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -763,7 +763,7 @@ declare class LerpTool implements IStringTool<LerpInput, number> {
763
763
  */
764
764
  interface UnitParserInput {
765
765
  /** Unit string, e.g. `"20px"`, `"50%"`, `"1.5rem"`, or `"selfHeight"` */
766
- value: string;
766
+ value: string | number;
767
767
  /** DOM element used for `"selfHeight"` calculation */
768
768
  element: HTMLElement;
769
769
  /** Viewport height in pixels (for percentage conversion) */
@@ -1066,6 +1066,7 @@ interface ISplitOptionItem {
1066
1066
  * Holds arrays of option definitions for each split type.
1067
1067
  */
1068
1068
  interface ISplitOptions {
1069
+ segment?: "legacy" | "visual";
1069
1070
  fit?: boolean;
1070
1071
  trimInlineGaps?: boolean;
1071
1072
  line?: ISplitOptionItem[];
@@ -1091,6 +1092,7 @@ declare class SplitOptionsParserTool implements IStringTool<SplitOptionsParserIn
1091
1092
  process({ attributeValue }: SplitOptionsParserInput): ISplitOptions;
1092
1093
  private toCamelCase;
1093
1094
  private parseParamsArray;
1095
+ private parseSegmentMode;
1094
1096
  }
1095
1097
 
1096
1098
  interface RuleParserInput {
@@ -1244,6 +1246,23 @@ type AttributeMapping = {
1244
1246
  transform?: (value: any) => any;
1245
1247
  };
1246
1248
 
1249
+ type StringSignalValue = number | boolean | string | null;
1250
+ declare class StringSignalHub {
1251
+ private readonly emit;
1252
+ private values;
1253
+ constructor(emit: (eventName: string, payload?: any) => void);
1254
+ publish(objectId: string, signal: string, value: StringSignalValue): void;
1255
+ subscribe(objectId: string, signal: string, events: {
1256
+ on<T = any>(eventName: string, callback: EventCallback<T>, id?: string | null): void;
1257
+ }, callback: EventCallback<StringSignalValue>): void;
1258
+ unsubscribe(objectId: string, signal: string, events: {
1259
+ off<T = any>(eventName: string, callback: EventCallback<T>, id?: string): void;
1260
+ }, callback: EventCallback<StringSignalValue>): void;
1261
+ get(objectId: string, signal: string): StringSignalValue | undefined;
1262
+ getEventName(objectId: string, signal: string): string;
1263
+ private getKey;
1264
+ }
1265
+
1247
1266
  interface ParseContext {
1248
1267
  element?: HTMLElement;
1249
1268
  boundingRect?: DOMRect;
@@ -1341,6 +1360,7 @@ declare class StringModule implements IStringModule {
1341
1360
  * Object manager for layout refreshes and in-view recalculation.
1342
1361
  */
1343
1362
  protected objectManager: ObjectManager;
1363
+ protected signals: StringSignalHub;
1344
1364
  permissions: ModuleLifecyclePermissions;
1345
1365
  constructor(context: StringContext);
1346
1366
  /**
@@ -1383,7 +1403,7 @@ declare class StringModule implements IStringModule {
1383
1403
  * @param context Optional helper values like element or viewport size.
1384
1404
  * @returns The parsed and transformed value.
1385
1405
  */
1386
- protected parseAttribute(value: string | null, type: AttributeType, context?: ParseContext): any;
1406
+ protected parseAttribute(value: string | number | null, type: AttributeType, context?: ParseContext): any;
1387
1407
  /**
1388
1408
  * Determines whether the module should attach to a given object,
1389
1409
  * based on the presence of the module's `htmlKey` in the object keys.
@@ -1474,6 +1494,8 @@ declare class StringModule implements IStringModule {
1474
1494
  * Returns a cached per-object event name to avoid building strings in hot paths.
1475
1495
  */
1476
1496
  protected getObjectEventName(object: StringObject, prefix: string, suffix?: string): string;
1497
+ protected emitSignal(object: StringObject, signal: string, value: StringSignalValue): void;
1498
+ protected getSignal(objectId: string, signal: string): StringSignalValue | undefined;
1477
1499
  protected clearManagedStyles(object: StringObject): void;
1478
1500
  protected onObjectModeActivated(object: StringObject): void;
1479
1501
  protected onObjectModeDeactivated(object: StringObject): void;
@@ -1706,6 +1728,10 @@ interface StringContext {
1706
1728
  * Manages all interactive objects (elements with `string-*` attributes).
1707
1729
  */
1708
1730
  objectManager: ObjectManager;
1731
+ /**
1732
+ * Lightweight stateful signal transport for object-scoped values.
1733
+ */
1734
+ signals: StringSignalHub;
1709
1735
  }
1710
1736
 
1711
1737
  /**
@@ -1799,6 +1825,27 @@ declare class StringImpulse extends StringModule {
1799
1825
  onMutate(): void;
1800
1826
  }
1801
1827
 
1828
+ declare class StringMarquee extends StringModule {
1829
+ private onFontsReadyBound;
1830
+ constructor(context: StringContext);
1831
+ onInit(): void;
1832
+ onUnsubscribe(): void;
1833
+ onObjectConnected(object: StringObject): void;
1834
+ onObjectDisconnected(object: StringObject): void;
1835
+ onResizeWidth(): void;
1836
+ onFrame(data: StringData): void;
1837
+ private createState;
1838
+ private mountStructure;
1839
+ private syncConfig;
1840
+ private refresh;
1841
+ private syncCopies;
1842
+ private syncPartClass;
1843
+ private updatePartProgress;
1844
+ private onFontsReady;
1845
+ private onMouseEnter;
1846
+ private onMouseLeave;
1847
+ }
1848
+
1802
1849
  declare class StringMasonry extends StringModule {
1803
1850
  private states;
1804
1851
  constructor(context: StringContext);
@@ -2605,6 +2652,16 @@ declare class StringProgressPart extends StringModule {
2605
2652
  onObjectDisconnected(object: StringObject): void;
2606
2653
  }
2607
2654
 
2655
+ declare class StringSignal extends StringModule {
2656
+ constructor(context: StringContext);
2657
+ onObjectConnected(object: StringObject): void;
2658
+ onObjectDisconnected(object: StringObject): void;
2659
+ private applyRuleState;
2660
+ private applyEffectState;
2661
+ private applyEffect;
2662
+ private resetEffect;
2663
+ }
2664
+
2608
2665
  type Job = () => void;
2609
2666
  declare class FrameDOM {
2610
2667
  private measureQueue;
@@ -3699,6 +3756,7 @@ declare class StringTune {
3699
3756
  private observerContainerMutation;
3700
3757
  private pendingResizeRaf;
3701
3758
  private pendingResizeForce;
3759
+ private activeScrollIntent;
3702
3760
  /** Singleton instance of StringTune */
3703
3761
  private static i;
3704
3762
  /** Root scrollable element (typically <body>) */
@@ -3717,6 +3775,7 @@ declare class StringTune {
3717
3775
  private objectManager;
3718
3776
  /** Central event manager for internal pub-sub logic */
3719
3777
  private eventManager;
3778
+ private signalHub;
3720
3779
  /** Handles custom cursor logic (if enabled) */
3721
3780
  private cursorController;
3722
3781
  /** Provides default utility tools (parsers, interpolation, etc.) */
@@ -3972,7 +4031,9 @@ declare class StringTune {
3972
4031
  }): void;
3973
4032
  private resolveScrollToValue;
3974
4033
  private resolveElementScrollPosition;
4034
+ private resolveScrollIntentPosition;
4035
+ private clearActiveScrollIntent;
3975
4036
  destroy(): void;
3976
4037
  }
3977
4038
 
3978
- export { CursorReactiveModule, DOMBatcher, GridAdapter, type RulersLayoutGrid, type RulersTriggerAction, ScrollController, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringDevIconRegistry, StringDevInview, StringDevLayout, StringDevModule, StringDevOverlayRegistry, StringDevProgress, StringDevRulers, type StringDevStyleTokens, type StringDevtoolDefinition, type StringDevtoolProvider, type StringDevtoolState, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringMasonry, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringRandom, StringResponsive, type StringRulersTrigger, StringScrollContainer, StringScrollbar, StringScroller, StringSequence, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, buildDevtoolsThemeBlock, StringTune as default, ensureStringDevtoolsSharedStyles, frameDOM, resolveDevtoolsIcon, styleTxn };
4039
+ export { CursorReactiveModule, DOMBatcher, GridAdapter, type RulersLayoutGrid, type RulersTriggerAction, ScrollController, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringDevIconRegistry, StringDevInview, StringDevLayout, StringDevModule, StringDevOverlayRegistry, StringDevProgress, StringDevRulers, type StringDevStyleTokens, type StringDevtoolDefinition, type StringDevtoolProvider, type StringDevtoolState, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringMarquee, StringMasonry, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringRandom, StringResponsive, type StringRulersTrigger, StringScrollContainer, StringScrollbar, StringScroller, StringSequence, StringSignal, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, buildDevtoolsThemeBlock, StringTune as default, ensureStringDevtoolsSharedStyles, frameDOM, resolveDevtoolsIcon, styleTxn };
package/dist/index.d.ts CHANGED
@@ -763,7 +763,7 @@ declare class LerpTool implements IStringTool<LerpInput, number> {
763
763
  */
764
764
  interface UnitParserInput {
765
765
  /** Unit string, e.g. `"20px"`, `"50%"`, `"1.5rem"`, or `"selfHeight"` */
766
- value: string;
766
+ value: string | number;
767
767
  /** DOM element used for `"selfHeight"` calculation */
768
768
  element: HTMLElement;
769
769
  /** Viewport height in pixels (for percentage conversion) */
@@ -1066,6 +1066,7 @@ interface ISplitOptionItem {
1066
1066
  * Holds arrays of option definitions for each split type.
1067
1067
  */
1068
1068
  interface ISplitOptions {
1069
+ segment?: "legacy" | "visual";
1069
1070
  fit?: boolean;
1070
1071
  trimInlineGaps?: boolean;
1071
1072
  line?: ISplitOptionItem[];
@@ -1091,6 +1092,7 @@ declare class SplitOptionsParserTool implements IStringTool<SplitOptionsParserIn
1091
1092
  process({ attributeValue }: SplitOptionsParserInput): ISplitOptions;
1092
1093
  private toCamelCase;
1093
1094
  private parseParamsArray;
1095
+ private parseSegmentMode;
1094
1096
  }
1095
1097
 
1096
1098
  interface RuleParserInput {
@@ -1244,6 +1246,23 @@ type AttributeMapping = {
1244
1246
  transform?: (value: any) => any;
1245
1247
  };
1246
1248
 
1249
+ type StringSignalValue = number | boolean | string | null;
1250
+ declare class StringSignalHub {
1251
+ private readonly emit;
1252
+ private values;
1253
+ constructor(emit: (eventName: string, payload?: any) => void);
1254
+ publish(objectId: string, signal: string, value: StringSignalValue): void;
1255
+ subscribe(objectId: string, signal: string, events: {
1256
+ on<T = any>(eventName: string, callback: EventCallback<T>, id?: string | null): void;
1257
+ }, callback: EventCallback<StringSignalValue>): void;
1258
+ unsubscribe(objectId: string, signal: string, events: {
1259
+ off<T = any>(eventName: string, callback: EventCallback<T>, id?: string): void;
1260
+ }, callback: EventCallback<StringSignalValue>): void;
1261
+ get(objectId: string, signal: string): StringSignalValue | undefined;
1262
+ getEventName(objectId: string, signal: string): string;
1263
+ private getKey;
1264
+ }
1265
+
1247
1266
  interface ParseContext {
1248
1267
  element?: HTMLElement;
1249
1268
  boundingRect?: DOMRect;
@@ -1341,6 +1360,7 @@ declare class StringModule implements IStringModule {
1341
1360
  * Object manager for layout refreshes and in-view recalculation.
1342
1361
  */
1343
1362
  protected objectManager: ObjectManager;
1363
+ protected signals: StringSignalHub;
1344
1364
  permissions: ModuleLifecyclePermissions;
1345
1365
  constructor(context: StringContext);
1346
1366
  /**
@@ -1383,7 +1403,7 @@ declare class StringModule implements IStringModule {
1383
1403
  * @param context Optional helper values like element or viewport size.
1384
1404
  * @returns The parsed and transformed value.
1385
1405
  */
1386
- protected parseAttribute(value: string | null, type: AttributeType, context?: ParseContext): any;
1406
+ protected parseAttribute(value: string | number | null, type: AttributeType, context?: ParseContext): any;
1387
1407
  /**
1388
1408
  * Determines whether the module should attach to a given object,
1389
1409
  * based on the presence of the module's `htmlKey` in the object keys.
@@ -1474,6 +1494,8 @@ declare class StringModule implements IStringModule {
1474
1494
  * Returns a cached per-object event name to avoid building strings in hot paths.
1475
1495
  */
1476
1496
  protected getObjectEventName(object: StringObject, prefix: string, suffix?: string): string;
1497
+ protected emitSignal(object: StringObject, signal: string, value: StringSignalValue): void;
1498
+ protected getSignal(objectId: string, signal: string): StringSignalValue | undefined;
1477
1499
  protected clearManagedStyles(object: StringObject): void;
1478
1500
  protected onObjectModeActivated(object: StringObject): void;
1479
1501
  protected onObjectModeDeactivated(object: StringObject): void;
@@ -1706,6 +1728,10 @@ interface StringContext {
1706
1728
  * Manages all interactive objects (elements with `string-*` attributes).
1707
1729
  */
1708
1730
  objectManager: ObjectManager;
1731
+ /**
1732
+ * Lightweight stateful signal transport for object-scoped values.
1733
+ */
1734
+ signals: StringSignalHub;
1709
1735
  }
1710
1736
 
1711
1737
  /**
@@ -1799,6 +1825,27 @@ declare class StringImpulse extends StringModule {
1799
1825
  onMutate(): void;
1800
1826
  }
1801
1827
 
1828
+ declare class StringMarquee extends StringModule {
1829
+ private onFontsReadyBound;
1830
+ constructor(context: StringContext);
1831
+ onInit(): void;
1832
+ onUnsubscribe(): void;
1833
+ onObjectConnected(object: StringObject): void;
1834
+ onObjectDisconnected(object: StringObject): void;
1835
+ onResizeWidth(): void;
1836
+ onFrame(data: StringData): void;
1837
+ private createState;
1838
+ private mountStructure;
1839
+ private syncConfig;
1840
+ private refresh;
1841
+ private syncCopies;
1842
+ private syncPartClass;
1843
+ private updatePartProgress;
1844
+ private onFontsReady;
1845
+ private onMouseEnter;
1846
+ private onMouseLeave;
1847
+ }
1848
+
1802
1849
  declare class StringMasonry extends StringModule {
1803
1850
  private states;
1804
1851
  constructor(context: StringContext);
@@ -2605,6 +2652,16 @@ declare class StringProgressPart extends StringModule {
2605
2652
  onObjectDisconnected(object: StringObject): void;
2606
2653
  }
2607
2654
 
2655
+ declare class StringSignal extends StringModule {
2656
+ constructor(context: StringContext);
2657
+ onObjectConnected(object: StringObject): void;
2658
+ onObjectDisconnected(object: StringObject): void;
2659
+ private applyRuleState;
2660
+ private applyEffectState;
2661
+ private applyEffect;
2662
+ private resetEffect;
2663
+ }
2664
+
2608
2665
  type Job = () => void;
2609
2666
  declare class FrameDOM {
2610
2667
  private measureQueue;
@@ -3699,6 +3756,7 @@ declare class StringTune {
3699
3756
  private observerContainerMutation;
3700
3757
  private pendingResizeRaf;
3701
3758
  private pendingResizeForce;
3759
+ private activeScrollIntent;
3702
3760
  /** Singleton instance of StringTune */
3703
3761
  private static i;
3704
3762
  /** Root scrollable element (typically <body>) */
@@ -3717,6 +3775,7 @@ declare class StringTune {
3717
3775
  private objectManager;
3718
3776
  /** Central event manager for internal pub-sub logic */
3719
3777
  private eventManager;
3778
+ private signalHub;
3720
3779
  /** Handles custom cursor logic (if enabled) */
3721
3780
  private cursorController;
3722
3781
  /** Provides default utility tools (parsers, interpolation, etc.) */
@@ -3972,7 +4031,9 @@ declare class StringTune {
3972
4031
  }): void;
3973
4032
  private resolveScrollToValue;
3974
4033
  private resolveElementScrollPosition;
4034
+ private resolveScrollIntentPosition;
4035
+ private clearActiveScrollIntent;
3975
4036
  destroy(): void;
3976
4037
  }
3977
4038
 
3978
- export { CursorReactiveModule, DOMBatcher, GridAdapter, type RulersLayoutGrid, type RulersTriggerAction, ScrollController, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringDevIconRegistry, StringDevInview, StringDevLayout, StringDevModule, StringDevOverlayRegistry, StringDevProgress, StringDevRulers, type StringDevStyleTokens, type StringDevtoolDefinition, type StringDevtoolProvider, type StringDevtoolState, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringMasonry, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringRandom, StringResponsive, type StringRulersTrigger, StringScrollContainer, StringScrollbar, StringScroller, StringSequence, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, buildDevtoolsThemeBlock, StringTune as default, ensureStringDevtoolsSharedStyles, frameDOM, resolveDevtoolsIcon, styleTxn };
4039
+ export { CursorReactiveModule, DOMBatcher, GridAdapter, type RulersLayoutGrid, type RulersTriggerAction, ScrollController, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringDevIconRegistry, StringDevInview, StringDevLayout, StringDevModule, StringDevOverlayRegistry, StringDevProgress, StringDevRulers, type StringDevStyleTokens, type StringDevtoolDefinition, type StringDevtoolProvider, type StringDevtoolState, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringMarquee, StringMasonry, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringRandom, StringResponsive, type StringRulersTrigger, StringScrollContainer, StringScrollbar, StringScroller, StringSequence, StringSignal, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, buildDevtoolsThemeBlock, StringTune as default, ensureStringDevtoolsSharedStyles, frameDOM, resolveDevtoolsIcon, styleTxn };