Types:


About:

Types (types.d.ts) in a Cample.js.

        type OptionsType = {
  [key: string]: any;
};

type CampleOptionsType = {
  replaceTags?: boolean;
  trimHTML?: boolean;
};

type ImportType = Array<string>;

type BindType = Array<string>;

type TemplateType = string | undefined;

type IndexType = number;

type ImportObjectType = {
  value: ImportType;
  exportId?: ExportIdType;
  isDynamic?: boolean;
  importIndex?: IndexType;
};

type ComponentType =
  | string
  | {
      selector: string;
      import?: ImportType | ImportObjectType;
      bind?: BindType;
    }
  | undefined;

type ComponentsType = Array<ComponentType>;

type ImportObjectStringType = {
  import: string;
  exportId: ExportIdType | undefined;
  index: IndexType;
  importIndex?: IndexType;
};

type ComponentsTernaryType = [ComponentType, ComponentType];

type ConditionType = boolean | undefined;

type SelectorType = string | undefined;

type StyleType = string | undefined;

type LengthType = number;

type RenderType = "default" | "dynamic";

type UpdatingSetType = Map<any, any>;

type FunctionsArray = Array<any>;

type RenderComponentType =
  | "cycle"
  | "component"
  | "animation"
  | "ternary"
  | "addition"
  | "if"
  | "each";

type AttributesType = {
  [key: string]: string;
};

type DataAttributeType = {
  selector: string;
  value: string | undefined;
};

type EachDataObjectType = {
  [key: string]: any;
};
type EachTemplateArgumentType = {
  [key: string]: any;
};
type EachTemplateFunction = (
  argument?: EachTemplateArgumentType,
  index?: number
) => string;

type EachDataValueType = Array<any>;

type EachDataFunctionType = (
  argument?: DataFunctionArgumentsType
) => EachDataValueType;

type DataAttributesArrayType = Array<DataAttributeType>;

type AttrValueType = {
  [key: string]: any;
};

type AttributesValType = {
  name?: string;
  value?: string | [string, boolean];
  keys?: {
    [key: string]: CurrentKeyType;
  };
  oldValue?: string;
};
type AttributesValObjType = {
  id: IdType;
  attrs: AttributesValType;
};
type DynamicEl = Element | undefined;
type DynamicEls = Array<Element>;
type DynamicElement = {
  el: DynamicEl;
  els: DynamicEls;
};

type DynamicTextType = {
  key?: CurrentKeyType;
  isProperty?: boolean;
  texts?: Array<Text | number>;
};

type DynamicTextArrayType = Array<DynamicTextType>;

type TextArrayType = Array<Text>;

type DynamicFunctionsType = {
  [key: string]: (attribute?: any) => void;
};

type DataComponentType = DataType | DataFunctionType | undefined;

type DynamicDataType = {
  value: DataComponentType;
  oldValue?: DataComponentType;
  importData?: ImportDataType;
  id: number;
};

type DynamicEachDataType = {
  value: EachDataValueType;
  oldValue?: EachDataValueType;
  importData?: ImportDataType;
  id: number;
};

type ElementIndexType = {
  id: number;
  path: Array<number>;
};
type FunctionEventObjType = {
  render?: FunctionEventType;
};

type ValueValueType =
  | FunctionEventObjType
  | AttributesValType
  | DynamicTextType
  | CampleImportType
  | ClassType;
type FunctionEventType = (...args: any[]) => any;
type FunctionsEventsType = Array<FunctionEventType>;
type EventType = {
  id: IdType;
  events: FunctionsEventsType;
};

type EventsType = Array<EventType>;

type CampleImportType = {
  value?: string;
};

type ValueItemType = {
  value: string | CurrentKeyType;
  render: (...args: any[]) => string;
};

type ValueItemsType = {
  value: ValueItemType | Array<ValueItemType>;
  render: (...args: any[]) => string;
};
type OldClassListType = {
  [key: string]: any;
};
type ClassType = {
  classes?: ValueItemsType;
  old?: string;
};

type RenderedKeyType = string | DynamicKeyObjectType | undefined;

type ValueType = {
  id?: IdType | IndexObjNode;
  type: number; //"event" | "dynamicText" | "attribute" | "import" | "class"
} & FunctionEventObjType &
  AttributesValType &
  DynamicTextType &
  CampleImportType &
  ClassType;
type ValuesTemplateType = Array<ValueType>;
type NodeDOMType = {
  id: number;
  parentNode: NodeDOMType | null;
  path: Array<IndexObjNode>;
  nextNode: NodeDOMType | null;
  siblings: Array<NodeDOMType>;
};
type DynamicNodesObjectType = {
  [key: string]: Array<IndexObjNode>;
};
type RenderNodeFunctionType = (...args: any[]) => ChildNode | null;
type IndexObjNode = {
  id?: number;
  node?: NodeDOMType;
  rootId: number;
  render?: RenderNodeFunctionType;
  dynamicNodes?: Array<IndexObjNode>;
  isNext?: boolean;
  isText?: boolean;
};
type EachTemplateNodesType = Array<IndexObjNode>;
type EachTemplateType = {
  el: Element | null;
  key?: ValueItemsType;
  nodes: EachTemplateNodesType;
  values: ValuesTemplateType;
};

type ElementsType = Element[];
type DynamicNodeComponentNodeType = ChildNode | null | undefined;
type DynamicNodeComponentParentNodeType = ParentNode | null | undefined;
type DynamicDataValueType = DataComponentType | EachDataValueType;
type EachDynamicNodeComponentType = {
  import?: ImportObjectType;
  parentNode: ParentNode;
  template?: EachTemplateType;
  keys?: ArrayStringType;
  dataFunctions: FunctionsType;
  functions: FunctionsType;
  nodes: Array<NodeType>;
  nodeNext: DynamicNodeComponentNodeType;
  nodePrevious: DynamicNodeComponentNodeType;
  id: number;
};
type ImportDataType = {
  [key: string]: any;
};
type DataExportObjectDataType = {
  [key: string]: ExportTemplateDataType;
};
type DataIndexesValueType = {
  [key: string]: Array<number | [number]>;
};

type DataIndexesObjectType = {
  data: DataIndexesValueType;
  functions: DataIndexesValueType;
};

type DataIndexesType = {
  [key: string]: DataIndexesObjectType;
};

type ExportObjectDataType = {
  data: DataExportObjectDataType;
  indexesData: DataIndexesType;
  index: number;
  constructor: DataExportObjectDataType;
};

type ExportObjectDataArrayType = Array<ExportObjectDataType>;

type ComponentDynamicNodeComponentType = {
  id: number;
  dataFunctions: FunctionsType;
  functions: FunctionsType;
  exportData?: ExportDataType;
  nodes: Array<NodeType>;
  exportObject?: ExportObjectDataType;
  import?: ImportObjectType;
};
type ArrayAnyType = Array<any>;

type DataExportObjectType = {
  [key: string]: ExportDataArrayType;
};

type DynamicNodeComponentType =
  | EachDynamicNodeComponentType
  | ComponentDynamicNodeComponentType;

type LastNodeType = Element | ChildNode | ParentNode;

type ScriptArgumentsType = {
  element: Element | null;
  functions: FunctionsType | undefined;
  currentData: DataType | undefined;
  importedData?: DataType;
};

type DynamicType = {
  data: {
    values: Array<DynamicDataType | DynamicEachDataType>;
    components: Array<DynamicNodeComponentType>;
    currentId: number;
  };
};
type ValuesArguments = {
  [key: string]: any;
};
type ValuesValueType = {
  [key: string]: string | [string, string];
};
type ValuesType = {
  [key: string]: ValuesValueType;
};
type ArgumentsArrayType = Array<any>;

type EventGetDataType = (
  key: string,
  dataId: number,
  index?: IndexType
) => any;

type EventEachGetDataType = (
  key: string,
  dataId: number,
  keyEl: string | undefined,
  index: number
) => any;

type EventEachGetFunctionType = (
  key: string,
  dataId: number,
  keyEl: string | undefined,
  functions?: FunctionsType
) => any;

type EventFunctionType = (...args: any[]) => any;

type ListenerValueType = {
  value: EventKeyObjectType;
  fn?: EventFunctionType;
};

type ListenersType = {
  [key: string]: ListenerValueType;
};
type DynamicTextsObj = {
  id: IdType;
  dynamicTexts: DynamicTextArrayType;
};
type DynamicTextsType = Array<DynamicTextsObj>;
type DynamicAttributesType = Array<AttributesValObjType>;

type OperandType = {
  value: KeyValuesValueConditionType | CurrentKeyType;
  priority?: number;
  type?: number;
  oldType?: number;
  render: (...args: any[]) => any;
};
type OperationType = {
  value: number;
  priority?: number;
  render: (...args: any[]) => any;
};

type ConnectingOperationType = {
  priority: number;
  value: OperationType | OperandType;
};
type KeyValuesValueConditionType = {
  operands: Array<OperandType | OperationType | KeyValuesValueConditionType>;
  priority?: number;
  oldBracketType?: number;
  isFirstOperation?: boolean;
  connectingOperations?: ConnectingOperationType[];
  render?: (...args: any[]) => boolean;
};
type RenderConditionType = (...args: any[]) => any;
type ValueKeyStringType = {
  valueClass: {
    value: ValueItemType | Array<ValueItemType>;
    render: (...args: any[]) => void;
  };
};

type KeyValuesValueType = {
  condition: KeyValuesValueConditionType;
  values: ValueKeyStringType | [ValueKeyStringType, ValueKeyStringType];
  render: (...args: any[]) => void;
};
type KeyValuesType = KeyValuesValueType[];
type CurrentKeyType = {
  originKey: string;
  key: string;
  properties?: Array<string>;
  values?: KeyValuesType | KeyValuesValueType;
  render?: (...args: any[]) => any;
  isProperty?: boolean;
  originType: number;
  isClass?: boolean;
  isValue: boolean;
};
type NodeTextType = {
  key: CurrentKeyType;
  value: string;
};

type NodeValueType = {
  render: any;
  type: number; // "dynamicText" | "attribute" | "class"
} & AttributesValType &
  NodeTextType &
  ClassType;
type NodeValuesType = Array<NodeValueType>;
type NodeType = {
  isNew?: boolean;
  index: number;
  key?: string;
  el?: Node;
  values: NodeValuesType;
  dataId: number;
};

type ArrayNodeType = Array<NodeType>;

type DynamicKeyObjectType = {
  key: string;
  properties: Array<string>;
};
type DynamicKeyObjectArrayType = Array<DynamicKeyObjectType>;

type EventKeyObjectType = {
  key: string;
  arguments: ArgumentsArrayType;
};

type EventKeyObjectArrayType = Array<EventKeyObjectType>;

type DynamicKeyType = string | DynamicKeyObjectType;

type DynamicKeyArrayType = Array<DynamicKeyType>;

type ArrayStringType = Array<string>;

type ElementType = {
  selector: string;
  id?: string;
  class?: string;
  attributes?: AttributesType;
};

type FunctionsArrayType = [
  (...args: any[]) => (...args: any[]) => any,
  string
];
type FunctionsObjType = {
  [key: string]: string | FunctionsArrayType;
};

type RootOptionsType = {
  attributes?: AttributesType;
  style?: StyleType;
  replaceTag?: boolean;
  replaceTags?: boolean;
  trimHTML?: boolean;
  export?: ExportDataType;
  exportId?: ExportIdType;
};

type DefaultOptionsType = RootOptionsType & {
  element?: ElementType;
};

type ComponentRenderType = "dynamic" | "static";

type DefaultDataOptionsType = RootOptionsType & {
  import?: ImportObjectType;
  script?: ScriptType;
  values?: ValuesType;
  dataFunctions?: FunctionsObjType;
  functions?: FunctionsOptionType;
};
type IndexValueDataType = {
  [key: string]: number;
};
type IndexValuFunctionsType = {
  [key: string]: number;
};
type IndexValuesType = {
  data: IndexValueDataType;
  functions: IndexValuFunctionsType;
};
type ArrayExportTamplateStringType = Array<string | undefined>;

type ExportTemplateDataType = {
  data: {
    [key: string]: ArrayExportTamplateStringType;
  };
  functions: {
    [key: string]: ExportTemplateFunctionArrayType;
  };
};

type ImportObjectArrayType = {
  data?: ArrayStringType;
  functions?: ArrayStringType;
};

type ExportTemplateDataNewType = {
  data: {
    [key: string]: ArrayExportTamplateStringType | string;
  };
  functions: {
    [key: string]: ExportTemplateFunctionArrayType;
  };
};

type ExportTemplateFunctionArrayType = Array<
  FunctionsOptionValueType | undefined
>;

type FunctionsOptionFunctionType = (...args: any[]) => void;

type FunctionsOptionValueType = [FunctionsOptionFunctionType, string];

type FunctionsOptionType = {
  [key: string]: FunctionsOptionValueType;
};

type ExportTemplateValueDataType = {
  [key: string]: string | ArrayStringType;
};
type TemplateExportValueType = {
  data?: ExportTemplateValueDataType;
  functions?: FunctionsOptionType;
};

type ExportDynamicType = {
  [key: string]: TemplateExportValueType;
};

type IterationFunctionType = (...args: any[]) => void;

type EachOptionsType = DefaultDataOptionsType & {
  functionName?: string;
  valueName?: string;
  importedDataName?: string;
  componentData?: boolean;
  indexName?: string;
  iteration?: IterationFunctionType;
};

type DataPropertyType = {
  value?: any;
};

type DataType = {
  [key: string]: any | DataPropertyType;
};

type StartType = "afterLoad" | "beforeLoad";

type ScriptOptionsType = {
  start?: StartType;
};

type ExportDataArrayType = Array<ExportDataType | undefined>;

type IdType = number | undefined;

type ScriptFunctionType = (...args: any[]) => void;
type CycleValueType = { value: string; index: string };
type ScriptType =
  | [ScriptFunctionType, ScriptOptionsType]
  | ScriptFunctionType;

type ExportDataValuesValueType = {
  [key: string]: any;
};

type ExportDataType = {
  [key: string]: ExportDataValuesValueType;
};

type ExportDataValueType = {
  value: {
    [key: string]: any;
  };
  components: Array<any>;
};

type ExportCampleDataType = {
  [key: string]: ExportDataValueType;
};
type ComponentTemplateType = string | ComponentTemplateFunctionType;
type ComponentTemplateArgumentType = {
  data: DataType | undefined;
};
type ComponentTemplateFunctionType = (
  argument?: ComponentTemplateArgumentType
) => string;

type ExportFunctionDataOptionsType = {
  data: DataType | undefined;
};

type ExportFunctionDataType = (
  arg: ExportFunctionDataOptionsType
) => ExportDataType;

type ExportDynamicDataType = ExportFunctionDataType | ExportDataType;

type DataFunctionArgumentsType = {
  importedData?: ExportDataType;
  currentData?: DataType | EachDataValueType;
};

type DataFunctionType = (
  argument?: DataFunctionArgumentsType
) => DataType;

type ComponentOptionsType = DefaultDataOptionsType & {
  data?: DataType | DataFunctionType;
};

type AnimationElementType = {
  selector: string;
  id?: string;
  class?: string;
  transition?: string;
  attributes?: AttributesType;
};

type ExportIdType = string | number;

type AnimationOptionsType = {
  event: string;
  reverseEvent?: string;
  attributes?: AttributesType;
  styleAnimation: string;
  style?: string;
  class: string;
  transition?: string;
  element?: AnimationElementType;
  replaceTag?: boolean;
  replaceTags?: boolean;
  trimHTML?: boolean;
  export?: ExportDataType;
  exportId?: ExportIdType;
};

type FunctionsType = {
  [key: string]: any;
};