Initial commit
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import Component from './Component'
|
||||
import type { GlitchComponentMetadata } from './types'
|
||||
|
||||
export default Component
|
||||
|
||||
export const metadata: GlitchComponentMetadata = {
|
||||
|
||||
name: 'bloodsugar',
|
||||
displayName: 'Blood Sugar Delay Lab',
|
||||
version: '1.0.0',
|
||||
paramSchema: {
|
||||
responseDelay: {
|
||||
type: 'range',
|
||||
label: 'Feedback Lag',
|
||||
description: 'Minutes of delay between glucose rising, insulin being secreted, and insulin action arriving.',
|
||||
default: 34,
|
||||
min: 0,
|
||||
max: 80,
|
||||
step: 1
|
||||
},
|
||||
mealLoad: {
|
||||
type: 'range',
|
||||
label: 'Meal Size',
|
||||
default: 44,
|
||||
min: 20,
|
||||
max: 80,
|
||||
step: 1
|
||||
},
|
||||
pancreasStrength: {
|
||||
type: 'range',
|
||||
label: 'Compensation Strength',
|
||||
default: 1,
|
||||
min: 0.45,
|
||||
max: 1.6,
|
||||
step: 0.01
|
||||
},
|
||||
playbackSpeed: {
|
||||
type: 'range',
|
||||
label: 'Playback Speed',
|
||||
default: 1,
|
||||
min: 0.25,
|
||||
max: 3,
|
||||
step: 0.05
|
||||
},
|
||||
primaryColor: {
|
||||
type: 'color',
|
||||
label: 'Glucose Color',
|
||||
default: '#6366f1'
|
||||
},
|
||||
accentColor: {
|
||||
type: 'color',
|
||||
label: 'Insulin Color',
|
||||
default: '#22d3ee'
|
||||
}
|
||||
},
|
||||
defaultParams: {
|
||||
responseDelay: 34,
|
||||
mealLoad: 44,
|
||||
pancreasStrength: 1,
|
||||
playbackSpeed: 1,
|
||||
primaryColor: '#6366f1',
|
||||
accentColor: '#22d3ee'
|
||||
}
|
||||
}
|
||||
|
||||
export type {
|
||||
GlitchComponentProps,
|
||||
GlitchComponentConfig,
|
||||
GlitchComponentResult,
|
||||
GlitchTheme,
|
||||
GlitchHostBridge
|
||||
} from './types'
|
||||
|
||||
// CDN self-registration: when loaded as an IIFE script from the CDN, this registers
|
||||
// the component in window.GlitchComponents so the host loader can retrieve it by id.
|
||||
if (typeof window !== 'undefined') {
|
||||
type GCRegistry = Record<string, { default: typeof Component; metadata: GlitchComponentMetadata }>
|
||||
;(window as unknown as { GlitchComponents: GCRegistry }).GlitchComponents ??= {}
|
||||
;(window as unknown as { GlitchComponents: GCRegistry }).GlitchComponents[metadata.name] = { default: Component, metadata }
|
||||
}
|
||||
Reference in New Issue
Block a user