Update Demo + Functionality Cleanups#2
Merged
Conversation
…sive - Note: this revealed some bugs in the implementation regarding the inheritance chain, so functionality is broken. A fix is in progress.
…sive - Updated demo to be more comprehensive with a message base > message box > alert box > toast notification progression - Refactored approach for gathering provide and configure options to be lazy and deterministic rather than aggressive during register call.
Reviewer's GuideRefactors the Lit feature system to use a centralized feature resolver and unified metadata, introduces a full notification demo stack (message/alert/toast) powered by composable features (status, visibility, dismiss, timer), updates LitCore/FeatureManager wiring, and replaces the old demo and dark-theme styling with a notification-focused demo and light theme. Sequence diagram for feature resolution and initialization on component registrationsequenceDiagram
autonumber
actor Dev as Developer
participant MB as MessageBase_class
participant FR as feature_resolver
participant RF as ResolvedFeatures
participant CE as customElements
participant Inst as MessageBase_instance
participant FM as FeatureManager
participant SF as StatusFeature
Dev->>MB: MessageBase.register("message-base")
activate MB
MB->>FR: resolveFeatures(MB)
activate FR
FR->>FR: getInheritanceChain(MB)
FR->>FR: collect provide/config from
FR->>FR: FEATURE_META and static_members
FR->>RF: build ResolvedFeatures
FR-->>MB: ResolvedFeatures
deactivate FR
MB->>MB: cache _resolvedFeatures
MB->>CE: define("message-base", MB)
deactivate MB
Dev->>CE: new message-base()
CE-->>Inst: construct instance
activate Inst
Inst->>FM: new FeatureManager(Inst, MB)
activate FM
FM->>FR: resolveFeatures(MB)
FR-->>FM: ResolvedFeatures (from cache)
FM->>FM: _initializeFeatures(ResolvedFeatures)
FM->>SF: new StatusFeature(Inst, config)
FM->>Inst: attach StatusFeature as Status
FM->>Inst: map feature properties into host
deactivate FM
deactivate Inst
Updated class diagram for the core LitFeature systemclassDiagram
direction LR
class LitElement {
}
class LitCore {
<<component>>
+FeatureManager featureManager
+static properties Record~string,PropertyDeclaration~
+static configure Record~string,FeatureConfigEntry_or_disable~
+static provide Record~string,FeatureDefinition~
+static finalize() void
+static register(componentName string) void
}
class FeatureManager {
-LitCore host
-LitCoreConstructor hostConstructor
-Map~string, LitFeature~ _featureInstances
+constructor(host LitCore, constructor LitCoreConstructor)
-_initializeFeatures(resolved ResolvedFeatures) void
}
class LitFeature {
<<interface ReactiveController>>
+LitCore host
+FeatureConfig config
-Map~string, unknown~ _internalValues
+constructor(host LitCore, config FeatureConfig)
+firstUpdated(changedProperties Map~PropertyKey,unknown~) void
+updated(changedProperties Map~PropertyKey,unknown~) void
+hostUpdated() void
-_litFeatureInit() void
-_createPropertyObserver(propertyName string) void
+setInternalValue(propertyName string, value unknown) void
+getInternalValue(propertyName string) unknown
}
class StatusFeature {
+StatusType status
+boolean showIcon
+StatusStyles statusStyles
+constructor(host LitCore, config StatusConfig)
+getStatusIcon() string
+getStatusColor() string
}
class VisibilityFeature {
+boolean visible
+boolean transitioning
+constructor(host LitCore, config VisibilityConfig)
+show() void
+hide() void
+toggle() void
+getTransitionStyles() string
}
class DismissFeature {
+boolean dismissible
+boolean dismissed
+constructor(host LitCore, config DismissConfig)
+getDismissLabel() string
+dismiss() boolean
}
class TimerFeature {
+number duration
+number remaining
+number progress
+boolean running
+boolean paused
+constructor(host LitCore, config TimerConfig)
+start() void
+pause() void
+resume() void
+reset() void
+stop() void
+getFormattedRemaining() string
}
class FeatureDefinition {
+FeatureClass class
+FeatureConfig config
+boolean enabled
}
class FeatureConfigEntry {
+FeatureConfig config
+Record~string,PropertyDeclaration_or_disable~ properties
}
class FeatureMeta {
+Map~string,FeatureDefinition~ provide
+Map~string,FeatureConfigEntry_or_disable~ configure
+Map~string,PropertyDeclaration~ featureProperties
}
class ResolvedFeatures {
+Record~string,PropertyDeclaration~ properties
+Map~string,ResolvedFeatureItem~ features
}
class ResolvedFeatureItem {
+typeof_LitFeature class
+FeatureConfig config
}
class LitCoreConstructor {
+new() LitCore
+string name
+Record~string,FeatureDefinition~ provide
+Record~string,FeatureConfigEntry_or_disable~ configure
+Record~string,FeatureDefinition~ provides
+Record~string,FeatureConfigEntry_or_disable~ features
+Record~string,PropertyDeclaration~ properties
+ResolvedFeatures _resolvedFeatures
+Record~string,PropertyDeclaration~ _resolvedProperties
}
class FEATURE_META {
}
class LIT_CORE_MARKER {
}
class feature_resolver {
+resolveFeatures(ctor LitCoreConstructor) ResolvedFeatures
}
LitElement <|-- LitCore
LitCore o-- FeatureManager
LitFeature <|-- StatusFeature
LitFeature <|-- VisibilityFeature
LitFeature <|-- DismissFeature
LitFeature <|-- TimerFeature
FeatureManager ..> ResolvedFeatures
FeatureManager ..> LitFeature : creates
feature_resolver ..> ResolvedFeatures
feature_resolver ..> FeatureMeta
feature_resolver ..> FeatureDefinition
feature_resolver ..> FeatureConfigEntry
LitCoreConstructor ..> ResolvedFeatures : caches
LitCoreConstructor ..> FEATURE_META : reads
LitCoreConstructor ..> LIT_CORE_MARKER : static_read
LitCore ..> feature_resolver : resolveFeatures
LitCore ..> LitCoreConstructor : static_finalize
FeatureDefinition ..> LitFeature
FeatureMeta ..> FeatureDefinition
FeatureMeta ..> FeatureConfigEntry
ResolvedFeatures --> ResolvedFeatureItem
Updated class diagram for the notification demo component hierarchyclassDiagram
direction TB
class LitCore {
}
class MessageBase {
<<component>>
+StatusFeature Status
+StatusType status
+boolean showIcon
+StatusStyles statusStyles
+renderContent() TemplateResult
+render() TemplateResult
}
class MessageBox {
<<component>>
+VisibilityFeature Visibility
+boolean visible
+boolean transitioning
+show() void
+hide() void
+toggle() void
+render() TemplateResult
}
class AlertBox {
<<component>>
+DismissFeature Dismiss
+boolean dismissible
+boolean dismissed
-_handleDismiss() void
+render() TemplateResult
}
class ToastNotification {
<<component>>
+TimerFeature Timer
+number duration
+number remaining
+number progress
+boolean running
+boolean paused
+pauseTimer() void
+resumeTimer() void
+resetTimer() void
-_startProgressTracking() void
-_handleMouseEnter() void
-_handleMouseLeave() void
+render() TemplateResult
}
class NotificationDemo {
<<component>>
-number _toastCount
-Array_toast_ _toasts
-_createToast(status StatusType) void
-_toggleMessageBox() void
-_resetAlerts() void
-_removeToast(id number) void
+render() TemplateResult
}
class StatusFeature {
}
class VisibilityFeature {
}
class DismissFeature {
}
class TimerFeature {
}
class ToastItem {
+number id
+StatusType status
+string message
}
LitCore <|-- MessageBase
MessageBase <|-- MessageBox
MessageBox <|-- AlertBox
AlertBox <|-- ToastNotification
MessageBase o-- StatusFeature
MessageBox o-- VisibilityFeature
AlertBox o-- DismissFeature
ToastNotification o-- TimerFeature
NotificationDemo o-- ToastNotification : renders_many
NotificationDemo o-- MessageBase : demo_examples
NotificationDemo o-- MessageBox : demo_examples
NotificationDemo o-- AlertBox : demo_examples
NotificationDemo --> ToastItem : manages_state
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… with "provide" and "configure"
…ension during feature initialization
36e6cc5 to
d255237
Compare
- Implemented a PerformanceMonitor to track and log performance metrics for component initialization and rendering. - Created StressTest component to generate and monitor 50+ components for performance bottlenecks. - Developed SuperStressTest component to silently generate 500 complex components for performance evaluation. - Added HTML files for both StressTest and SuperStressTest components to facilitate testing in a browser environment. - Enhanced existing LitCore and LitFeature classes to integrate performance monitoring during construction and feature initialization.
…match Lit branding
5dfb6d0 to
4fce0b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This may have gotten out of hand...
But as demos tend to do, this revealed some weaknesses in the existing implementation, and the dominos fell from there.
Who needs clean commit histories?
Greenfield is an exception, right? ;)
Anyways, great strides!
Summary by Sourcery
Introduce a new notification demo showcasing a four-level feature-based component hierarchy and refactor the Lit feature system to use a centralized resolver, unified metadata, and tighter integration with Lit’s lifecycle and property model.
New Features:
Enhancements:
Documentation: