@tachui/cli 0.8.11 → 0.8.12
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/cli/src/commands/analyze-imports.d.ts +18 -0
- package/dist/cli/src/commands/analyze-imports.d.ts.map +1 -0
- package/dist/cli/src/commands/analyze-imports.js +152 -0
- package/dist/cli/src/commands/analyze-imports.js.map +1 -0
- package/dist/cli/src/commands/analyze.d.ts +8 -0
- package/dist/cli/src/commands/analyze.d.ts.map +1 -0
- package/dist/cli/src/commands/analyze.js +550 -0
- package/dist/cli/src/commands/analyze.js.map +1 -0
- package/dist/cli/src/commands/dev.d.ts +8 -0
- package/dist/cli/src/commands/dev.d.ts.map +1 -0
- package/dist/cli/src/commands/dev.js +171 -0
- package/dist/cli/src/commands/dev.js.map +1 -0
- package/dist/cli/src/commands/generate.d.ts +8 -0
- package/dist/cli/src/commands/generate.d.ts.map +1 -0
- package/dist/cli/src/commands/generate.js +695 -0
- package/dist/cli/src/commands/generate.js.map +1 -0
- package/dist/cli/src/commands/init.d.ts +8 -0
- package/dist/cli/src/commands/init.d.ts.map +1 -0
- package/dist/cli/src/commands/init.js +169 -0
- package/dist/cli/src/commands/init.js.map +1 -0
- package/dist/cli/src/commands/migrate/remove-modifier-trigger.d.ts +3 -0
- package/dist/cli/src/commands/migrate/remove-modifier-trigger.d.ts.map +1 -0
- package/dist/cli/src/commands/migrate/remove-modifier-trigger.js +103 -0
- package/dist/cli/src/commands/migrate/remove-modifier-trigger.js.map +1 -0
- package/dist/cli/src/commands/migrate.d.ts +8 -0
- package/dist/cli/src/commands/migrate.d.ts.map +1 -0
- package/dist/cli/src/commands/migrate.js +337 -0
- package/dist/cli/src/commands/migrate.js.map +1 -0
- package/dist/cli/src/commands/modifier-docs.d.ts +24 -0
- package/dist/cli/src/commands/modifier-docs.d.ts.map +1 -0
- package/dist/cli/src/commands/modifier-docs.js +375 -0
- package/dist/cli/src/commands/modifier-docs.js.map +1 -0
- package/dist/cli/src/commands/optimize.d.ts +8 -0
- package/dist/cli/src/commands/optimize.d.ts.map +1 -0
- package/dist/cli/src/commands/optimize.js +357 -0
- package/dist/cli/src/commands/optimize.js.map +1 -0
- package/dist/cli/src/import-optimizer.d.ts +50 -0
- package/dist/cli/src/import-optimizer.d.ts.map +1 -0
- package/dist/cli/src/import-optimizer.js +227 -0
- package/dist/cli/src/import-optimizer.js.map +1 -0
- package/dist/cli/src/index.d.ts +5 -0
- package/dist/cli/src/index.d.ts.map +1 -0
- package/dist/cli/src/index.js +62 -0
- package/dist/cli/src/index.js.map +1 -0
- package/dist/cli/src/migrations/remove-modifier-trigger.d.ts +7 -0
- package/dist/cli/src/migrations/remove-modifier-trigger.d.ts.map +1 -0
- package/dist/cli/src/migrations/remove-modifier-trigger.js +99 -0
- package/dist/cli/src/migrations/remove-modifier-trigger.js.map +1 -0
- package/dist/cli/src/scaffold/create-project.d.ts +15 -0
- package/dist/cli/src/scaffold/create-project.d.ts.map +1 -0
- package/dist/cli/src/scaffold/create-project.js +84 -0
- package/dist/cli/src/scaffold/create-project.js.map +1 -0
- package/dist/cli/src/scaffold/package-root.d.ts +2 -0
- package/dist/cli/src/scaffold/package-root.d.ts.map +1 -0
- package/dist/cli/src/scaffold/package-root.js +24 -0
- package/dist/cli/src/scaffold/package-root.js.map +1 -0
- package/dist/cli/src/scaffold/templates.d.ts +11 -0
- package/dist/cli/src/scaffold/templates.d.ts.map +1 -0
- package/dist/cli/src/scaffold/templates.js +26 -0
- package/dist/cli/src/scaffold/templates.js.map +1 -0
- package/dist/cli/src/scaffold/validators.d.ts +2 -0
- package/dist/cli/src/scaffold/validators.d.ts.map +1 -0
- package/dist/cli/src/scaffold/validators.js +32 -0
- package/dist/cli/src/scaffold/validators.js.map +1 -0
- package/dist/core/package.json +224 -0
- package/dist/core/src/assets/Asset.d.ts +11 -0
- package/dist/core/src/assets/Asset.d.ts.map +1 -0
- package/dist/core/src/assets/Asset.js +12 -0
- package/dist/core/src/assets/Asset.js.map +1 -0
- package/dist/core/src/assets/AssetCollection.d.ts +14 -0
- package/dist/core/src/assets/AssetCollection.d.ts.map +1 -0
- package/dist/core/src/assets/AssetCollection.js +133 -0
- package/dist/core/src/assets/AssetCollection.js.map +1 -0
- package/dist/core/src/assets/ColorAsset.d.ts +31 -0
- package/dist/core/src/assets/ColorAsset.d.ts.map +1 -0
- package/dist/core/src/assets/ColorAsset.js +182 -0
- package/dist/core/src/assets/ColorAsset.js.map +1 -0
- package/dist/core/src/assets/FontAsset.d.ts +114 -0
- package/dist/core/src/assets/FontAsset.d.ts.map +1 -0
- package/dist/core/src/assets/FontAsset.js +289 -0
- package/dist/core/src/assets/FontAsset.js.map +1 -0
- package/dist/core/src/assets/ImageAsset.d.ts +35 -0
- package/dist/core/src/assets/ImageAsset.d.ts.map +1 -0
- package/dist/core/src/assets/ImageAsset.js +69 -0
- package/dist/core/src/assets/ImageAsset.js.map +1 -0
- package/dist/core/src/assets/index.d.ts +27 -0
- package/dist/core/src/assets/index.d.ts.map +1 -0
- package/dist/core/src/assets/index.js +137 -0
- package/dist/core/src/assets/index.js.map +1 -0
- package/dist/core/src/assets/types.d.ts +10 -0
- package/dist/core/src/assets/types.d.ts.map +1 -0
- package/dist/core/src/assets/types.js +6 -0
- package/dist/core/src/assets/types.js.map +1 -0
- package/dist/core/src/compiler/advanced-parser.d.ts +113 -0
- package/dist/core/src/compiler/advanced-parser.d.ts.map +1 -0
- package/dist/core/src/compiler/advanced-parser.js +702 -0
- package/dist/core/src/compiler/advanced-parser.js.map +1 -0
- package/dist/core/src/compiler/codegen.d.ts +20 -0
- package/dist/core/src/compiler/codegen.d.ts.map +1 -0
- package/dist/core/src/compiler/codegen.js +509 -0
- package/dist/core/src/compiler/codegen.js.map +1 -0
- package/dist/core/src/compiler/enhanced-codegen.d.ts +121 -0
- package/dist/core/src/compiler/enhanced-codegen.d.ts.map +1 -0
- package/dist/core/src/compiler/enhanced-codegen.js +607 -0
- package/dist/core/src/compiler/enhanced-codegen.js.map +1 -0
- package/dist/core/src/compiler/index.d.ts +14 -0
- package/dist/core/src/compiler/index.d.ts.map +1 -0
- package/dist/core/src/compiler/index.js +12 -0
- package/dist/core/src/compiler/index.js.map +1 -0
- package/dist/core/src/compiler/parser.d.ts +12 -0
- package/dist/core/src/compiler/parser.d.ts.map +1 -0
- package/dist/core/src/compiler/parser.js +407 -0
- package/dist/core/src/compiler/parser.js.map +1 -0
- package/dist/core/src/compiler/plugin.d.ts +13 -0
- package/dist/core/src/compiler/plugin.d.ts.map +1 -0
- package/dist/core/src/compiler/plugin.js +456 -0
- package/dist/core/src/compiler/plugin.js.map +1 -0
- package/dist/core/src/compiler/types.d.ts +177 -0
- package/dist/core/src/compiler/types.d.ts.map +1 -0
- package/dist/core/src/compiler/types.js +5 -0
- package/dist/core/src/compiler/types.js.map +1 -0
- package/dist/core/src/components/factory.d.ts +24 -0
- package/dist/core/src/components/factory.d.ts.map +1 -0
- package/dist/core/src/components/factory.js +19 -0
- package/dist/core/src/components/factory.js.map +1 -0
- package/dist/core/src/components/index.d.ts +12 -0
- package/dist/core/src/components/index.d.ts.map +1 -0
- package/dist/core/src/components/index.js +9 -0
- package/dist/core/src/components/index.js.map +1 -0
- package/dist/core/src/components/wrapper.d.ts +142 -0
- package/dist/core/src/components/wrapper.d.ts.map +1 -0
- package/dist/core/src/components/wrapper.js +628 -0
- package/dist/core/src/components/wrapper.js.map +1 -0
- package/dist/core/src/concatenation/concatenatable.d.ts +63 -0
- package/dist/core/src/concatenation/concatenatable.d.ts.map +1 -0
- package/dist/core/src/concatenation/concatenatable.js +158 -0
- package/dist/core/src/concatenation/concatenatable.js.map +1 -0
- package/dist/core/src/concatenation/concatenated-component.d.ts +124 -0
- package/dist/core/src/concatenation/concatenated-component.d.ts.map +1 -0
- package/dist/core/src/concatenation/concatenated-component.js +447 -0
- package/dist/core/src/concatenation/concatenated-component.js.map +1 -0
- package/dist/core/src/concatenation/index.d.ts +13 -0
- package/dist/core/src/concatenation/index.d.ts.map +1 -0
- package/dist/core/src/concatenation/index.js +16 -0
- package/dist/core/src/concatenation/index.js.map +1 -0
- package/dist/core/src/concatenation/text-optimizer.d.ts +104 -0
- package/dist/core/src/concatenation/text-optimizer.d.ts.map +1 -0
- package/dist/core/src/concatenation/text-optimizer.js +349 -0
- package/dist/core/src/concatenation/text-optimizer.js.map +1 -0
- package/dist/core/src/concatenation/types.d.ts +88 -0
- package/dist/core/src/concatenation/types.d.ts.map +1 -0
- package/dist/core/src/concatenation/types.js +23 -0
- package/dist/core/src/concatenation/types.js.map +1 -0
- package/dist/core/src/config.d.ts +7 -0
- package/dist/core/src/config.d.ts.map +1 -0
- package/dist/core/src/config.js +17 -0
- package/dist/core/src/config.js.map +1 -0
- package/dist/core/src/constants/frame-utils.d.ts +68 -0
- package/dist/core/src/constants/frame-utils.d.ts.map +1 -0
- package/dist/core/src/constants/frame-utils.js +156 -0
- package/dist/core/src/constants/frame-utils.js.map +1 -0
- package/dist/core/src/constants/index.d.ts +8 -0
- package/dist/core/src/constants/index.d.ts.map +1 -0
- package/dist/core/src/constants/index.js +8 -0
- package/dist/core/src/constants/index.js.map +1 -0
- package/dist/core/src/constants/layout.d.ts +96 -0
- package/dist/core/src/constants/layout.d.ts.map +1 -0
- package/dist/core/src/constants/layout.js +124 -0
- package/dist/core/src/constants/layout.js.map +1 -0
- package/dist/core/src/css-classes/component-base.d.ts +40 -0
- package/dist/core/src/css-classes/component-base.d.ts.map +1 -0
- package/dist/core/src/css-classes/component-base.js +90 -0
- package/dist/core/src/css-classes/component-base.js.map +1 -0
- package/dist/core/src/css-classes/css-class-manager.d.ts +89 -0
- package/dist/core/src/css-classes/css-class-manager.d.ts.map +1 -0
- package/dist/core/src/css-classes/css-class-manager.js +328 -0
- package/dist/core/src/css-classes/css-class-manager.js.map +1 -0
- package/dist/core/src/css-classes/dom-integration.d.ts +76 -0
- package/dist/core/src/css-classes/dom-integration.d.ts.map +1 -0
- package/dist/core/src/css-classes/dom-integration.js +104 -0
- package/dist/core/src/css-classes/dom-integration.js.map +1 -0
- package/dist/core/src/css-classes/enhanced-renderer.d.ts +42 -0
- package/dist/core/src/css-classes/enhanced-renderer.d.ts.map +1 -0
- package/dist/core/src/css-classes/enhanced-renderer.js +121 -0
- package/dist/core/src/css-classes/enhanced-renderer.js.map +1 -0
- package/dist/core/src/css-classes/index.d.ts +14 -0
- package/dist/core/src/css-classes/index.d.ts.map +1 -0
- package/dist/core/src/css-classes/index.js +14 -0
- package/dist/core/src/css-classes/index.js.map +1 -0
- package/dist/core/src/css-classes/types.d.ts +59 -0
- package/dist/core/src/css-classes/types.d.ts.map +1 -0
- package/dist/core/src/css-classes/types.js +8 -0
- package/dist/core/src/css-classes/types.js.map +1 -0
- package/dist/core/src/css-classes/utilities.d.ts +104 -0
- package/dist/core/src/css-classes/utilities.d.ts.map +1 -0
- package/dist/core/src/css-classes/utilities.js +126 -0
- package/dist/core/src/css-classes/utilities.js.map +1 -0
- package/dist/core/src/gradients/css-generator.d.ts +10 -0
- package/dist/core/src/gradients/css-generator.d.ts.map +1 -0
- package/dist/core/src/gradients/css-generator.js +123 -0
- package/dist/core/src/gradients/css-generator.js.map +1 -0
- package/dist/core/src/gradients/examples.d.ts +432 -0
- package/dist/core/src/gradients/examples.d.ts.map +1 -0
- package/dist/core/src/gradients/examples.js +588 -0
- package/dist/core/src/gradients/examples.js.map +1 -0
- package/dist/core/src/gradients/gradient-asset.d.ts +10 -0
- package/dist/core/src/gradients/gradient-asset.d.ts.map +1 -0
- package/dist/core/src/gradients/gradient-asset.js +25 -0
- package/dist/core/src/gradients/gradient-asset.js.map +1 -0
- package/dist/core/src/gradients/index.d.ts +19 -0
- package/dist/core/src/gradients/index.d.ts.map +1 -0
- package/dist/core/src/gradients/index.js +56 -0
- package/dist/core/src/gradients/index.js.map +1 -0
- package/dist/core/src/gradients/performance.d.ts +146 -0
- package/dist/core/src/gradients/performance.d.ts.map +1 -0
- package/dist/core/src/gradients/performance.js +413 -0
- package/dist/core/src/gradients/performance.js.map +1 -0
- package/dist/core/src/gradients/presets.d.ts +165 -0
- package/dist/core/src/gradients/presets.d.ts.map +1 -0
- package/dist/core/src/gradients/presets.js +371 -0
- package/dist/core/src/gradients/presets.js.map +1 -0
- package/dist/core/src/gradients/reactive.d.ts +167 -0
- package/dist/core/src/gradients/reactive.d.ts.map +1 -0
- package/dist/core/src/gradients/reactive.js +329 -0
- package/dist/core/src/gradients/reactive.js.map +1 -0
- package/dist/core/src/gradients/state-gradient-asset.d.ts +67 -0
- package/dist/core/src/gradients/state-gradient-asset.d.ts.map +1 -0
- package/dist/core/src/gradients/state-gradient-asset.js +145 -0
- package/dist/core/src/gradients/state-gradient-asset.js.map +1 -0
- package/dist/core/src/gradients/types.d.ts +6 -0
- package/dist/core/src/gradients/types.d.ts.map +1 -0
- package/dist/core/src/gradients/types.js +6 -0
- package/dist/core/src/gradients/types.js.map +1 -0
- package/dist/core/src/gradients/utils.d.ts +313 -0
- package/dist/core/src/gradients/utils.d.ts.map +1 -0
- package/dist/core/src/gradients/utils.js +513 -0
- package/dist/core/src/gradients/utils.js.map +1 -0
- package/dist/core/src/gradients/validation.d.ts +156 -0
- package/dist/core/src/gradients/validation.d.ts.map +1 -0
- package/dist/core/src/gradients/validation.js +392 -0
- package/dist/core/src/gradients/validation.js.map +1 -0
- package/dist/core/src/index.d.ts +33 -0
- package/dist/core/src/index.d.ts.map +1 -0
- package/dist/core/src/index.js +57 -0
- package/dist/core/src/index.js.map +1 -0
- package/dist/core/src/lifecycle/hooks.d.ts +101 -0
- package/dist/core/src/lifecycle/hooks.d.ts.map +1 -0
- package/dist/core/src/lifecycle/hooks.js +241 -0
- package/dist/core/src/lifecycle/hooks.js.map +1 -0
- package/dist/core/src/modifiers/alignment.d.ts +5 -0
- package/dist/core/src/modifiers/alignment.d.ts.map +1 -0
- package/dist/core/src/modifiers/alignment.js +19 -0
- package/dist/core/src/modifiers/alignment.js.map +1 -0
- package/dist/core/src/modifiers/base.d.ts +129 -0
- package/dist/core/src/modifiers/base.d.ts.map +1 -0
- package/dist/core/src/modifiers/base.js +1078 -0
- package/dist/core/src/modifiers/base.js.map +1 -0
- package/dist/core/src/modifiers/builder.d.ts +148 -0
- package/dist/core/src/modifiers/builder.d.ts.map +1 -0
- package/dist/core/src/modifiers/builder.js +903 -0
- package/dist/core/src/modifiers/builder.js.map +1 -0
- package/dist/core/src/modifiers/core.d.ts +14 -0
- package/dist/core/src/modifiers/core.d.ts.map +1 -0
- package/dist/core/src/modifiers/core.js +16 -0
- package/dist/core/src/modifiers/core.js.map +1 -0
- package/dist/core/src/modifiers/corner-radius.d.ts +8 -0
- package/dist/core/src/modifiers/corner-radius.d.ts.map +1 -0
- package/dist/core/src/modifiers/corner-radius.js +19 -0
- package/dist/core/src/modifiers/corner-radius.js.map +1 -0
- package/dist/core/src/modifiers/factories.d.ts +88 -0
- package/dist/core/src/modifiers/factories.d.ts.map +1 -0
- package/dist/core/src/modifiers/factories.js +376 -0
- package/dist/core/src/modifiers/factories.js.map +1 -0
- package/dist/core/src/modifiers/index.d.ts +17 -0
- package/dist/core/src/modifiers/index.d.ts.map +1 -0
- package/dist/core/src/modifiers/index.js +16 -0
- package/dist/core/src/modifiers/index.js.map +1 -0
- package/dist/core/src/modifiers/layout-priority.d.ts +8 -0
- package/dist/core/src/modifiers/layout-priority.d.ts.map +1 -0
- package/dist/core/src/modifiers/layout-priority.js +19 -0
- package/dist/core/src/modifiers/layout-priority.js.map +1 -0
- package/dist/core/src/modifiers/opacity.d.ts +8 -0
- package/dist/core/src/modifiers/opacity.d.ts.map +1 -0
- package/dist/core/src/modifiers/opacity.js +19 -0
- package/dist/core/src/modifiers/opacity.js.map +1 -0
- package/dist/core/src/modifiers/presets.d.ts +368 -0
- package/dist/core/src/modifiers/presets.d.ts.map +1 -0
- package/dist/core/src/modifiers/presets.js +394 -0
- package/dist/core/src/modifiers/presets.js.map +1 -0
- package/dist/core/src/modifiers/proxy.d.ts +4 -0
- package/dist/core/src/modifiers/proxy.d.ts.map +1 -0
- package/dist/core/src/modifiers/proxy.js +229 -0
- package/dist/core/src/modifiers/proxy.js.map +1 -0
- package/dist/core/src/modifiers/reactive-style-bindings.d.ts +22 -0
- package/dist/core/src/modifiers/reactive-style-bindings.d.ts.map +1 -0
- package/dist/core/src/modifiers/reactive-style-bindings.js +172 -0
- package/dist/core/src/modifiers/reactive-style-bindings.js.map +1 -0
- package/dist/core/src/modifiers/registration-utils.d.ts +7 -0
- package/dist/core/src/modifiers/registration-utils.d.ts.map +1 -0
- package/dist/core/src/modifiers/registration-utils.js +46 -0
- package/dist/core/src/modifiers/registration-utils.js.map +1 -0
- package/dist/core/src/modifiers/registry.d.ts +78 -0
- package/dist/core/src/modifiers/registry.d.ts.map +1 -0
- package/dist/core/src/modifiers/registry.js +397 -0
- package/dist/core/src/modifiers/registry.js.map +1 -0
- package/dist/core/src/modifiers/types.d.ts +6 -0
- package/dist/core/src/modifiers/types.d.ts.map +1 -0
- package/dist/core/src/modifiers/types.js +6 -0
- package/dist/core/src/modifiers/types.js.map +1 -0
- package/dist/core/src/plugins/index.d.ts +16 -0
- package/dist/core/src/plugins/index.d.ts.map +1 -0
- package/dist/core/src/plugins/index.js +21 -0
- package/dist/core/src/plugins/index.js.map +1 -0
- package/dist/core/src/plugins/legacy-adapter.d.ts +35 -0
- package/dist/core/src/plugins/legacy-adapter.d.ts.map +1 -0
- package/dist/core/src/plugins/legacy-adapter.js +57 -0
- package/dist/core/src/plugins/legacy-adapter.js.map +1 -0
- package/dist/core/src/plugins/simplified-component-registry.d.ts +40 -0
- package/dist/core/src/plugins/simplified-component-registry.d.ts.map +1 -0
- package/dist/core/src/plugins/simplified-component-registry.js +97 -0
- package/dist/core/src/plugins/simplified-component-registry.js.map +1 -0
- package/dist/core/src/plugins/simplified-lazy-loader.d.ts +65 -0
- package/dist/core/src/plugins/simplified-lazy-loader.d.ts.map +1 -0
- package/dist/core/src/plugins/simplified-lazy-loader.js +205 -0
- package/dist/core/src/plugins/simplified-lazy-loader.js.map +1 -0
- package/dist/core/src/plugins/simplified-plugin-manager.d.ts +24 -0
- package/dist/core/src/plugins/simplified-plugin-manager.d.ts.map +1 -0
- package/dist/core/src/plugins/simplified-plugin-manager.js +77 -0
- package/dist/core/src/plugins/simplified-plugin-manager.js.map +1 -0
- package/dist/core/src/plugins/simplified-tachui-instance.d.ts +54 -0
- package/dist/core/src/plugins/simplified-tachui-instance.d.ts.map +1 -0
- package/dist/core/src/plugins/simplified-tachui-instance.js +114 -0
- package/dist/core/src/plugins/simplified-tachui-instance.js.map +1 -0
- package/dist/core/src/plugins/simplified-types.d.ts +63 -0
- package/dist/core/src/plugins/simplified-types.d.ts.map +1 -0
- package/dist/core/src/plugins/simplified-types.js +18 -0
- package/dist/core/src/plugins/simplified-types.js.map +1 -0
- package/dist/core/src/plugins/simplified-utils.d.ts +39 -0
- package/dist/core/src/plugins/simplified-utils.d.ts.map +1 -0
- package/dist/core/src/plugins/simplified-utils.js +104 -0
- package/dist/core/src/plugins/simplified-utils.js.map +1 -0
- package/dist/core/src/reactive/cleanup.d.ts +115 -0
- package/dist/core/src/reactive/cleanup.d.ts.map +1 -0
- package/dist/core/src/reactive/cleanup.js +187 -0
- package/dist/core/src/reactive/cleanup.js.map +1 -0
- package/dist/core/src/reactive/computed.d.ts +118 -0
- package/dist/core/src/reactive/computed.d.ts.map +1 -0
- package/dist/core/src/reactive/computed.js +261 -0
- package/dist/core/src/reactive/computed.js.map +1 -0
- package/dist/core/src/reactive/context.d.ts +83 -0
- package/dist/core/src/reactive/context.d.ts.map +1 -0
- package/dist/core/src/reactive/context.js +286 -0
- package/dist/core/src/reactive/context.js.map +1 -0
- package/dist/core/src/reactive/effect.d.ts +79 -0
- package/dist/core/src/reactive/effect.d.ts.map +1 -0
- package/dist/core/src/reactive/effect.js +159 -0
- package/dist/core/src/reactive/effect.js.map +1 -0
- package/dist/core/src/reactive/enhanced-effect.d.ts +108 -0
- package/dist/core/src/reactive/enhanced-effect.d.ts.map +1 -0
- package/dist/core/src/reactive/enhanced-effect.js +265 -0
- package/dist/core/src/reactive/enhanced-effect.js.map +1 -0
- package/dist/core/src/reactive/enhanced-signal.d.ts +91 -0
- package/dist/core/src/reactive/enhanced-signal.d.ts.map +1 -0
- package/dist/core/src/reactive/enhanced-signal.js +175 -0
- package/dist/core/src/reactive/enhanced-signal.js.map +1 -0
- package/dist/core/src/reactive/equality.d.ts +51 -0
- package/dist/core/src/reactive/equality.d.ts.map +1 -0
- package/dist/core/src/reactive/equality.js +169 -0
- package/dist/core/src/reactive/equality.js.map +1 -0
- package/dist/core/src/reactive/index.d.ts +22 -0
- package/dist/core/src/reactive/index.d.ts.map +1 -0
- package/dist/core/src/reactive/index.js +33 -0
- package/dist/core/src/reactive/index.js.map +1 -0
- package/dist/core/src/reactive/migration.d.ts +104 -0
- package/dist/core/src/reactive/migration.d.ts.map +1 -0
- package/dist/core/src/reactive/migration.js +257 -0
- package/dist/core/src/reactive/migration.js.map +1 -0
- package/dist/core/src/reactive/ownership.d.ts +75 -0
- package/dist/core/src/reactive/ownership.d.ts.map +1 -0
- package/dist/core/src/reactive/ownership.js +155 -0
- package/dist/core/src/reactive/ownership.js.map +1 -0
- package/dist/core/src/reactive/scheduler.d.ts +56 -0
- package/dist/core/src/reactive/scheduler.d.ts.map +1 -0
- package/dist/core/src/reactive/scheduler.js +263 -0
- package/dist/core/src/reactive/scheduler.js.map +1 -0
- package/dist/core/src/reactive/signal-list.d.ts +100 -0
- package/dist/core/src/reactive/signal-list.d.ts.map +1 -0
- package/dist/core/src/reactive/signal-list.js +240 -0
- package/dist/core/src/reactive/signal-list.js.map +1 -0
- package/dist/core/src/reactive/signal.d.ts +82 -0
- package/dist/core/src/reactive/signal.d.ts.map +1 -0
- package/dist/core/src/reactive/signal.js +172 -0
- package/dist/core/src/reactive/signal.js.map +1 -0
- package/dist/core/src/reactive/theme.d.ts +12 -0
- package/dist/core/src/reactive/theme.d.ts.map +1 -0
- package/dist/core/src/reactive/theme.js +41 -0
- package/dist/core/src/reactive/theme.js.map +1 -0
- package/dist/core/src/reactive/types.d.ts +6 -0
- package/dist/core/src/reactive/types.d.ts.map +1 -0
- package/dist/core/src/reactive/types.js +6 -0
- package/dist/core/src/reactive/types.js.map +1 -0
- package/dist/core/src/reactive/unified-scheduler.d.ts +112 -0
- package/dist/core/src/reactive/unified-scheduler.d.ts.map +1 -0
- package/dist/core/src/reactive/unified-scheduler.js +315 -0
- package/dist/core/src/reactive/unified-scheduler.js.map +1 -0
- package/dist/core/src/runtime/component-context.d.ts +73 -0
- package/dist/core/src/runtime/component-context.d.ts.map +1 -0
- package/dist/core/src/runtime/component-context.js +278 -0
- package/dist/core/src/runtime/component-context.js.map +1 -0
- package/dist/core/src/runtime/component.d.ts +112 -0
- package/dist/core/src/runtime/component.d.ts.map +1 -0
- package/dist/core/src/runtime/component.js +394 -0
- package/dist/core/src/runtime/component.js.map +1 -0
- package/dist/core/src/runtime/context.d.ts +138 -0
- package/dist/core/src/runtime/context.d.ts.map +1 -0
- package/dist/core/src/runtime/context.js +411 -0
- package/dist/core/src/runtime/context.js.map +1 -0
- package/dist/core/src/runtime/dom-bridge.d.ts +70 -0
- package/dist/core/src/runtime/dom-bridge.d.ts.map +1 -0
- package/dist/core/src/runtime/dom-bridge.js +481 -0
- package/dist/core/src/runtime/dom-bridge.js.map +1 -0
- package/dist/core/src/runtime/element-override.d.ts +82 -0
- package/dist/core/src/runtime/element-override.d.ts.map +1 -0
- package/dist/core/src/runtime/element-override.js +360 -0
- package/dist/core/src/runtime/element-override.js.map +1 -0
- package/dist/core/src/runtime/event-delegation.d.ts +59 -0
- package/dist/core/src/runtime/event-delegation.d.ts.map +1 -0
- package/dist/core/src/runtime/event-delegation.js +220 -0
- package/dist/core/src/runtime/event-delegation.js.map +1 -0
- package/dist/core/src/runtime/index.d.ts +24 -0
- package/dist/core/src/runtime/index.d.ts.map +1 -0
- package/dist/core/src/runtime/index.js +36 -0
- package/dist/core/src/runtime/index.js.map +1 -0
- package/dist/core/src/runtime/lazy-component.d.ts +58 -0
- package/dist/core/src/runtime/lazy-component.d.ts.map +1 -0
- package/dist/core/src/runtime/lazy-component.js +206 -0
- package/dist/core/src/runtime/lazy-component.js.map +1 -0
- package/dist/core/src/runtime/lifecycle.d.ts +8 -0
- package/dist/core/src/runtime/lifecycle.d.ts.map +1 -0
- package/dist/core/src/runtime/lifecycle.js +9 -0
- package/dist/core/src/runtime/lifecycle.js.map +1 -0
- package/dist/core/src/runtime/mounting.d.ts +9 -0
- package/dist/core/src/runtime/mounting.d.ts.map +1 -0
- package/dist/core/src/runtime/mounting.js +15 -0
- package/dist/core/src/runtime/mounting.js.map +1 -0
- package/dist/core/src/runtime/optimization.d.ts +8 -0
- package/dist/core/src/runtime/optimization.d.ts.map +1 -0
- package/dist/core/src/runtime/optimization.js +12 -0
- package/dist/core/src/runtime/optimization.js.map +1 -0
- package/dist/core/src/runtime/props.d.ts +154 -0
- package/dist/core/src/runtime/props.d.ts.map +1 -0
- package/dist/core/src/runtime/props.js +389 -0
- package/dist/core/src/runtime/props.js.map +1 -0
- package/dist/core/src/runtime/renderer.d.ts +168 -0
- package/dist/core/src/runtime/renderer.d.ts.map +1 -0
- package/dist/core/src/runtime/renderer.js +1181 -0
- package/dist/core/src/runtime/renderer.js.map +1 -0
- package/dist/core/src/runtime/semantic-role-manager.d.ts +37 -0
- package/dist/core/src/runtime/semantic-role-manager.d.ts.map +1 -0
- package/dist/core/src/runtime/semantic-role-manager.js +102 -0
- package/dist/core/src/runtime/semantic-role-manager.js.map +1 -0
- package/dist/core/src/runtime/types.d.ts +6 -0
- package/dist/core/src/runtime/types.d.ts.map +1 -0
- package/dist/core/src/runtime/types.js +6 -0
- package/dist/core/src/runtime/types.js.map +1 -0
- package/dist/core/src/state/binding.d.ts +96 -0
- package/dist/core/src/state/binding.d.ts.map +1 -0
- package/dist/core/src/state/binding.js +264 -0
- package/dist/core/src/state/binding.js.map +1 -0
- package/dist/core/src/state/environment.d.ts +178 -0
- package/dist/core/src/state/environment.d.ts.map +1 -0
- package/dist/core/src/state/environment.js +272 -0
- package/dist/core/src/state/environment.js.map +1 -0
- package/dist/core/src/state/index.d.ts +108 -0
- package/dist/core/src/state/index.d.ts.map +1 -0
- package/dist/core/src/state/index.js +102 -0
- package/dist/core/src/state/index.js.map +1 -0
- package/dist/core/src/state/observed-object.d.ts +126 -0
- package/dist/core/src/state/observed-object.d.ts.map +1 -0
- package/dist/core/src/state/observed-object.js +330 -0
- package/dist/core/src/state/observed-object.js.map +1 -0
- package/dist/core/src/state/state-manager.d.ts +97 -0
- package/dist/core/src/state/state-manager.d.ts.map +1 -0
- package/dist/core/src/state/state-manager.js +297 -0
- package/dist/core/src/state/state-manager.js.map +1 -0
- package/dist/core/src/state/state.d.ts +78 -0
- package/dist/core/src/state/state.d.ts.map +1 -0
- package/dist/core/src/state/state.js +283 -0
- package/dist/core/src/state/state.js.map +1 -0
- package/dist/core/src/state/types.d.ts +159 -0
- package/dist/core/src/state/types.d.ts.map +1 -0
- package/dist/core/src/state/types.js +8 -0
- package/dist/core/src/state/types.js.map +1 -0
- package/dist/core/src/utils/clone-helpers.d.ts +11 -0
- package/dist/core/src/utils/clone-helpers.d.ts.map +1 -0
- package/dist/core/src/utils/clone-helpers.js +69 -0
- package/dist/core/src/utils/clone-helpers.js.map +1 -0
- package/dist/core/src/validation/build-time-stub.d.ts +33 -0
- package/dist/core/src/validation/build-time-stub.d.ts.map +1 -0
- package/dist/core/src/validation/build-time-stub.js +53 -0
- package/dist/core/src/validation/build-time-stub.js.map +1 -0
- package/dist/core/src/validation/debug-tools-stub.d.ts +67 -0
- package/dist/core/src/validation/debug-tools-stub.d.ts.map +1 -0
- package/dist/core/src/validation/debug-tools-stub.js +94 -0
- package/dist/core/src/validation/debug-tools-stub.js.map +1 -0
- package/dist/core/src/validation/index.d.ts +116 -0
- package/dist/core/src/validation/index.d.ts.map +1 -0
- package/dist/core/src/validation/index.js +306 -0
- package/dist/core/src/validation/index.js.map +1 -0
- package/dist/core/src/validation/lifecycle-validation.d.ts +165 -0
- package/dist/core/src/validation/lifecycle-validation.d.ts.map +1 -0
- package/dist/core/src/validation/lifecycle-validation.js +501 -0
- package/dist/core/src/validation/lifecycle-validation.js.map +1 -0
- package/dist/core/src/validation/performance-optimizer-stub.d.ts +50 -0
- package/dist/core/src/validation/performance-optimizer-stub.d.ts.map +1 -0
- package/dist/core/src/validation/performance-optimizer-stub.js +50 -0
- package/dist/core/src/validation/performance-optimizer-stub.js.map +1 -0
- package/dist/core/src/validation/plugin-registration.d.ts +92 -0
- package/dist/core/src/validation/plugin-registration.d.ts.map +1 -0
- package/dist/core/src/validation/plugin-registration.js +199 -0
- package/dist/core/src/validation/plugin-registration.js.map +1 -0
- package/dist/core/src/validation/production-bypass-core.d.ts +69 -0
- package/dist/core/src/validation/production-bypass-core.d.ts.map +1 -0
- package/dist/core/src/validation/production-bypass-core.js +115 -0
- package/dist/core/src/validation/production-bypass-core.js.map +1 -0
- package/dist/core/src/version.d.ts +19 -0
- package/dist/core/src/version.d.ts.map +1 -0
- package/dist/core/src/version.js +20 -0
- package/dist/core/src/version.js.map +1 -0
- package/dist/devtools/src/build-time/detection.d.ts +32 -0
- package/dist/devtools/src/build-time/detection.d.ts.map +1 -0
- package/dist/devtools/src/build-time/detection.js +327 -0
- package/dist/devtools/src/build-time/detection.js.map +1 -0
- package/dist/devtools/src/build-time/index.d.ts +84 -0
- package/dist/devtools/src/build-time/index.d.ts.map +1 -0
- package/dist/devtools/src/build-time/index.js +157 -0
- package/dist/devtools/src/build-time/index.js.map +1 -0
- package/dist/devtools/src/build-time/plugins.d.ts +75 -0
- package/dist/devtools/src/build-time/plugins.d.ts.map +1 -0
- package/dist/devtools/src/build-time/plugins.js +429 -0
- package/dist/devtools/src/build-time/plugins.js.map +1 -0
- package/dist/devtools/src/build-time/rules.d.ts +73 -0
- package/dist/devtools/src/build-time/rules.d.ts.map +1 -0
- package/dist/devtools/src/build-time/rules.js +622 -0
- package/dist/devtools/src/build-time/rules.js.map +1 -0
- package/dist/devtools/src/build-time/transformer.d.ts +23 -0
- package/dist/devtools/src/build-time/transformer.d.ts.map +1 -0
- package/dist/devtools/src/build-time/transformer.js +294 -0
- package/dist/devtools/src/build-time/transformer.js.map +1 -0
- package/dist/devtools/src/build-time/types.d.ts +212 -0
- package/dist/devtools/src/build-time/types.d.ts.map +1 -0
- package/dist/devtools/src/build-time/types.js +8 -0
- package/dist/devtools/src/build-time/types.js.map +1 -0
- package/dist/devtools/src/debug/debug.d.ts +61 -0
- package/dist/devtools/src/debug/debug.d.ts.map +1 -0
- package/dist/devtools/src/debug/debug.js +239 -0
- package/dist/devtools/src/debug/debug.js.map +1 -0
- package/dist/devtools/src/debug/development-warnings.d.ts +42 -0
- package/dist/devtools/src/debug/development-warnings.d.ts.map +1 -0
- package/dist/devtools/src/debug/development-warnings.js +84 -0
- package/dist/devtools/src/debug/development-warnings.js.map +1 -0
- package/dist/devtools/src/debug/enhanced-errors.d.ts +176 -0
- package/dist/devtools/src/debug/enhanced-errors.d.ts.map +1 -0
- package/dist/devtools/src/debug/enhanced-errors.js +481 -0
- package/dist/devtools/src/debug/enhanced-errors.js.map +1 -0
- package/dist/devtools/src/debug/enhanced-types.d.ts +284 -0
- package/dist/devtools/src/debug/enhanced-types.d.ts.map +1 -0
- package/dist/devtools/src/debug/enhanced-types.js +8 -0
- package/dist/devtools/src/debug/enhanced-types.js.map +1 -0
- package/dist/devtools/src/debug/index.d.ts +13 -0
- package/dist/devtools/src/debug/index.d.ts.map +1 -0
- package/dist/devtools/src/debug/index.js +17 -0
- package/dist/devtools/src/debug/index.js.map +1 -0
- package/dist/devtools/src/debug/validation-debug-tools.d.ts +228 -0
- package/dist/devtools/src/debug/validation-debug-tools.d.ts.map +1 -0
- package/dist/devtools/src/debug/validation-debug-tools.js +472 -0
- package/dist/devtools/src/debug/validation-debug-tools.js.map +1 -0
- package/dist/devtools/src/import-guide.d.ts +50 -0
- package/dist/devtools/src/import-guide.d.ts.map +1 -0
- package/dist/devtools/src/import-guide.js +257 -0
- package/dist/devtools/src/import-guide.js.map +1 -0
- package/dist/devtools/src/index.d.ts +24 -0
- package/dist/devtools/src/index.d.ts.map +1 -0
- package/dist/devtools/src/index.js +32 -0
- package/dist/devtools/src/index.js.map +1 -0
- package/dist/devtools/src/inspector/index.d.ts +232 -0
- package/dist/devtools/src/inspector/index.d.ts.map +1 -0
- package/dist/devtools/src/inspector/index.js +551 -0
- package/dist/devtools/src/inspector/index.js.map +1 -0
- package/dist/devtools/src/modifier-parameter-system.d.ts +69 -0
- package/dist/devtools/src/modifier-parameter-system.d.ts.map +1 -0
- package/dist/devtools/src/modifier-parameter-system.js +462 -0
- package/dist/devtools/src/modifier-parameter-system.js.map +1 -0
- package/dist/devtools/src/plugins/simplified-error-handler.d.ts +83 -0
- package/dist/devtools/src/plugins/simplified-error-handler.d.ts.map +1 -0
- package/dist/devtools/src/plugins/simplified-error-handler.js +335 -0
- package/dist/devtools/src/plugins/simplified-error-handler.js.map +1 -0
- package/dist/devtools/src/profiler/index.d.ts +21 -0
- package/dist/devtools/src/profiler/index.d.ts.map +1 -0
- package/dist/devtools/src/profiler/index.js +30 -0
- package/dist/devtools/src/profiler/index.js.map +1 -0
- package/dist/devtools/src/profiler/performance-optimizer.d.ts +115 -0
- package/dist/devtools/src/profiler/performance-optimizer.d.ts.map +1 -0
- package/dist/devtools/src/profiler/performance-optimizer.js +273 -0
- package/dist/devtools/src/profiler/performance-optimizer.js.map +1 -0
- package/dist/devtools/src/profiler/production-monitoring.d.ts +150 -0
- package/dist/devtools/src/profiler/production-monitoring.d.ts.map +1 -0
- package/dist/devtools/src/profiler/production-monitoring.js +274 -0
- package/dist/devtools/src/profiler/production-monitoring.js.map +1 -0
- package/dist/devtools/src/runtime/error-boundary.d.ts +302 -0
- package/dist/devtools/src/runtime/error-boundary.d.ts.map +1 -0
- package/dist/devtools/src/runtime/error-boundary.js +717 -0
- package/dist/devtools/src/runtime/error-boundary.js.map +1 -0
- package/dist/devtools/src/runtime/error-recovery.d.ts +267 -0
- package/dist/devtools/src/runtime/error-recovery.d.ts.map +1 -0
- package/dist/devtools/src/runtime/error-recovery.js +499 -0
- package/dist/devtools/src/runtime/error-recovery.js.map +1 -0
- package/dist/devtools/src/runtime/error-reporting.d.ts +287 -0
- package/dist/devtools/src/runtime/error-reporting.d.ts.map +1 -0
- package/dist/devtools/src/runtime/error-reporting.js +626 -0
- package/dist/devtools/src/runtime/error-reporting.js.map +1 -0
- package/dist/devtools/src/runtime/error-utils.d.ts +204 -0
- package/dist/devtools/src/runtime/error-utils.d.ts.map +1 -0
- package/dist/devtools/src/runtime/error-utils.js +519 -0
- package/dist/devtools/src/runtime/error-utils.js.map +1 -0
- package/dist/devtools/src/runtime/performance.d.ts +217 -0
- package/dist/devtools/src/runtime/performance.d.ts.map +1 -0
- package/dist/devtools/src/runtime/performance.js +538 -0
- package/dist/devtools/src/runtime/performance.js.map +1 -0
- package/dist/devtools/src/testing/index.d.ts +29 -0
- package/dist/devtools/src/testing/index.d.ts.map +1 -0
- package/dist/devtools/src/testing/index.js +48 -0
- package/dist/devtools/src/testing/index.js.map +1 -0
- package/dist/devtools/src/validation/enhanced-runtime.d.ts +310 -0
- package/dist/devtools/src/validation/enhanced-runtime.d.ts.map +1 -0
- package/dist/devtools/src/validation/enhanced-runtime.js +603 -0
- package/dist/devtools/src/validation/enhanced-runtime.js.map +1 -0
- package/dist/devtools/src/validation/error-reporting.d.ts +186 -0
- package/dist/devtools/src/validation/error-reporting.d.ts.map +1 -0
- package/dist/devtools/src/validation/error-reporting.js +439 -0
- package/dist/devtools/src/validation/error-reporting.js.map +1 -0
- package/dist/scaffold/core-version-map.d.ts.map +1 -1
- package/dist/scaffold/core-version-map.js +9 -4
- package/dist/scaffold/core-version-map.js.map +1 -1
- package/package.json +3 -3
- package/templates/advanced/package.json.template +3 -1
- package/templates/advanced/src/App.ts.template +11 -22
- package/templates/advanced/src/main.ts.template +3 -2
- package/templates/basic/package.json.template +3 -1
- package/templates/basic/src/App.ts.template +6 -12
- package/templates/basic/src/main.ts.template +3 -2
|
@@ -0,0 +1,1078 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Modifier System Implementation
|
|
3
|
+
*
|
|
4
|
+
* Core modifier classes and utilities for the SwiftUI-inspired modifier system.
|
|
5
|
+
*/
|
|
6
|
+
import { createEffect, getThemeSignal, isComputed, isSignal, } from '../reactive';
|
|
7
|
+
import { ModifierPriority } from './types';
|
|
8
|
+
import { isInfinity, dimensionToCSS, shouldExpandForInfinity, } from '../constants/layout';
|
|
9
|
+
import { bindReactiveStyle } from './reactive-style-bindings';
|
|
10
|
+
export { bindReactiveStyle, setReactiveStyleUpdaterErrorHandler, } from './reactive-style-bindings';
|
|
11
|
+
const modifierInstanceIdSymbol = Symbol.for('tachui.modifier.instanceId');
|
|
12
|
+
const updaterScope = 'core';
|
|
13
|
+
let modifierInstanceIdCounter = 0;
|
|
14
|
+
function getModifierInstanceId(modifier) {
|
|
15
|
+
const existingId = modifier[modifierInstanceIdSymbol];
|
|
16
|
+
if (typeof existingId === 'number')
|
|
17
|
+
return existingId;
|
|
18
|
+
modifierInstanceIdCounter += 1;
|
|
19
|
+
const nextId = modifierInstanceIdCounter;
|
|
20
|
+
Object.defineProperty(modifier, modifierInstanceIdSymbol, {
|
|
21
|
+
value: nextId,
|
|
22
|
+
enumerable: false,
|
|
23
|
+
configurable: false,
|
|
24
|
+
writable: false,
|
|
25
|
+
});
|
|
26
|
+
return nextId;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Abstract base modifier class
|
|
30
|
+
*/
|
|
31
|
+
export class BaseModifier {
|
|
32
|
+
properties;
|
|
33
|
+
constructor(properties) {
|
|
34
|
+
this.properties = properties;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Helper to resolve reactive properties
|
|
38
|
+
*/
|
|
39
|
+
resolveReactiveProps(props, context) {
|
|
40
|
+
const resolved = {};
|
|
41
|
+
for (const [key, value] of Object.entries(props)) {
|
|
42
|
+
if (isSignal(value) || isComputed(value)) {
|
|
43
|
+
// Preserve the signal/computed - let applyStyles handle reactivity
|
|
44
|
+
resolved[key] = value;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Static value
|
|
48
|
+
resolved[key] = value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Context parameter is kept for compatibility but not used in new approach
|
|
52
|
+
void context;
|
|
53
|
+
return resolved;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Apply a single style change to an element with reactive support
|
|
57
|
+
*/
|
|
58
|
+
applyStyleChange(element, property, value) {
|
|
59
|
+
if (element instanceof HTMLElement) {
|
|
60
|
+
const cssProperty = this.toCSSProperty(property);
|
|
61
|
+
// Handle reactive values (signals and computed)
|
|
62
|
+
if (isSignal(value) || isComputed(value)) {
|
|
63
|
+
// Create reactive effect for this style property
|
|
64
|
+
createEffect(() => {
|
|
65
|
+
const currentValue = value();
|
|
66
|
+
const cssValue = String(currentValue);
|
|
67
|
+
// Check if value contains !important and handle it properly
|
|
68
|
+
if (cssValue.includes('!important')) {
|
|
69
|
+
const actualValue = cssValue.replace(/\s*!important\s*$/, '').trim();
|
|
70
|
+
element.style.setProperty(cssProperty, actualValue, 'important');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
element.style.setProperty(cssProperty, cssValue);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// Handle static values
|
|
79
|
+
const cssValue = String(value);
|
|
80
|
+
// Check if value contains !important and handle it properly
|
|
81
|
+
if (cssValue.includes('!important')) {
|
|
82
|
+
const actualValue = cssValue.replace(/\s*!important\s*$/, '').trim();
|
|
83
|
+
element.style.setProperty(cssProperty, actualValue, 'important');
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
element.style.setProperty(cssProperty, cssValue);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Convert camelCase property to CSS kebab-case
|
|
93
|
+
*/
|
|
94
|
+
toCSSProperty(property) {
|
|
95
|
+
return property.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Convert value to CSS value string
|
|
99
|
+
*/
|
|
100
|
+
toCSSValue(value) {
|
|
101
|
+
if (typeof value === 'number') {
|
|
102
|
+
return `${value}px`;
|
|
103
|
+
}
|
|
104
|
+
return String(value);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Convert value to CSS value string with property-specific handling
|
|
108
|
+
*/
|
|
109
|
+
toCSSValueForProperty(property, value) {
|
|
110
|
+
if (typeof value === 'number') {
|
|
111
|
+
// Properties that should be unitless
|
|
112
|
+
const unitlessProperties = [
|
|
113
|
+
'opacity',
|
|
114
|
+
'z-index',
|
|
115
|
+
'line-height',
|
|
116
|
+
'flex-grow',
|
|
117
|
+
'flex-shrink',
|
|
118
|
+
'order',
|
|
119
|
+
'column-count',
|
|
120
|
+
'font-weight',
|
|
121
|
+
];
|
|
122
|
+
if (unitlessProperties.includes(property)) {
|
|
123
|
+
return String(value);
|
|
124
|
+
}
|
|
125
|
+
return `${value}px`;
|
|
126
|
+
}
|
|
127
|
+
// Properties that should be passed through as-is (no processing)
|
|
128
|
+
const passthroughProperties = [
|
|
129
|
+
'filter', // CSS filter strings should not be processed
|
|
130
|
+
'transform', // CSS transform strings
|
|
131
|
+
'clip-path', // CSS clip-path strings
|
|
132
|
+
];
|
|
133
|
+
if (passthroughProperties.includes(property)) {
|
|
134
|
+
return String(value);
|
|
135
|
+
}
|
|
136
|
+
return String(value);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Apply multiple CSS properties to an element with reactive support
|
|
140
|
+
*/
|
|
141
|
+
applyStyles(element, styles) {
|
|
142
|
+
// Check if element has a style property (for testing and real elements)
|
|
143
|
+
if (element instanceof HTMLElement || element.style) {
|
|
144
|
+
const styleTarget = element instanceof HTMLElement ? element.style : element.style;
|
|
145
|
+
const applyStyleValue = (propertyName, cssValue) => {
|
|
146
|
+
if (styleTarget.setProperty) {
|
|
147
|
+
if (typeof cssValue === 'string' &&
|
|
148
|
+
cssValue.includes('!important')) {
|
|
149
|
+
const actualValue = cssValue.replace(/\s*!important\s*$/, '').trim();
|
|
150
|
+
styleTarget.setProperty(propertyName, actualValue, 'important');
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
styleTarget.setProperty(propertyName, cssValue);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
;
|
|
158
|
+
styleTarget[propertyName] = cssValue;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
for (const [property, value] of Object.entries(styles)) {
|
|
162
|
+
if (value !== undefined) {
|
|
163
|
+
const cssProperty = this.toCSSProperty(property);
|
|
164
|
+
// Handle reactive values (signals and computed)
|
|
165
|
+
if (isSignal(value) || isComputed(value)) {
|
|
166
|
+
const signalValue = value;
|
|
167
|
+
const modifierInstanceId = getModifierInstanceId(this);
|
|
168
|
+
bindReactiveStyle({
|
|
169
|
+
element,
|
|
170
|
+
accessor: signalValue,
|
|
171
|
+
updaterId: `${updaterScope}:${modifierInstanceId}:${cssProperty}`,
|
|
172
|
+
updater: currentValue => {
|
|
173
|
+
const cssValue = this.toCSSValueForProperty(cssProperty, currentValue);
|
|
174
|
+
applyStyleValue(cssProperty, cssValue);
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
// Handle static values
|
|
180
|
+
const cssValue = this.toCSSValueForProperty(cssProperty, value);
|
|
181
|
+
applyStyleValue(cssProperty, cssValue);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Add CSS classes to an element
|
|
189
|
+
*/
|
|
190
|
+
addClasses(element, classes) {
|
|
191
|
+
if (element instanceof HTMLElement) {
|
|
192
|
+
element.classList.add(...classes);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Remove CSS classes from an element
|
|
197
|
+
*/
|
|
198
|
+
removeClasses(element, classes) {
|
|
199
|
+
if (element instanceof HTMLElement) {
|
|
200
|
+
element.classList.remove(...classes);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Create a style computation context
|
|
205
|
+
*/
|
|
206
|
+
createStyleContext(componentId, element, modifiers) {
|
|
207
|
+
return {
|
|
208
|
+
componentId,
|
|
209
|
+
element,
|
|
210
|
+
modifiers,
|
|
211
|
+
signals: new Set(),
|
|
212
|
+
cleanup: [],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Layout modifier for frame, padding, margin
|
|
218
|
+
*/
|
|
219
|
+
export class LayoutModifier extends BaseModifier {
|
|
220
|
+
type = 'layout';
|
|
221
|
+
priority = ModifierPriority.LAYOUT;
|
|
222
|
+
apply(node, context) {
|
|
223
|
+
if (!node.element || !context.element)
|
|
224
|
+
return;
|
|
225
|
+
const styleContext = this.createStyleContext(context.componentId, context.element, []);
|
|
226
|
+
const styles = this.computeLayoutStyles(this.properties, styleContext);
|
|
227
|
+
this.applyStyles(context.element, styles);
|
|
228
|
+
// Layout modifiers (offset, aspectRatio, scaleEffect, zIndex) have been
|
|
229
|
+
// migrated to @tachui/modifiers/layout for enhanced functionality
|
|
230
|
+
// Handle absolutePosition separately for proper positioning (Phase 3 - Epic: Butternut)
|
|
231
|
+
const props = this.properties;
|
|
232
|
+
if (props.position && context.element instanceof HTMLElement) {
|
|
233
|
+
this.applyAbsolutePosition(context.element, props.position);
|
|
234
|
+
}
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
// Layout modifier implementations have been migrated to @tachui/modifiers/layout
|
|
238
|
+
applyAbsolutePosition(element, position) {
|
|
239
|
+
const { x, y } = position;
|
|
240
|
+
const currentX = x ?? 'auto';
|
|
241
|
+
const currentY = y ?? 'auto';
|
|
242
|
+
// Position-based transform (not a scale or offset, but absolute positioning)
|
|
243
|
+
element.style.left = this.toCSSValue(currentX);
|
|
244
|
+
element.style.top = this.toCSSValue(currentY);
|
|
245
|
+
}
|
|
246
|
+
computeLayoutStyles(props, _context) {
|
|
247
|
+
const styles = {};
|
|
248
|
+
// Frame properties - handle infinity values properly
|
|
249
|
+
if (props.frame) {
|
|
250
|
+
const frame = props.frame;
|
|
251
|
+
// Check for infinity constraints and apply appropriate flex/size styles
|
|
252
|
+
const infinityResult = shouldExpandForInfinity(frame);
|
|
253
|
+
Object.assign(styles, infinityResult.cssProps);
|
|
254
|
+
// Convert dimensions to CSS, handling infinity appropriately
|
|
255
|
+
// Don't apply explicit width/height if infinity expansion is happening
|
|
256
|
+
if (frame.width !== undefined) {
|
|
257
|
+
const cssValue = dimensionToCSS(frame.width);
|
|
258
|
+
if (cssValue !== undefined &&
|
|
259
|
+
!isInfinity(frame.width) &&
|
|
260
|
+
!infinityResult.expandWidth) {
|
|
261
|
+
styles.width = cssValue;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (frame.height !== undefined) {
|
|
265
|
+
const cssValue = dimensionToCSS(frame.height);
|
|
266
|
+
if (cssValue !== undefined &&
|
|
267
|
+
!isInfinity(frame.height) &&
|
|
268
|
+
!infinityResult.expandHeight) {
|
|
269
|
+
styles.height = cssValue;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (frame.minWidth !== undefined) {
|
|
273
|
+
const cssValue = dimensionToCSS(frame.minWidth);
|
|
274
|
+
if (cssValue !== undefined) {
|
|
275
|
+
styles.minWidth = cssValue;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (frame.maxWidth !== undefined && !isInfinity(frame.maxWidth)) {
|
|
279
|
+
const cssValue = dimensionToCSS(frame.maxWidth);
|
|
280
|
+
if (cssValue !== undefined) {
|
|
281
|
+
styles.maxWidth = cssValue;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else if (isInfinity(frame.maxWidth)) {
|
|
285
|
+
// SwiftUI compatibility: maxWidth infinity means expand to fill available width
|
|
286
|
+
// Remove maxWidth constraint and use flex properties for expansion
|
|
287
|
+
styles.maxWidth = 'none';
|
|
288
|
+
styles.flexGrow = '1 !important';
|
|
289
|
+
styles.flexShrink = '1 !important';
|
|
290
|
+
styles.flexBasis = '0% !important';
|
|
291
|
+
styles.alignSelf = 'stretch !important';
|
|
292
|
+
}
|
|
293
|
+
if (frame.minHeight !== undefined) {
|
|
294
|
+
const cssValue = dimensionToCSS(frame.minHeight);
|
|
295
|
+
if (cssValue !== undefined) {
|
|
296
|
+
styles.minHeight = cssValue;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (frame.maxHeight !== undefined && !isInfinity(frame.maxHeight)) {
|
|
300
|
+
const cssValue = dimensionToCSS(frame.maxHeight);
|
|
301
|
+
if (cssValue !== undefined) {
|
|
302
|
+
styles.maxHeight = cssValue;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
else if (isInfinity(frame.maxHeight)) {
|
|
306
|
+
// SwiftUI compatibility: maxHeight infinity means expand to fill available height
|
|
307
|
+
// Remove maxHeight constraint and use flex properties for expansion
|
|
308
|
+
styles.maxHeight = 'none';
|
|
309
|
+
styles.flexGrow = '1 !important';
|
|
310
|
+
styles.flexShrink = '1 !important';
|
|
311
|
+
styles.flexBasis = '0% !important';
|
|
312
|
+
styles.alignSelf = 'stretch !important';
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// Padding
|
|
316
|
+
if (props.padding !== undefined) {
|
|
317
|
+
if (typeof props.padding === 'number') {
|
|
318
|
+
styles.padding = this.toCSSValue(props.padding);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
const p = props.padding;
|
|
322
|
+
if (p.top !== undefined)
|
|
323
|
+
styles.paddingTop = this.toCSSValue(p.top);
|
|
324
|
+
if (p.right !== undefined)
|
|
325
|
+
styles.paddingRight = this.toCSSValue(p.right);
|
|
326
|
+
if (p.bottom !== undefined)
|
|
327
|
+
styles.paddingBottom = this.toCSSValue(p.bottom);
|
|
328
|
+
if (p.left !== undefined)
|
|
329
|
+
styles.paddingLeft = this.toCSSValue(p.left);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// Margin
|
|
333
|
+
if (props.margin !== undefined) {
|
|
334
|
+
if (typeof props.margin === 'number') {
|
|
335
|
+
styles.margin = this.toCSSValue(props.margin);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
const m = props.margin;
|
|
339
|
+
if (m.top !== undefined)
|
|
340
|
+
styles.marginTop = this.toCSSValue(m.top);
|
|
341
|
+
if (m.right !== undefined)
|
|
342
|
+
styles.marginRight = this.toCSSValue(m.right);
|
|
343
|
+
if (m.bottom !== undefined)
|
|
344
|
+
styles.marginBottom = this.toCSSValue(m.bottom);
|
|
345
|
+
if (m.left !== undefined)
|
|
346
|
+
styles.marginLeft = this.toCSSValue(m.left);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// Alignment
|
|
350
|
+
if (props.alignment) {
|
|
351
|
+
switch (props.alignment) {
|
|
352
|
+
case 'leading':
|
|
353
|
+
styles.textAlign = 'left';
|
|
354
|
+
styles.alignItems = 'flex-start';
|
|
355
|
+
break;
|
|
356
|
+
case 'center':
|
|
357
|
+
styles.textAlign = 'center';
|
|
358
|
+
styles.alignItems = 'center';
|
|
359
|
+
break;
|
|
360
|
+
case 'trailing':
|
|
361
|
+
styles.textAlign = 'right';
|
|
362
|
+
styles.alignItems = 'flex-end';
|
|
363
|
+
break;
|
|
364
|
+
case 'top':
|
|
365
|
+
styles.alignItems = 'flex-start';
|
|
366
|
+
break;
|
|
367
|
+
case 'bottom':
|
|
368
|
+
styles.alignItems = 'flex-end';
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Layout Priority
|
|
373
|
+
// In SwiftUI, layoutPriority determines which views get priority in sizing
|
|
374
|
+
// Higher priority views determine container size in ZStack
|
|
375
|
+
// We implement this using CSS flexbox properties for flexible layouts
|
|
376
|
+
if (props.layoutPriority !== undefined) {
|
|
377
|
+
const priority = Number(props.layoutPriority);
|
|
378
|
+
// Set flex properties based on priority
|
|
379
|
+
// Higher priority = less flex shrink, more flex grow
|
|
380
|
+
if (priority > 0) {
|
|
381
|
+
// High priority: Don't shrink, allow growth
|
|
382
|
+
styles.flexShrink = '0';
|
|
383
|
+
styles.flexGrow = String(Math.max(1, priority / 10));
|
|
384
|
+
// For ZStack containers, higher priority elements determine size
|
|
385
|
+
// We use z-index for layering and flex properties for sizing behavior
|
|
386
|
+
styles.zIndex = String(priority);
|
|
387
|
+
// In grid layouts, higher priority gets more space
|
|
388
|
+
styles.gridRowEnd = `span ${String(Math.min(10, Math.max(1, Math.ceil(priority / 10))))}`;
|
|
389
|
+
styles.gridColumnEnd = `span ${String(Math.min(10, Math.max(1, Math.ceil(priority / 10))))}`;
|
|
390
|
+
}
|
|
391
|
+
else if (priority === 0) {
|
|
392
|
+
// Default priority: Normal flex behavior
|
|
393
|
+
styles.flexShrink = '1';
|
|
394
|
+
styles.flexGrow = '1';
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
// Low priority: Shrink more, grow less
|
|
398
|
+
styles.flexShrink = String(Math.abs(priority));
|
|
399
|
+
styles.flexGrow = '0';
|
|
400
|
+
styles.zIndex = String(priority);
|
|
401
|
+
}
|
|
402
|
+
// For containers that need to size based on highest priority child
|
|
403
|
+
// We use CSS custom properties that can be read by parent containers
|
|
404
|
+
if (styles && typeof styles === 'object' && 'setProperty' in styles) {
|
|
405
|
+
;
|
|
406
|
+
styles.setProperty('--layout-priority', String(priority));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
// Offset modifier (SwiftUI .offset(x, y))
|
|
410
|
+
// Note: Offset handling is done in the apply method with proper reactive support
|
|
411
|
+
// This is just for setting up the basic structure
|
|
412
|
+
if (props.offset) {
|
|
413
|
+
// The actual transform application happens in apply() method
|
|
414
|
+
// to handle both reactive and static values properly
|
|
415
|
+
}
|
|
416
|
+
// Aspect Ratio modifier (SwiftUI .aspectRatio(ratio, contentMode))
|
|
417
|
+
if (props.aspectRatio) {
|
|
418
|
+
const { ratio, contentMode } = props.aspectRatio;
|
|
419
|
+
if (ratio !== undefined) {
|
|
420
|
+
// Apply CSS aspect-ratio property
|
|
421
|
+
styles.aspectRatio = typeof ratio === 'number' ? String(ratio) : ratio;
|
|
422
|
+
// Handle content mode
|
|
423
|
+
if (contentMode === 'fill') {
|
|
424
|
+
styles.objectFit = 'cover';
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
styles.objectFit = 'contain';
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
// Fixed Size modifier (SwiftUI .fixedSize())
|
|
432
|
+
if (props.fixedSize) {
|
|
433
|
+
const { horizontal, vertical } = props.fixedSize;
|
|
434
|
+
if (horizontal) {
|
|
435
|
+
styles.flexShrink = '0';
|
|
436
|
+
styles.width = 'max-content';
|
|
437
|
+
}
|
|
438
|
+
if (vertical) {
|
|
439
|
+
styles.flexShrink = '0';
|
|
440
|
+
styles.height = 'max-content';
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return styles;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Appearance modifier for colors, fonts, borders, shadows
|
|
448
|
+
*/
|
|
449
|
+
export class AppearanceModifier extends BaseModifier {
|
|
450
|
+
type = 'appearance';
|
|
451
|
+
priority = ModifierPriority.APPEARANCE;
|
|
452
|
+
apply(node, context) {
|
|
453
|
+
if (!node.element || !context.element) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
const styleContext = this.createStyleContext(context.componentId, context.element, []);
|
|
457
|
+
const resolved = this.resolveReactiveProps(this.properties, styleContext);
|
|
458
|
+
// Handle Assets separately with theme reactivity
|
|
459
|
+
this.applyAssetBasedStyles(context.element, resolved);
|
|
460
|
+
// Handle non-Asset styles normally
|
|
461
|
+
const styles = this.computeAppearanceStyles(resolved);
|
|
462
|
+
this.applyStyles(context.element, styles);
|
|
463
|
+
// Handle HTML attributes (ARIA, role, navigation, etc.)
|
|
464
|
+
this.applyAttributes(context.element, resolved);
|
|
465
|
+
return undefined;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Apply Asset-based styles with theme reactivity
|
|
469
|
+
*/
|
|
470
|
+
applyAssetBasedStyles(element, props) {
|
|
471
|
+
// Get the shared theme signal
|
|
472
|
+
const themeSignal = getThemeSignal();
|
|
473
|
+
// Handle foregroundColor Asset
|
|
474
|
+
if (props.foregroundColor && this.isAsset(props.foregroundColor)) {
|
|
475
|
+
createEffect(() => {
|
|
476
|
+
// Watch theme changes to trigger re-resolution
|
|
477
|
+
themeSignal();
|
|
478
|
+
// Re-resolve Asset when theme changes
|
|
479
|
+
const resolvedColor = props.foregroundColor.resolve();
|
|
480
|
+
this.applyStyleChange(element, 'color', resolvedColor);
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
// Handle backgroundColor Asset
|
|
484
|
+
if (props.backgroundColor && this.isAsset(props.backgroundColor)) {
|
|
485
|
+
createEffect(() => {
|
|
486
|
+
// Watch theme changes to trigger re-resolution
|
|
487
|
+
themeSignal();
|
|
488
|
+
// Re-resolve Asset when theme changes
|
|
489
|
+
const resolvedColor = props.backgroundColor.resolve();
|
|
490
|
+
this.applyStyleChange(element, 'backgroundColor', resolvedColor);
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
// Handle border color Asset
|
|
494
|
+
if (props.border?.color && this.isAsset(props.border.color)) {
|
|
495
|
+
createEffect(() => {
|
|
496
|
+
// Watch theme changes
|
|
497
|
+
themeSignal();
|
|
498
|
+
// Re-resolve Asset when theme changes
|
|
499
|
+
const resolvedColor = props.border.color.resolve();
|
|
500
|
+
this.applyStyleChange(element, 'borderColor', resolvedColor);
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Check if a value is an Asset object (including Asset proxies)
|
|
506
|
+
*/
|
|
507
|
+
isAsset(value) {
|
|
508
|
+
return (value !== null &&
|
|
509
|
+
value !== undefined &&
|
|
510
|
+
typeof value === 'object' &&
|
|
511
|
+
'resolve' in value &&
|
|
512
|
+
typeof value.resolve === 'function');
|
|
513
|
+
}
|
|
514
|
+
computeAppearanceStyles(props) {
|
|
515
|
+
const styles = {};
|
|
516
|
+
// Colors (skip Assets - they're handled reactively in applyAssetBasedStyles)
|
|
517
|
+
if (props.foregroundColor && !this.isAsset(props.foregroundColor)) {
|
|
518
|
+
styles.color = props.foregroundColor;
|
|
519
|
+
}
|
|
520
|
+
if (props.backgroundColor && !this.isAsset(props.backgroundColor)) {
|
|
521
|
+
styles.backgroundColor = props.backgroundColor;
|
|
522
|
+
}
|
|
523
|
+
if (props.opacity !== undefined)
|
|
524
|
+
styles.opacity = props.opacity;
|
|
525
|
+
// Font
|
|
526
|
+
if (props.font) {
|
|
527
|
+
const font = props.font;
|
|
528
|
+
if (font.family) {
|
|
529
|
+
// Handle FontAsset objects that need to be resolved
|
|
530
|
+
if (typeof font.family === 'object' &&
|
|
531
|
+
font.family !== null &&
|
|
532
|
+
typeof font.family.resolve === 'function') {
|
|
533
|
+
const resolved = font.family.resolve();
|
|
534
|
+
styles.fontFamily = resolved;
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
styles.fontFamily = font.family;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (font.size !== undefined) {
|
|
541
|
+
styles.fontSize =
|
|
542
|
+
isSignal(font.size) || isComputed(font.size)
|
|
543
|
+
? font.size
|
|
544
|
+
: this.toCSSValue(font.size);
|
|
545
|
+
}
|
|
546
|
+
if (font.weight !== undefined) {
|
|
547
|
+
styles.fontWeight =
|
|
548
|
+
isSignal(font.weight) || isComputed(font.weight)
|
|
549
|
+
? font.weight
|
|
550
|
+
: String(font.weight);
|
|
551
|
+
}
|
|
552
|
+
if (font.style)
|
|
553
|
+
styles.fontStyle = font.style;
|
|
554
|
+
}
|
|
555
|
+
// Corner radius
|
|
556
|
+
if (props.cornerRadius !== undefined) {
|
|
557
|
+
styles.borderRadius = this.toCSSValue(props.cornerRadius);
|
|
558
|
+
}
|
|
559
|
+
// Border
|
|
560
|
+
if (props.border) {
|
|
561
|
+
const border = props.border;
|
|
562
|
+
if (border.width !== undefined)
|
|
563
|
+
styles.borderWidth = this.toCSSValue(border.width);
|
|
564
|
+
if (border.color && !this.isAsset(border.color)) {
|
|
565
|
+
styles.borderColor = border.color;
|
|
566
|
+
}
|
|
567
|
+
if (border.style)
|
|
568
|
+
styles.borderStyle = border.style;
|
|
569
|
+
}
|
|
570
|
+
// Shadow functionality moved to @tachui/modifiers/effects entry point
|
|
571
|
+
// Clipped and Clip Shape modifiers moved to @tachui/modifiers package
|
|
572
|
+
// Visual Effects (Phase 2 - Epic: Butternut)
|
|
573
|
+
const filters = [];
|
|
574
|
+
if (props.blur !== undefined) {
|
|
575
|
+
filters.push(`blur(${props.blur}px)`);
|
|
576
|
+
}
|
|
577
|
+
if (props.brightness !== undefined) {
|
|
578
|
+
filters.push(`brightness(${props.brightness})`);
|
|
579
|
+
}
|
|
580
|
+
if (props.contrast !== undefined) {
|
|
581
|
+
filters.push(`contrast(${props.contrast})`);
|
|
582
|
+
}
|
|
583
|
+
if (props.saturation !== undefined) {
|
|
584
|
+
filters.push(`saturate(${props.saturation})`);
|
|
585
|
+
}
|
|
586
|
+
if (props.hueRotation !== undefined) {
|
|
587
|
+
filters.push(`hue-rotate(${props.hueRotation}deg)`);
|
|
588
|
+
}
|
|
589
|
+
if (props.grayscale !== undefined) {
|
|
590
|
+
filters.push(`grayscale(${props.grayscale})`);
|
|
591
|
+
}
|
|
592
|
+
if (props.colorInvert !== undefined) {
|
|
593
|
+
filters.push(`invert(${props.colorInvert})`);
|
|
594
|
+
}
|
|
595
|
+
if (filters.length > 0) {
|
|
596
|
+
styles.filter = filters.join(' ');
|
|
597
|
+
}
|
|
598
|
+
return styles;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Apply HTML attributes (ARIA, role, data attributes, etc.)
|
|
602
|
+
*/
|
|
603
|
+
applyAttributes(element, props) {
|
|
604
|
+
if (!element)
|
|
605
|
+
return;
|
|
606
|
+
// Also need to get the component from the context to update props
|
|
607
|
+
// This is a hack, but needed for tests that expect attributes on component.props
|
|
608
|
+
const component = this.findComponentFromElement(element);
|
|
609
|
+
// Common HTML attributes
|
|
610
|
+
if (props.role !== undefined) {
|
|
611
|
+
element.setAttribute('role', String(props.role));
|
|
612
|
+
if (component?.props) {
|
|
613
|
+
component.props.role = String(props.role);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
// ARIA attributes
|
|
617
|
+
if (props['aria-label'] !== undefined) {
|
|
618
|
+
element.setAttribute('aria-label', String(props['aria-label']));
|
|
619
|
+
if (component?.props) {
|
|
620
|
+
component.props['aria-label'] = String(props['aria-label']);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (props['aria-live'] !== undefined) {
|
|
624
|
+
element.setAttribute('aria-live', String(props['aria-live']));
|
|
625
|
+
if (component?.props) {
|
|
626
|
+
component.props['aria-live'] = String(props['aria-live']);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (props['aria-describedby'] !== undefined) {
|
|
630
|
+
element.setAttribute('aria-describedby', String(props['aria-describedby']));
|
|
631
|
+
if (component?.props) {
|
|
632
|
+
component.props['aria-describedby'] = String(props['aria-describedby']);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
if (props['aria-modal'] !== undefined) {
|
|
636
|
+
element.setAttribute('aria-modal', String(props['aria-modal']));
|
|
637
|
+
if (component?.props) {
|
|
638
|
+
component.props['aria-modal'] = String(props['aria-modal']);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if (props['aria-hidden'] !== undefined) {
|
|
642
|
+
element.setAttribute('aria-hidden', String(props['aria-hidden']));
|
|
643
|
+
if (component?.props) {
|
|
644
|
+
component.props['aria-hidden'] = String(props['aria-hidden']);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
// Navigation attributes (for custom processing by navigation system)
|
|
648
|
+
if (props.navigationTitle !== undefined) {
|
|
649
|
+
element.setAttribute('data-navigation-title', String(props.navigationTitle));
|
|
650
|
+
if (component?.props) {
|
|
651
|
+
component.props.navigationTitle = String(props.navigationTitle);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (props.navigationBarHidden !== undefined) {
|
|
655
|
+
element.setAttribute('data-navigation-bar-hidden', String(props.navigationBarHidden));
|
|
656
|
+
if (component?.props) {
|
|
657
|
+
component.props.navigationBarHidden = props.navigationBarHidden;
|
|
658
|
+
}
|
|
659
|
+
// Also apply aria-hidden for accessibility
|
|
660
|
+
if (props.navigationBarHidden) {
|
|
661
|
+
element.setAttribute('aria-hidden', 'true');
|
|
662
|
+
if (component?.props) {
|
|
663
|
+
component.props['aria-hidden'] = 'true';
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (props.navigationBarItems !== undefined) {
|
|
668
|
+
// Store as JSON in data attribute for navigation system to process
|
|
669
|
+
element.setAttribute('data-navigation-bar-items', JSON.stringify(props.navigationBarItems));
|
|
670
|
+
if (component?.props) {
|
|
671
|
+
component.props.navigationBarItems = props.navigationBarItems;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
findComponentFromElement(element) {
|
|
676
|
+
// Try to find the component instance associated with this element
|
|
677
|
+
// This is a simplified approach - in a real implementation, we'd have a proper mapping
|
|
678
|
+
return element._tachui_component || null;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Interaction modifier for events and accessibility
|
|
683
|
+
*/
|
|
684
|
+
export class InteractionModifier extends BaseModifier {
|
|
685
|
+
type = 'interaction';
|
|
686
|
+
priority = ModifierPriority.INTERACTION;
|
|
687
|
+
apply(_node, context) {
|
|
688
|
+
if (!context.element)
|
|
689
|
+
return;
|
|
690
|
+
const props = this.properties;
|
|
691
|
+
// Event handlers
|
|
692
|
+
if (props.onTap) {
|
|
693
|
+
context.element.addEventListener('click', props.onTap);
|
|
694
|
+
}
|
|
695
|
+
if (props.onHover) {
|
|
696
|
+
context.element.addEventListener('mouseenter', () => props.onHover(true));
|
|
697
|
+
context.element.addEventListener('mouseleave', () => props.onHover(false));
|
|
698
|
+
}
|
|
699
|
+
if (props.onMouseEnter) {
|
|
700
|
+
context.element.addEventListener('mouseenter', props.onMouseEnter);
|
|
701
|
+
}
|
|
702
|
+
if (props.onMouseLeave) {
|
|
703
|
+
context.element.addEventListener('mouseleave', props.onMouseLeave);
|
|
704
|
+
}
|
|
705
|
+
if (props.onMouseDown) {
|
|
706
|
+
context.element.addEventListener('mousedown', props.onMouseDown);
|
|
707
|
+
}
|
|
708
|
+
if (props.onMouseUp) {
|
|
709
|
+
context.element.addEventListener('mouseup', props.onMouseUp);
|
|
710
|
+
}
|
|
711
|
+
if (props.onDragStart) {
|
|
712
|
+
context.element.addEventListener('dragstart', props.onDragStart);
|
|
713
|
+
}
|
|
714
|
+
if (props.onDragOver) {
|
|
715
|
+
context.element.addEventListener('dragover', props.onDragOver);
|
|
716
|
+
}
|
|
717
|
+
if (props.onDragLeave) {
|
|
718
|
+
context.element.addEventListener('dragleave', props.onDragLeave);
|
|
719
|
+
}
|
|
720
|
+
if (props.onDrop) {
|
|
721
|
+
context.element.addEventListener('drop', props.onDrop);
|
|
722
|
+
}
|
|
723
|
+
// Additional mouse events
|
|
724
|
+
if (props.onDoubleClick) {
|
|
725
|
+
context.element.addEventListener('dblclick', props.onDoubleClick);
|
|
726
|
+
}
|
|
727
|
+
if (props.onContextMenu) {
|
|
728
|
+
context.element.addEventListener('contextmenu', props.onContextMenu);
|
|
729
|
+
}
|
|
730
|
+
// Focus events
|
|
731
|
+
if (props.onFocus) {
|
|
732
|
+
context.element.addEventListener('focus', () => props.onFocus(true));
|
|
733
|
+
context.element.addEventListener('blur', () => props.onFocus(false));
|
|
734
|
+
}
|
|
735
|
+
if (props.onBlur) {
|
|
736
|
+
context.element.addEventListener('blur', () => props.onBlur(false));
|
|
737
|
+
}
|
|
738
|
+
// Keyboard events
|
|
739
|
+
if (props.onKeyPress) {
|
|
740
|
+
context.element.addEventListener('keypress', props.onKeyPress);
|
|
741
|
+
}
|
|
742
|
+
if (props.onKeyDown) {
|
|
743
|
+
context.element.addEventListener('keydown', props.onKeyDown);
|
|
744
|
+
}
|
|
745
|
+
if (props.onKeyUp) {
|
|
746
|
+
context.element.addEventListener('keyup', props.onKeyUp);
|
|
747
|
+
}
|
|
748
|
+
// Touch events
|
|
749
|
+
if (props.onTouchStart) {
|
|
750
|
+
context.element.addEventListener('touchstart', props.onTouchStart, {
|
|
751
|
+
passive: true,
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
if (props.onTouchMove) {
|
|
755
|
+
context.element.addEventListener('touchmove', props.onTouchMove, {
|
|
756
|
+
passive: true,
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
if (props.onTouchEnd) {
|
|
760
|
+
context.element.addEventListener('touchend', props.onTouchEnd, {
|
|
761
|
+
passive: true,
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
if (props.onTouchCancel) {
|
|
765
|
+
context.element.addEventListener('touchcancel', props.onTouchCancel, {
|
|
766
|
+
passive: true,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
// Swipe gestures (simplified implementation)
|
|
770
|
+
if (props.onSwipeLeft || props.onSwipeRight) {
|
|
771
|
+
let startX = 0;
|
|
772
|
+
let startY = 0;
|
|
773
|
+
context.element.addEventListener('touchstart', (e) => {
|
|
774
|
+
const touchEvent = e;
|
|
775
|
+
const touch = touchEvent.touches[0];
|
|
776
|
+
startX = touch.clientX;
|
|
777
|
+
startY = touch.clientY;
|
|
778
|
+
}, { passive: true });
|
|
779
|
+
context.element.addEventListener('touchend', (e) => {
|
|
780
|
+
const touchEvent = e;
|
|
781
|
+
const touch = touchEvent.changedTouches[0];
|
|
782
|
+
const deltaX = touch.clientX - startX;
|
|
783
|
+
const deltaY = touch.clientY - startY;
|
|
784
|
+
const minSwipeDistance = 50;
|
|
785
|
+
// Only register as swipe if horizontal movement is greater than vertical
|
|
786
|
+
if (Math.abs(deltaX) > Math.abs(deltaY) &&
|
|
787
|
+
Math.abs(deltaX) > minSwipeDistance) {
|
|
788
|
+
if (deltaX < 0 && props.onSwipeLeft) {
|
|
789
|
+
props.onSwipeLeft();
|
|
790
|
+
}
|
|
791
|
+
else if (deltaX > 0 && props.onSwipeRight) {
|
|
792
|
+
props.onSwipeRight();
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}, { passive: true });
|
|
796
|
+
}
|
|
797
|
+
// Scroll and wheel events
|
|
798
|
+
if (props.onScroll) {
|
|
799
|
+
context.element.addEventListener('scroll', props.onScroll, {
|
|
800
|
+
passive: true,
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
if (props.onWheel) {
|
|
804
|
+
context.element.addEventListener('wheel', props.onWheel, {
|
|
805
|
+
passive: false,
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
// Input events
|
|
809
|
+
if (props.onInput) {
|
|
810
|
+
context.element.addEventListener('input', props.onInput);
|
|
811
|
+
}
|
|
812
|
+
if (props.onChange) {
|
|
813
|
+
context.element.addEventListener('change', event => {
|
|
814
|
+
const target = event.target;
|
|
815
|
+
const value = target.value || target.textContent || '';
|
|
816
|
+
props.onChange(value, event);
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
// Clipboard events
|
|
820
|
+
if (props.onCopy) {
|
|
821
|
+
context.element.addEventListener('copy', props.onCopy);
|
|
822
|
+
}
|
|
823
|
+
if (props.onCut) {
|
|
824
|
+
context.element.addEventListener('cut', props.onCut);
|
|
825
|
+
}
|
|
826
|
+
if (props.onPaste) {
|
|
827
|
+
context.element.addEventListener('paste', props.onPaste);
|
|
828
|
+
}
|
|
829
|
+
// Selection events
|
|
830
|
+
if (props.onSelect) {
|
|
831
|
+
context.element.addEventListener('select', props.onSelect);
|
|
832
|
+
}
|
|
833
|
+
// Disabled state
|
|
834
|
+
if (props.disabled !== undefined) {
|
|
835
|
+
if (context.element instanceof HTMLElement) {
|
|
836
|
+
if (props.disabled) {
|
|
837
|
+
context.element.setAttribute('disabled', 'true');
|
|
838
|
+
context.element.style.pointerEvents = 'none';
|
|
839
|
+
context.element.style.opacity = '0.6';
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
context.element.removeAttribute('disabled');
|
|
843
|
+
context.element.style.pointerEvents = '';
|
|
844
|
+
context.element.style.opacity = '';
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
// Draggable state
|
|
849
|
+
if (props.draggable !== undefined) {
|
|
850
|
+
if (context.element instanceof HTMLElement) {
|
|
851
|
+
context.element.draggable = props.draggable;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
// Accessibility
|
|
855
|
+
if (props.accessibilityLabel) {
|
|
856
|
+
context.element.setAttribute('aria-label', props.accessibilityLabel);
|
|
857
|
+
}
|
|
858
|
+
if (props.accessibilityHint) {
|
|
859
|
+
context.element.setAttribute('aria-describedby', props.accessibilityHint);
|
|
860
|
+
}
|
|
861
|
+
return undefined;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Animation modifier for transitions and animations
|
|
866
|
+
*/
|
|
867
|
+
export class AnimationModifier extends BaseModifier {
|
|
868
|
+
type = 'animation';
|
|
869
|
+
priority = ModifierPriority.ANIMATION;
|
|
870
|
+
apply(_node, context) {
|
|
871
|
+
if (!context.element)
|
|
872
|
+
return;
|
|
873
|
+
const props = this.properties;
|
|
874
|
+
// Transition
|
|
875
|
+
if (props.transition) {
|
|
876
|
+
const t = props.transition;
|
|
877
|
+
const property = t.property || 'all';
|
|
878
|
+
const duration = t.duration || 300;
|
|
879
|
+
const easing = t.easing || 'ease';
|
|
880
|
+
const delay = t.delay || 0;
|
|
881
|
+
if (context.element instanceof HTMLElement) {
|
|
882
|
+
context.element.style.transition = `${property} ${duration}ms ${easing} ${delay}ms`;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
// Animation
|
|
886
|
+
if (props.animation && context.element instanceof HTMLElement) {
|
|
887
|
+
const anim = props.animation;
|
|
888
|
+
if (anim.keyframes) {
|
|
889
|
+
// Create keyframes
|
|
890
|
+
const keyframeName = `tachui-animation-${context.componentId}-${Date.now()}`;
|
|
891
|
+
const keyframeRule = this.createKeyframeRule(keyframeName, anim.keyframes);
|
|
892
|
+
// Add keyframes to stylesheet
|
|
893
|
+
this.addKeyframesToStylesheet(keyframeRule);
|
|
894
|
+
// Apply animation
|
|
895
|
+
const duration = anim.duration || 1000;
|
|
896
|
+
const easing = anim.easing || 'ease';
|
|
897
|
+
const iterations = anim.iterations || 1;
|
|
898
|
+
const direction = anim.direction || 'normal';
|
|
899
|
+
context.element.style.animation = `${keyframeName} ${duration}ms ${easing} ${iterations} ${direction}`;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
// Transform
|
|
903
|
+
if (props.transform && context.element instanceof HTMLElement) {
|
|
904
|
+
if (isSignal(props.transform) || isComputed(props.transform)) {
|
|
905
|
+
// Create reactive effect for transform
|
|
906
|
+
createEffect(() => {
|
|
907
|
+
const transformValue = props.transform();
|
|
908
|
+
if (context.element instanceof HTMLElement) {
|
|
909
|
+
context.element.style.transform = transformValue;
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
context.element.style.transform = props.transform;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
// Scale Effect (SwiftUI .scaleEffect(x, y, anchor))
|
|
918
|
+
if (props.scaleEffect && context.element instanceof HTMLElement) {
|
|
919
|
+
const { x, y, anchor } = props.scaleEffect;
|
|
920
|
+
const scaleY = y ?? x; // Default to uniform scaling if y not provided
|
|
921
|
+
// Convert anchor to CSS transform-origin
|
|
922
|
+
const anchorOrigins = {
|
|
923
|
+
center: '50% 50%',
|
|
924
|
+
top: '50% 0%',
|
|
925
|
+
topLeading: '0% 0%',
|
|
926
|
+
topTrailing: '100% 0%',
|
|
927
|
+
bottom: '50% 100%',
|
|
928
|
+
bottomLeading: '0% 100%',
|
|
929
|
+
bottomTrailing: '100% 100%',
|
|
930
|
+
leading: '0% 50%',
|
|
931
|
+
trailing: '100% 50%',
|
|
932
|
+
};
|
|
933
|
+
const transformOrigin = anchorOrigins[anchor || 'center'] || '50% 50%';
|
|
934
|
+
context.element.style.transformOrigin = transformOrigin;
|
|
935
|
+
// Create scale transform
|
|
936
|
+
const scaleTransform = `scale(${x}, ${scaleY})`;
|
|
937
|
+
// Preserve existing transforms but replace any existing scale functions
|
|
938
|
+
const existingTransform = context.element.style.transform || '';
|
|
939
|
+
const existingTransforms = existingTransform
|
|
940
|
+
.replace(/\s*scale[XYZ3d]*\([^)]*\)\s*/g, ' ')
|
|
941
|
+
.replace(/\s+/g, ' ')
|
|
942
|
+
.trim();
|
|
943
|
+
const newTransform = existingTransforms
|
|
944
|
+
? `${existingTransforms} ${scaleTransform}`.trim()
|
|
945
|
+
: scaleTransform;
|
|
946
|
+
context.element.style.transform = newTransform;
|
|
947
|
+
}
|
|
948
|
+
// Overlay modifier moved to @tachui/modifiers package
|
|
949
|
+
return undefined;
|
|
950
|
+
}
|
|
951
|
+
createKeyframeRule(name, keyframes) {
|
|
952
|
+
let rule = `@keyframes ${name} {\n`;
|
|
953
|
+
for (const [percentage, styles] of Object.entries(keyframes)) {
|
|
954
|
+
rule += ` ${percentage} {\n`;
|
|
955
|
+
for (const [property, value] of Object.entries(styles)) {
|
|
956
|
+
const cssProperty = this.toCSSProperty(property);
|
|
957
|
+
rule += ` ${cssProperty}: ${value};\n`;
|
|
958
|
+
}
|
|
959
|
+
rule += ` }\n`;
|
|
960
|
+
}
|
|
961
|
+
rule += '}';
|
|
962
|
+
return rule;
|
|
963
|
+
}
|
|
964
|
+
addKeyframesToStylesheet(rule) {
|
|
965
|
+
let stylesheet = document.querySelector('#tachui-animations');
|
|
966
|
+
if (!stylesheet) {
|
|
967
|
+
stylesheet = document.createElement('style');
|
|
968
|
+
stylesheet.id = 'tachui-animations';
|
|
969
|
+
document.head.appendChild(stylesheet);
|
|
970
|
+
}
|
|
971
|
+
stylesheet.appendChild(document.createTextNode(rule));
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Lifecycle modifier for component lifecycle events
|
|
976
|
+
*/
|
|
977
|
+
export class LifecycleModifier extends BaseModifier {
|
|
978
|
+
type = 'lifecycle';
|
|
979
|
+
priority = ModifierPriority.CUSTOM;
|
|
980
|
+
activeAbortController;
|
|
981
|
+
apply(_node, context) {
|
|
982
|
+
if (!context.element)
|
|
983
|
+
return;
|
|
984
|
+
const props = this.properties;
|
|
985
|
+
// Clean up any existing tasks on re-application
|
|
986
|
+
if (this.activeAbortController) {
|
|
987
|
+
this.activeAbortController.abort();
|
|
988
|
+
}
|
|
989
|
+
// Set up async task with cancellation
|
|
990
|
+
if (props.task) {
|
|
991
|
+
this.setupTask(context, props.task);
|
|
992
|
+
}
|
|
993
|
+
// Set up onAppear/onDisappear with IntersectionObserver
|
|
994
|
+
if (props.onAppear || props.onDisappear) {
|
|
995
|
+
this.setupViewportObserver(context, props);
|
|
996
|
+
}
|
|
997
|
+
return undefined;
|
|
998
|
+
}
|
|
999
|
+
setupTask(_context, task) {
|
|
1000
|
+
if (!task)
|
|
1001
|
+
return;
|
|
1002
|
+
// Create abort controller for task cancellation
|
|
1003
|
+
this.activeAbortController = new AbortController();
|
|
1004
|
+
const { signal } = this.activeAbortController;
|
|
1005
|
+
// Execute the task operation
|
|
1006
|
+
const executeTask = async () => {
|
|
1007
|
+
try {
|
|
1008
|
+
if (signal.aborted)
|
|
1009
|
+
return;
|
|
1010
|
+
const result = task.operation();
|
|
1011
|
+
// Handle both sync and async operations
|
|
1012
|
+
if (result instanceof Promise) {
|
|
1013
|
+
await result;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
catch (error) {
|
|
1017
|
+
if (signal.aborted)
|
|
1018
|
+
return;
|
|
1019
|
+
console.error('TachUI Task Error:', error);
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
// Start task execution
|
|
1023
|
+
executeTask();
|
|
1024
|
+
// Add cleanup to cancel task on component unmount
|
|
1025
|
+
this.addCleanup(() => {
|
|
1026
|
+
if (this.activeAbortController) {
|
|
1027
|
+
this.activeAbortController.abort();
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
setupViewportObserver(context, props) {
|
|
1032
|
+
if (!context.element)
|
|
1033
|
+
return;
|
|
1034
|
+
const observer = new IntersectionObserver(entries => {
|
|
1035
|
+
entries.forEach(entry => {
|
|
1036
|
+
if (entry.isIntersecting && props.onAppear) {
|
|
1037
|
+
props.onAppear();
|
|
1038
|
+
}
|
|
1039
|
+
else if (!entry.isIntersecting && props.onDisappear) {
|
|
1040
|
+
props.onDisappear();
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
});
|
|
1044
|
+
observer.observe(context.element);
|
|
1045
|
+
// Add cleanup to disconnect observer
|
|
1046
|
+
this.addCleanup(() => {
|
|
1047
|
+
observer.disconnect();
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
addCleanup(cleanup) {
|
|
1051
|
+
// Store cleanup functions for proper disposal
|
|
1052
|
+
if (!this.properties._cleanupFunctions) {
|
|
1053
|
+
;
|
|
1054
|
+
this.properties._cleanupFunctions = [];
|
|
1055
|
+
}
|
|
1056
|
+
;
|
|
1057
|
+
this.properties._cleanupFunctions.push(cleanup);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Resizable modifier for making images resizable
|
|
1062
|
+
* In SwiftUI, .resizable() allows images to be scaled to fit their container
|
|
1063
|
+
*/
|
|
1064
|
+
export class ResizableModifier extends BaseModifier {
|
|
1065
|
+
type = 'resizable';
|
|
1066
|
+
priority = ModifierPriority.APPEARANCE;
|
|
1067
|
+
apply(_node, context) {
|
|
1068
|
+
if (!context.element)
|
|
1069
|
+
return;
|
|
1070
|
+
// For images, resizable means they can be scaled to fit their container
|
|
1071
|
+
// This is typically achieved with object-fit: fill in CSS
|
|
1072
|
+
if (context.element instanceof HTMLImageElement) {
|
|
1073
|
+
context.element.style.objectFit = 'fill';
|
|
1074
|
+
}
|
|
1075
|
+
return undefined;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
//# sourceMappingURL=base.js.map
|