/* * MIT License * * Copyright (C) 2026 Huawei Device Co., Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * This code was generated by "react-native codegen-lib-harmony" */ import { Descriptor as ComponentDescriptor, ViewBaseProps, ViewRawProps, ViewDescriptorWrapperBase, ColorValue, Color, RNInstance, Tag, RNComponentCommandReceiver, ViewPropsSelector, } from '@rnoh/react-native-openharmony/ts'; export namespace SpinKitView { export const NAME = "SpinKitView" as const export interface DirectRawProps { color?: string; size?: number; type?: 'CircleFlip' | 'Bounce' | 'Wave' | 'WanderingCubes' | 'Pulse' | 'ChasingDots' | 'ThreeBounce' | 'Circle' | 'CubeGrid' | 'WordPress' | 'FadingCircle' | 'FadingCircleAlt' | 'Arc' | 'ArcAlt' | 'Plane'; } export interface Props extends ViewBaseProps {} export interface State {} export interface RawProps extends ViewRawProps, DirectRawProps {} export class PropsSelector extends ViewPropsSelector { get color() { return this.rawProps.color ?? '#000000'; } get size() { return this.rawProps.size ?? 37; } get type() { return this.rawProps.type ?? 'Plane'; } } export type Descriptor = ComponentDescriptor< typeof NAME, Props, State, RawProps >; export class DescriptorWrapper extends ViewDescriptorWrapperBase< typeof NAME, Props, State, RawProps, PropsSelector > { protected createPropsSelector() { return new PropsSelector(this.descriptor.props, this.descriptor.rawProps) } } export interface EventPayloadByName { } export class EventEmitter { constructor(private rnInstance: RNInstance, private tag: Tag) {} emit(eventName: TEventName, payload: EventPayloadByName[TEventName]) { this.rnInstance.emitComponentEvent(this.tag, eventName, payload) } } export interface CommandArgvByName { } export class CommandReceiver { private listenersByCommandName = new Map void>>() private cleanUp: (() => void) | undefined = undefined constructor(private componentCommandReceiver: RNComponentCommandReceiver, private tag: Tag) { } subscribe(commandName: TCommandName, listener: (argv: CommandArgvByName[TCommandName]) => void) { if (!this.listenersByCommandName.has(commandName)) { this.listenersByCommandName.set(commandName, new Set()) } this.listenersByCommandName.get(commandName)!.add(listener) const hasRegisteredCommandReceiver = !!this.cleanUp if (!hasRegisteredCommandReceiver) { this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName: string, argv: any[]) => { if (this.listenersByCommandName.has(commandName)) { const listeners = this.listenersByCommandName.get(commandName)! listeners.forEach(listener => { listener(argv) }) } }) } return () => { this.listenersByCommandName.get(commandName)?.delete(listener) if (this.listenersByCommandName.get(commandName)?.size ?? 0 === 0) { this.listenersByCommandName.delete(commandName) } if (this.listenersByCommandName.size === 0) { this.cleanUp?.() } } } } }