fix imports to copied react.ts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import { TaskViewModelToEntry } from "../Components/taskEntry";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { BoardStatusGridPage } from "./boardStatusGridPage";
|
||||
import { BoardKanbanPage } from "./boardKanbanPage";
|
||||
import { ViewController } from "../viewController";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import { TaskViewModelToEntry } from "../Components/taskEntry";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import "./calendarPage.css";
|
||||
import { ViewController } from "../viewController";
|
||||
import { TaskSettingsModal } from "../Modals/taskSettingsModal";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import "./messagePage.css";
|
||||
import { ViewController } from "../viewController";
|
||||
import { MessageFilterModal } from "../Modals/messageFilterModal";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { DeletableListItem } from "../Components/deletableListItem";
|
||||
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
||||
import { ColorPicker } from "../Components/colorPicker";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import "./taskPage.css";
|
||||
import { BoardPage } from "./boardPage";
|
||||
import { ViewController } from "../viewController";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import BoardViewModel from "../../ViewModel/Pages/boardViewModel";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { RibbonButton } from "./ribbonButton";
|
||||
import BoardViewModel, {
|
||||
BoardPageTypes,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import ChatViewModel from "../../ViewModel/Chat/chatViewModel";
|
||||
|
||||
export function ChatEntry(chatViewModel: ChatViewModel) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { MessageReactionButtonRow } from "./messageReactionButtonRow";
|
||||
import { InlineReply } from "./inlineReply";
|
||||
import { ChatMessageInfoModal } from "../Modals/chatMessageInfoModal";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { RibbonButton } from "./ribbonButton";
|
||||
import ChatViewModel, {
|
||||
ChatPageTypes,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { Colors } from "../../colors";
|
||||
|
||||
export function ColorPicker(selectedColor: React.State<Colors>) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
|
||||
export function DangerousActionButton(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
|
||||
export function DeletableListItem(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import StorageViewModel from "../../ViewModel/Global/storageViewModel";
|
||||
import StorageModel, {
|
||||
PATH_COMPONENT_SEPARATOR,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import {
|
||||
StringEntryObject,
|
||||
checkDoesObjectMatchReference,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
|
||||
export function HomePageButton(
|
||||
action: () => void,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
|
||||
export function InfoTile(
|
||||
icon: string,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import ChatMessageViewModel from "../../ViewModel/Chat/chatMessageViewModel";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
import ChatMessageViewModel from "../../ViewModel/Chat/chatMessageViewModel";
|
||||
import { ReactionSymbols } from "../../Model/Chat/chatModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { MessageReactionButton } from "./messageReactionButton";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
import ChatMessageViewModel from "../../ViewModel/Chat/chatMessageViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ChatMessageReaction } from "../../Model/Chat/chatModel";
|
||||
|
||||
export function MessageReactionEntry(reaction: ChatMessageReaction) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import MessagePageViewModel from "../../ViewModel/Pages/messagePageViewModel";
|
||||
import { ReactionSymbols } from "../../Model/Chat/chatModel";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import "./monthGrid.css";
|
||||
import { ViewController } from "../viewController";
|
||||
import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
|
||||
export function NavigationButton<T>(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
|
||||
export function Option(text: string, value: string, selectedOnCreate: boolean) {
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
|
||||
export function OptionButton<T>(
|
||||
text: string,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { OptionButton } from "./optionButton";
|
||||
|
||||
export function OptionButtonList<T>(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
|
||||
export function PlaceholderView(text: string) {
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import {
|
||||
StringEntryObject,
|
||||
collectObjectValuesForKey,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
import ChatMessageViewModel from "../../ViewModel/Chat/chatMessageViewModel";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
|
||||
export function RibbonButton(
|
||||
label: string,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
|
||||
|
||||
export function TaskEntry(taskViewModel: TaskViewModel) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
|
||||
export const StringToTextSpan: React.StateItemConverter<string> = (
|
||||
string: string,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
||||
import { ColorPicker } from "../Components/colorPicker";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { MessageReactionEntry } from "../Components/messageReactionEntry";
|
||||
import { MessageReactionButtonRow } from "../Components/messageReactionButtonRow";
|
||||
import { InfoTile } from "../Components/infoTile";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { DeletableListItem } from "../Components/deletableListItem";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
import ConnectionViewModel from "../../ViewModel/Global/connectionViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import { StringToTextSpan } from "../Components/textSpan";
|
||||
import FileTransferViewModel, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import { MessageReactionFilterButton } from "../Components/messageReactionFilterButton";
|
||||
import MessagePageViewModel from "../../ViewModel/Pages/messagePageViewModel";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { v4 } from "uuid";
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../viewController";
|
||||
import { StringToOption } from "../Components/option";
|
||||
import SearchViewModel from "../../ViewModel/Utility/searchViewModel";
|
||||
@@ -70,7 +70,7 @@ export function SearchModal<T>(
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
<div
|
||||
toggle:hidden={searchViewModel.hasNoSuggestions}>
|
||||
<hr></hr>
|
||||
<h3>{coreViewModel.translations.general.searchSuggestionsLabel}</h3>
|
||||
@@ -105,14 +105,14 @@ function SuggestionView<T>(suggestion: string, searchViewModel: SearchViewModel<
|
||||
|
||||
return <div class="flex-row surface align-center">
|
||||
<span class="width-100 flex-1 padding-h">{suggestion}</span>
|
||||
<button
|
||||
<button
|
||||
class="danger"
|
||||
aria-label={coreViewModel.translations.general.deleteButton}
|
||||
on:click={deleteSuggestion}
|
||||
>
|
||||
<span class="icon">delete</span>
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
class="primary"
|
||||
aria-label={coreViewModel.translations.general.applyButton}
|
||||
on:click={applySuggestion}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { SplitModal } from "./splitModal";
|
||||
import { languageNames } from "../translations";
|
||||
import { PlaceholderView } from "../Components/placeholderView";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import "./splitModal.css";
|
||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { SplitModal } from "./splitModal";
|
||||
import { DirectoryItemList } from "../Components/directoryItemList";
|
||||
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { v4 } from "uuid";
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import {
|
||||
Entry,
|
||||
Option,
|
||||
@@ -245,7 +245,7 @@ export function TaskSettingsModal(
|
||||
bind:value={taskViewModel.description}
|
||||
></textarea>
|
||||
</main>
|
||||
<div
|
||||
<div
|
||||
class="flex-row width-100"
|
||||
id="fullscreen-exit"
|
||||
>
|
||||
@@ -257,7 +257,7 @@ export function TaskSettingsModal(
|
||||
<span class="icon">fullscreen_exit</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
<div
|
||||
class="flex-row width-100"
|
||||
id="controls"
|
||||
>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../react";
|
||||
import { ViewController } from "./viewController";
|
||||
import "./homePage.css";
|
||||
import { ChatViewToggleButton } from "./Components/chatViewToggleButton";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../react";
|
||||
import "./chatPage.css";
|
||||
import { ChatPage } from "./chatPage";
|
||||
import CoreViewModel from "../ViewModel/Global/coreViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../react";
|
||||
import "./homePage.css";
|
||||
import { StringToOption } from "./Components/option";
|
||||
import { HomePageButton } from "./Components/homePageButton";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../react";
|
||||
import CoreViewModel from "../ViewModel/Global/coreViewModel";
|
||||
|
||||
export function MainPage(coreViewModel: CoreViewModel) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../react";
|
||||
|
||||
class Tracker<T> {
|
||||
state: React.State<T> | undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import ChatViewModel from "./chatViewModel";
|
||||
import SettingsViewModel from "../Global/settingsViewModel";
|
||||
import NotificationViewModel from "../Global/notificationViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import MessagePageViewModel from "../Pages/messagePageViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import ChatListViewModel from "./chatListViewModel";
|
||||
import TaskPageViewModel from "../Pages/taskPageViewModel";
|
||||
import SettingsPageViewModel from "../Pages/settingsPageViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel from "./coreViewModel";
|
||||
|
||||
export default class ConnectionViewModel {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { v4 } from "uuid";
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { allTranslations, Translations } from "../../View/translations";
|
||||
import { HandlerManager } from "../../Model/Utility/utility";
|
||||
import StorageModel from "../../Model/Global/storageModel";
|
||||
@@ -177,7 +177,7 @@ export class ContextHost<T> extends Context {
|
||||
this.coreViewModel.context = selectedContext;
|
||||
this.currentContext.value = selectedContext;
|
||||
};
|
||||
|
||||
|
||||
constructor(contextDebugDescription: string, public coreViewModel: CoreViewModel) {
|
||||
super(contextDebugDescription);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "./coreViewModel";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import StorageModel, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import ChatListViewModel from "../Chat/chatListViewModel";
|
||||
import ChatModel, { ChatMessage } from "../../Model/Chat/chatModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "./coreViewModel";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import { Languages, ThemeSettings } from "../../Model/Global/settingsModel";
|
||||
@@ -83,7 +83,7 @@ export default class SettingsViewModel extends Context {
|
||||
return DynamicSceneDay;
|
||||
} else if (hour < 17) {
|
||||
return DynamicSceneAfternoon
|
||||
} else if (hour < 21) {
|
||||
} else {
|
||||
return DynamicSceneSunset
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "./coreViewModel";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import StorageModel, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "./taskViewModel";
|
||||
import TaskPageViewModel from "./taskPageViewModel";
|
||||
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
||||
@@ -32,7 +32,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
filteredTaskViewModels: React.ListState<TaskViewModel> =
|
||||
new React.ListState();
|
||||
isFilterActive: React.State<boolean>;
|
||||
|
||||
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
return [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "./taskViewModel";
|
||||
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import SearchViewModel from "../Utility/searchViewModel";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import { Colors } from "../../colors";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "./taskViewModel";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel from "../Chat/chatViewModel";
|
||||
@@ -17,7 +17,7 @@ export default class TaskContainingPageViewModel extends Context {
|
||||
new React.State<any>(undefined);
|
||||
|
||||
taskViewModels: React.MapState<TaskViewModel> = new React.MapState();
|
||||
|
||||
|
||||
taskCategorySuggestions: React.ListState<string> = new React.ListState();
|
||||
taskStatusSuggestions: React.ListState<string> = new React.ListState();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import BoardViewModel from "./boardViewModel";
|
||||
import CoreViewModel, { ContextHost } from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel from "../Chat/chatViewModel";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import { checkDoesObjectMatchSearch } from "../../Model/Utility/utility";
|
||||
|
||||
export default class SearchViewModel<T> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "../Pages/taskViewModel";
|
||||
|
||||
export default class TaskPropertyBulkChangeViewModel {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import * as React from "bloatless-react";
|
||||
import * as React from "./react";
|
||||
import "./colors.css";
|
||||
import "./coloredTile.css";
|
||||
import "./base.css";
|
||||
|
||||
+78
-76
@@ -108,7 +108,7 @@ export class ListState<T> extends State<Set<T>> {
|
||||
this.removalHandlers.set(item, new Set());
|
||||
this.removalHandlers.get(item)!.add(handler);
|
||||
}
|
||||
|
||||
|
||||
handleRemovals(handler: RemovalSubscription<T>): void {
|
||||
this.genericRemovalHandlers.add(handler);
|
||||
}
|
||||
@@ -279,103 +279,105 @@ export function createElement(
|
||||
case "on": {
|
||||
switch (directiveValue) {
|
||||
case "enter": {
|
||||
element.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||
if (e.key != "Enter") return;
|
||||
value(e);
|
||||
});
|
||||
break;
|
||||
element.addEventListener("keydown", (e: Event) => {
|
||||
if (!(e instanceof KeyboardEvent)) return;
|
||||
if (e.key != "Enter") return;
|
||||
value(e);
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
element.addEventListener(directiveValue, value);
|
||||
element.addEventListener(directiveValue, value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "keystroke": {
|
||||
element.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||
if (e.metaKey == false && e.ctrlKey == false) return;
|
||||
if (e.key != directiveValue) return;
|
||||
value(e);
|
||||
})
|
||||
break;
|
||||
element.addEventListener("keydown", (e: Event) => {
|
||||
if (!(e instanceof KeyboardEvent)) return;
|
||||
if (e.metaKey == false && e.ctrlKey == false) return;
|
||||
if (e.key != directiveValue) return;
|
||||
value(e);
|
||||
})
|
||||
break;
|
||||
}
|
||||
case "subscribe": {
|
||||
const state = value as State<any>;
|
||||
state.subscribe(
|
||||
(newValue) => (element[directiveValue] = newValue)
|
||||
);
|
||||
const state = value as State<any>;
|
||||
state.subscribe(
|
||||
(newValue) => (element[directiveValue] = newValue)
|
||||
);
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case "bind": {
|
||||
const state = value as State<any>;
|
||||
state.subscribe(
|
||||
(newValue) => (element[directiveValue] = newValue)
|
||||
);
|
||||
element.addEventListener(
|
||||
"input",
|
||||
() => (state.value = (element as any)[directiveValue])
|
||||
);
|
||||
break;
|
||||
const state = value as State<any>;
|
||||
state.subscribe(
|
||||
(newValue) => (element[directiveValue] = newValue)
|
||||
);
|
||||
element.addEventListener(
|
||||
"input",
|
||||
() => (state.value = (element as any)[directiveValue])
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "toggle": {
|
||||
if (value.subscribe) {
|
||||
const state = value as State<any>;
|
||||
state.subscribe((newValue) =>
|
||||
element.toggleAttribute(directiveValue, newValue)
|
||||
);
|
||||
} else {
|
||||
element.toggleAttribute(directiveValue, value);
|
||||
}
|
||||
break;
|
||||
if (value.subscribe) {
|
||||
const state = value as State<any>;
|
||||
state.subscribe((newValue) =>
|
||||
element.toggleAttribute(directiveValue, newValue)
|
||||
);
|
||||
} else {
|
||||
element.toggleAttribute(directiveValue, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "set": {
|
||||
const state = value as State<any>;
|
||||
state.subscribe((newValue) =>
|
||||
element.setAttribute(directiveValue, newValue)
|
||||
);
|
||||
break;
|
||||
const state = value as State<any>;
|
||||
state.subscribe((newValue) =>
|
||||
element.setAttribute(directiveValue, newValue)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "children": {
|
||||
switch (directiveValue) {
|
||||
case "set": {
|
||||
const state = value as State<Node | Node[]>;
|
||||
state.subscribe((newValue) => {
|
||||
element.innerHTML = "";
|
||||
element.append(...[newValue].flat());
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "append":
|
||||
case "prepend": {
|
||||
try {
|
||||
const [listState, toElement] = value as [
|
||||
listState: ListState<any>,
|
||||
StateItemConverter<any>
|
||||
];
|
||||
switch (directiveValue) {
|
||||
case "set": {
|
||||
const state = value as State<Node | Node[]>;
|
||||
state.subscribe((newValue) => {
|
||||
element.innerHTML = "";
|
||||
element.append(...[newValue].flat());
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "append":
|
||||
case "prepend": {
|
||||
try {
|
||||
const [listState, toElement] = value as [
|
||||
listState: ListState<any>,
|
||||
StateItemConverter<any>
|
||||
];
|
||||
|
||||
listState.handleAddition((newItem) => {
|
||||
const child = toElement(newItem);
|
||||
listState.handleRemoval(newItem, () =>
|
||||
child.remove()
|
||||
);
|
||||
listState.handleAddition((newItem) => {
|
||||
const child = toElement(newItem);
|
||||
listState.handleRemoval(newItem, () =>
|
||||
child.remove()
|
||||
);
|
||||
|
||||
if (directiveValue == "append") {
|
||||
element.append(child);
|
||||
} else if (directiveValue == "prepend") {
|
||||
element.prepend(child);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw `error: cannot process subscribe:children directive. \n Usage: "children:append={[list, converter]}"; you can find a more detailed example in the documentation.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (directiveValue == "append") {
|
||||
element.append(child);
|
||||
} else if (directiveValue == "prepend") {
|
||||
element.prepend(child);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw `error: cannot process subscribe:children directive. \n Usage: "children:append={[list, converter]}"; you can find a more detailed example in the documentation.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
element.setAttribute(attributename, value);
|
||||
element.setAttribute(attributename, value);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user