@labcat2020/animation-lab 0.1.2 → 0.1.3

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 CHANGED
@@ -44,11 +44,22 @@ Layouts:
44
44
  ```astro
45
45
  import BaseLayout from '@labcat2020/animation-lab/layouts/BaseLayout.astro';
46
46
  import SketchLayout from '@labcat2020/animation-lab/layouts/SketchLayout.astro';
47
+ ---
48
+ <SketchLayout title="My Sketch" showFps> <!-- bottom-right FPS badge -->
49
+ <script>import '@labcat2020/p5.audioreactive/p5.fps.js'</script>
50
+ </SketchLayout>
47
51
  ```
48
52
 
53
+ HUD labels (shared badge style, promoted from fractals `FractalBadge`):
54
+ ```astro
55
+ import FpsIndicator from '@labcat2020/animation-lab/components/FpsIndicator.astro';
56
+ <FpsIndicator /> <!-- or hidden={false} to show immediately -->
57
+ ```
58
+ Styles in `styles/components/lab-label.scss` (`lab-label`, `lab-label--top-right`, `lab-label--bottom-right`, `lab-label--fps`) are auto-imported via `global.scss`; pair with `p.enableFpsIndicator()` from `@labcat2020/p5.audioreactive/p5.fps.js`.
59
+
49
60
  ## Dev helper
50
61
 
51
- Series repos linking local hub (sibling `../animations.labcat.nz`):
62
+ Series repos linking the local lab (sibling `../animations.labcat.nz`):
52
63
 
53
64
  ```bash
54
65
  pnpm run postinstall # labcat-link-packages (symlinks packages/*)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labcat2020/animation-lab",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Shared Astro layouts, components, and styles for Animation Lab series sites",
6
6
  "exports": {
@@ -42,4 +42,4 @@
42
42
  "p5",
43
43
  "generative"
44
44
  ]
45
- }
45
+ }
@@ -0,0 +1,21 @@
1
+ ---
2
+ // FpsIndicator — bottom-right FPS badge for audio-reactive sketches
3
+ // Reuses shared .lab-label styles (global.scss → components/lab-label.scss).
4
+ // The badge is hidden by default; call p.enableFpsIndicator() (from
5
+ // @labcat2020/p5.audioreactive/p5.fps.js) to show and start updating.
6
+ // When JS auto-creates the element it injects identical fallback styles.
7
+
8
+ interface Props {
9
+ id?: string;
10
+ hidden?: boolean;
11
+ }
12
+
13
+ const { id = 'fps-indicator', hidden = true } = Astro.props;
14
+ ---
15
+
16
+ <div
17
+ id={id}
18
+ class="lab-label lab-label--bottom-right lab-label--fps"
19
+ aria-live="polite"
20
+ hidden={hidden}
21
+ ></div>
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  import BaseLayout from './BaseLayout.astro';
3
3
  import InstagramCTA from '../components/InstagramCTA.astro';
4
+ import FpsIndicator from '../components/FpsIndicator.astro';
4
5
 
5
- const { title = 'Sketch', description = '' } = Astro.props;
6
+ const { title = 'Sketch', description = '', showFps = false } = Astro.props;
6
7
  ---
7
8
 
8
9
  <BaseLayout title={title} description={description}>
@@ -46,4 +47,5 @@ const { title = 'Sketch', description = '' } = Astro.props;
46
47
  </svg>
47
48
 
48
49
  <!-- <InstagramCTA /> -->
50
+ <FpsIndicator hidden={!showFps} />
49
51
  </BaseLayout>
@@ -0,0 +1,37 @@
1
+ // lab-label — shared badge/label for HUD overlays (FractalBadge, FPS indicator, etc.)
2
+ // Promoted from fractals/src/components/FractalBadge.astro visual style.
3
+ // Usage: <div class="lab-label lab-label--top-right">…</div>
4
+ // <div class="lab-label lab-label--bottom-right lab-label--fps">60 FPS</div>
5
+
6
+ .lab-label {
7
+ position: fixed;
8
+ z-index: 1000;
9
+ padding: 8px 12px;
10
+ background: var(--black);
11
+ font-family: 'Orbitron', monospace;
12
+ font-weight: 700;
13
+ color: var(--white);
14
+ pointer-events: none;
15
+ line-height: 1;
16
+ font-size: 14px;
17
+
18
+ &--top-right {
19
+ top: 10px;
20
+ right: 10px;
21
+ }
22
+
23
+ &--bottom-right {
24
+ bottom: 10px;
25
+ right: 10px;
26
+ }
27
+
28
+ &--fps {
29
+ min-width: 4.5em;
30
+ text-align: right;
31
+ font-variant-numeric: tabular-nums;
32
+ }
33
+
34
+ &[hidden] {
35
+ display: none !important;
36
+ }
37
+ }
@@ -1,6 +1,7 @@
1
1
  // Import normalize.css for consistent base styling
2
2
  @import "./variables";
3
3
  @import "./mixins/breakpoints";
4
+ @import "./components/lab-label";
4
5
  @import "normalize.css";
5
6
 
6
7
  $cursor-color: white;
package/src/vite.mjs CHANGED
@@ -41,11 +41,12 @@ export function astroAnimationsViteConfig() {
41
41
  treeshake: {
42
42
  moduleSideEffects(id) {
43
43
  if (id.includes('p5.sound')) return true;
44
- // Only the three side-effect entry files from p5.audioreactive; other helpers are tree-shakable
44
+ // Only the side-effect entry files from p5.audioreactive; other helpers are tree-shakable
45
45
  if (
46
46
  id.includes('p5.audioreactive/src/p5.audioReact.js') ||
47
47
  id.includes('p5.audioreactive/src/p5.soundBoot.js') ||
48
- id.includes('p5.audioreactive/src/p5.setGlobalP5.js')
48
+ id.includes('p5.audioreactive/src/p5.setGlobalP5.js') ||
49
+ id.includes('p5.audioreactive/src/p5.fps.js')
49
50
  )
50
51
  return true;
51
52
  return undefined;