@blorkfield/overlay-core 0.8.7 → 0.8.9
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/README.md +191 -10
- package/dist/index.cjs +21 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -4
- package/dist/index.d.ts +28 -4
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -148,7 +148,7 @@ interface DespawnEffectConfig {
|
|
|
148
148
|
* Unified configuration for spawning scene objects.
|
|
149
149
|
* Objects are configured via tags that define their behavior:
|
|
150
150
|
* - 'falling': Object is dynamic and affected by gravity (without this tag, object is static)
|
|
151
|
-
* - '
|
|
151
|
+
* - 'follow_window': Object follows mouse position when grounded within the canvas window
|
|
152
152
|
* - 'grabable': Object can be dragged via mouse constraint
|
|
153
153
|
*/
|
|
154
154
|
interface ObjectConfig {
|
|
@@ -625,8 +625,8 @@ declare class OverlayScene {
|
|
|
625
625
|
* Spawn an object synchronously.
|
|
626
626
|
* Object behavior is determined by tags:
|
|
627
627
|
* - 'falling': Object is dynamic (affected by gravity)
|
|
628
|
-
* - '
|
|
629
|
-
* - 'grabable': Object can be
|
|
628
|
+
* - 'follow_window': Object follows mouse when grounded (walks toward mouse)
|
|
629
|
+
* - 'grabable': Object can be grabbed and moved with mouse
|
|
630
630
|
* Without 'falling' tag, object is static.
|
|
631
631
|
*/
|
|
632
632
|
spawnObject(config: ObjectConfig): string;
|
|
@@ -1103,4 +1103,28 @@ declare class BackgroundManager {
|
|
|
1103
1103
|
static clearCache(): void;
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
-
|
|
1106
|
+
/**
|
|
1107
|
+
* Tag constants for object behavior.
|
|
1108
|
+
* Use these instead of magic strings.
|
|
1109
|
+
*/
|
|
1110
|
+
/** Object is dynamic and affected by gravity */
|
|
1111
|
+
declare const TAG_FALLING: "falling";
|
|
1112
|
+
/** Object follows mouse position when grounded (walks toward mouse) */
|
|
1113
|
+
declare const TAG_FOLLOW_WINDOW: "follow_window";
|
|
1114
|
+
/** Object can be grabbed and moved with mouse */
|
|
1115
|
+
declare const TAG_GRABABLE: "grabable";
|
|
1116
|
+
/**
|
|
1117
|
+
* All available tags as a const object for destructuring.
|
|
1118
|
+
* @example
|
|
1119
|
+
* const { FALLING, GRABABLE } = TAGS;
|
|
1120
|
+
* scene.spawnObject({ tags: [FALLING, GRABABLE], ... });
|
|
1121
|
+
*/
|
|
1122
|
+
declare const TAGS: {
|
|
1123
|
+
readonly FALLING: "falling";
|
|
1124
|
+
readonly FOLLOW_WINDOW: "follow_window";
|
|
1125
|
+
readonly GRABABLE: "grabable";
|
|
1126
|
+
};
|
|
1127
|
+
/** Type for valid tag values */
|
|
1128
|
+
type Tag = typeof TAGS[keyof typeof TAGS];
|
|
1129
|
+
|
|
1130
|
+
export { type BackgroundConfig, type BackgroundImageConfig, type BackgroundImageSizing, BackgroundManager, type BackgroundTransparencyConfig, type BaseEffectConfig, type Bounds, type BurstEffectConfig, type ClickToFallConfig, type ContainerOptions, type DespawnEffectConfig, type DynamicObject, type EffectConfig, type EffectObjectConfig, type EffectType, type FloorConfig, type FontInfo, type FontManifest, type GlyphData, type LifecycleCallback, type LifecycleEvent, type LoadedFont, type LogLevel, type ObjectConfig, type ObjectState, OverlayScene, type OverlaySceneConfig, type PressureThresholdConfig, type RainEffectConfig, type ShadowConfig, type ShapeConfig, type ShapePreset, type StreamEffectConfig, TAGS, TAG_FALLING, TAG_FOLLOW_WINDOW, TAG_GRABABLE, type TTFTextObstacleConfig, type Tag, type TextAlign, type TextBounds, type TextObstacleConfig, type TextObstacleResult, type UpdateCallback, type UpdateCallbackData, type WeightConfig, clearFontCache, getGlyphData, getKerning, getLogLevel, loadFont, logger, measureText, setLogLevel };
|
package/dist/index.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ interface DespawnEffectConfig {
|
|
|
148
148
|
* Unified configuration for spawning scene objects.
|
|
149
149
|
* Objects are configured via tags that define their behavior:
|
|
150
150
|
* - 'falling': Object is dynamic and affected by gravity (without this tag, object is static)
|
|
151
|
-
* - '
|
|
151
|
+
* - 'follow_window': Object follows mouse position when grounded within the canvas window
|
|
152
152
|
* - 'grabable': Object can be dragged via mouse constraint
|
|
153
153
|
*/
|
|
154
154
|
interface ObjectConfig {
|
|
@@ -625,8 +625,8 @@ declare class OverlayScene {
|
|
|
625
625
|
* Spawn an object synchronously.
|
|
626
626
|
* Object behavior is determined by tags:
|
|
627
627
|
* - 'falling': Object is dynamic (affected by gravity)
|
|
628
|
-
* - '
|
|
629
|
-
* - 'grabable': Object can be
|
|
628
|
+
* - 'follow_window': Object follows mouse when grounded (walks toward mouse)
|
|
629
|
+
* - 'grabable': Object can be grabbed and moved with mouse
|
|
630
630
|
* Without 'falling' tag, object is static.
|
|
631
631
|
*/
|
|
632
632
|
spawnObject(config: ObjectConfig): string;
|
|
@@ -1103,4 +1103,28 @@ declare class BackgroundManager {
|
|
|
1103
1103
|
static clearCache(): void;
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
-
|
|
1106
|
+
/**
|
|
1107
|
+
* Tag constants for object behavior.
|
|
1108
|
+
* Use these instead of magic strings.
|
|
1109
|
+
*/
|
|
1110
|
+
/** Object is dynamic and affected by gravity */
|
|
1111
|
+
declare const TAG_FALLING: "falling";
|
|
1112
|
+
/** Object follows mouse position when grounded (walks toward mouse) */
|
|
1113
|
+
declare const TAG_FOLLOW_WINDOW: "follow_window";
|
|
1114
|
+
/** Object can be grabbed and moved with mouse */
|
|
1115
|
+
declare const TAG_GRABABLE: "grabable";
|
|
1116
|
+
/**
|
|
1117
|
+
* All available tags as a const object for destructuring.
|
|
1118
|
+
* @example
|
|
1119
|
+
* const { FALLING, GRABABLE } = TAGS;
|
|
1120
|
+
* scene.spawnObject({ tags: [FALLING, GRABABLE], ... });
|
|
1121
|
+
*/
|
|
1122
|
+
declare const TAGS: {
|
|
1123
|
+
readonly FALLING: "falling";
|
|
1124
|
+
readonly FOLLOW_WINDOW: "follow_window";
|
|
1125
|
+
readonly GRABABLE: "grabable";
|
|
1126
|
+
};
|
|
1127
|
+
/** Type for valid tag values */
|
|
1128
|
+
type Tag = typeof TAGS[keyof typeof TAGS];
|
|
1129
|
+
|
|
1130
|
+
export { type BackgroundConfig, type BackgroundImageConfig, type BackgroundImageSizing, BackgroundManager, type BackgroundTransparencyConfig, type BaseEffectConfig, type Bounds, type BurstEffectConfig, type ClickToFallConfig, type ContainerOptions, type DespawnEffectConfig, type DynamicObject, type EffectConfig, type EffectObjectConfig, type EffectType, type FloorConfig, type FontInfo, type FontManifest, type GlyphData, type LifecycleCallback, type LifecycleEvent, type LoadedFont, type LogLevel, type ObjectConfig, type ObjectState, OverlayScene, type OverlaySceneConfig, type PressureThresholdConfig, type RainEffectConfig, type ShadowConfig, type ShapeConfig, type ShapePreset, type StreamEffectConfig, TAGS, TAG_FALLING, TAG_FOLLOW_WINDOW, TAG_GRABABLE, type TTFTextObstacleConfig, type Tag, type TextAlign, type TextBounds, type TextObstacleConfig, type TextObstacleResult, type UpdateCallback, type UpdateCallbackData, type WeightConfig, clearFontCache, getGlyphData, getKerning, getLogLevel, loadFont, logger, measureText, setLogLevel };
|
package/dist/index.js
CHANGED
|
@@ -1502,7 +1502,7 @@ var OverlayScene = class {
|
|
|
1502
1502
|
const isDragging = this.grabbedObjectId === entry.id;
|
|
1503
1503
|
if (!isDragging) {
|
|
1504
1504
|
for (const tag of entry.tags) {
|
|
1505
|
-
const key = tag === "
|
|
1505
|
+
const key = tag === "follow_window" ? "mouse" : tag.startsWith("follow-") ? tag.slice(7) : null;
|
|
1506
1506
|
if (key) {
|
|
1507
1507
|
const target = this.followTargets.get(key);
|
|
1508
1508
|
if (target) {
|
|
@@ -2037,8 +2037,8 @@ var OverlayScene = class {
|
|
|
2037
2037
|
* Spawn an object synchronously.
|
|
2038
2038
|
* Object behavior is determined by tags:
|
|
2039
2039
|
* - 'falling': Object is dynamic (affected by gravity)
|
|
2040
|
-
* - '
|
|
2041
|
-
* - 'grabable': Object can be
|
|
2040
|
+
* - 'follow_window': Object follows mouse when grounded (walks toward mouse)
|
|
2041
|
+
* - 'grabable': Object can be grabbed and moved with mouse
|
|
2042
2042
|
* Without 'falling' tag, object is static.
|
|
2043
2043
|
*/
|
|
2044
2044
|
spawnObject(config) {
|
|
@@ -3349,9 +3349,23 @@ var OverlayScene = class {
|
|
|
3349
3349
|
this.updateCallbacks.forEach((cb) => cb(data));
|
|
3350
3350
|
}
|
|
3351
3351
|
};
|
|
3352
|
+
|
|
3353
|
+
// src/tags.ts
|
|
3354
|
+
var TAG_FALLING = "falling";
|
|
3355
|
+
var TAG_FOLLOW_WINDOW = "follow_window";
|
|
3356
|
+
var TAG_GRABABLE = "grabable";
|
|
3357
|
+
var TAGS = {
|
|
3358
|
+
FALLING: TAG_FALLING,
|
|
3359
|
+
FOLLOW_WINDOW: TAG_FOLLOW_WINDOW,
|
|
3360
|
+
GRABABLE: TAG_GRABABLE
|
|
3361
|
+
};
|
|
3352
3362
|
export {
|
|
3353
3363
|
BackgroundManager,
|
|
3354
3364
|
OverlayScene,
|
|
3365
|
+
TAGS,
|
|
3366
|
+
TAG_FALLING,
|
|
3367
|
+
TAG_FOLLOW_WINDOW,
|
|
3368
|
+
TAG_GRABABLE,
|
|
3355
3369
|
clearFontCache,
|
|
3356
3370
|
getGlyphData,
|
|
3357
3371
|
getKerning,
|