@react95/core 8.1.4-alpha.0 → 9.0.0

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.
Files changed (40) hide show
  1. package/README.md +0 -21
  2. package/cjs/Alert/Alert.cjs +21 -13
  3. package/cjs/Modal/Modal.cjs +81 -96
  4. package/cjs/Modal/Modal.css.ts.vanilla.css +6 -4
  5. package/cjs/TaskBar/TaskBar.cjs +40 -7
  6. package/cjs/TitleBar/TitleBar.cjs +71 -7
  7. package/cjs/TitleBar/TitleBar.css.ts.vanilla.css +8 -1
  8. package/cjs/TitleBar/maximize.svg.cjs +3 -0
  9. package/cjs/TitleBar/minimize.svg.cjs +3 -0
  10. package/cjs/TitleBar/restore.svg.cjs +3 -0
  11. package/cjs/index.cjs +0 -4
  12. package/cjs/shared/events.cjs +35 -0
  13. package/esm/Alert/Alert.mjs +21 -13
  14. package/esm/Modal/Modal.css.ts.vanilla.css +6 -4
  15. package/esm/Modal/Modal.mjs +83 -98
  16. package/esm/TaskBar/TaskBar.mjs +41 -8
  17. package/esm/TitleBar/TitleBar.css.ts.vanilla.css +8 -1
  18. package/esm/TitleBar/TitleBar.mjs +73 -9
  19. package/esm/TitleBar/maximize.svg.mjs +4 -0
  20. package/esm/TitleBar/minimize.svg.mjs +4 -0
  21. package/esm/TitleBar/restore.svg.mjs +4 -0
  22. package/esm/index.mjs +0 -4
  23. package/esm/shared/events.mjs +35 -0
  24. package/package.json +4 -8
  25. package/types/Cursor/Cursor.css.d.ts +1 -1
  26. package/types/Modal/Modal.d.ts +2259 -11
  27. package/types/TaskBar/WindowButton.d.ts +3 -3
  28. package/types/TitleBar/TitleBar.d.ts +2271 -3
  29. package/types/index.d.ts +1 -3
  30. package/types/shared/events.d.ts +19 -0
  31. package/cjs/Modal/ModalContext.cjs +0 -16
  32. package/cjs/Modal/ModalProvider.cjs +0 -56
  33. package/esm/Modal/ModalContext.mjs +0 -16
  34. package/esm/Modal/ModalProvider.mjs +0 -56
  35. package/types/Modal/ModalContext.d.ts +0 -15
  36. package/types/Modal/ModalProvider.d.ts +0 -3
  37. /package/cjs/{Modal → TitleBar}/close.svg.cjs +0 -0
  38. /package/cjs/{Modal → TitleBar}/help.svg.cjs +0 -0
  39. /package/esm/{Modal → TitleBar}/close.svg.mjs +0 -0
  40. /package/esm/{Modal → TitleBar}/help.svg.mjs +0 -0
package/types/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  import { Modal } from './Modal/Modal';
2
- import { ModalContext } from './Modal/ModalContext';
3
- import { ModalProvider } from './Modal/ModalProvider';
4
2
  import { Tabs } from './Tabs/Tabs';
5
3
  import { Tab } from './Tabs/Tab';
6
4
  import { Alert } from './Alert/Alert';
@@ -22,4 +20,4 @@ import { Tree } from './Tree/Tree';
22
20
  import { Tooltip } from './Tooltip/Tooltip';
23
21
  import { TitleBar } from './TitleBar/TitleBar';
24
22
  import { Video } from './Video/Video';
25
- export { Alert, Avatar, Button, Checkbox, Cursor, Dropdown, Fieldset, Frame, Input, List, Modal, ModalContext, ModalProvider, ProgressBar, RadioButton, Range, Tab, Tabs, TaskBar, TextArea, Tree, Tooltip, TitleBar, Video, };
23
+ export { Alert, Avatar, Button, Checkbox, Cursor, Dropdown, Fieldset, Frame, Input, List, Modal, ProgressBar, RadioButton, Range, Tab, Tabs, TaskBar, TextArea, Tree, Tooltip, TitleBar, Video, };
@@ -0,0 +1,19 @@
1
+ import { ReactElement } from 'react';
2
+ export declare class Emitter<U extends string, T> {
3
+ private listeners;
4
+ on(eventName: U, callback: (data: T) => void): void;
5
+ off(eventName: U, callback: (data: T) => void): void;
6
+ emit(eventName: U, data: Partial<T>): void;
7
+ }
8
+ export declare enum ModalEvents {
9
+ AddModal = "add-modal",
10
+ RemoveModal = "remove-modal",
11
+ ModalVisibilityChanged = "modal-visibility-changed"
12
+ }
13
+ export interface ModalWindow {
14
+ icon?: ReactElement;
15
+ title: string;
16
+ hasButton: boolean;
17
+ id: string;
18
+ }
19
+ export declare const modals: Emitter<ModalEvents, ModalWindow>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const ModalContext = React.createContext({
5
- windows: {},
6
- addWindows: () => {
7
- },
8
- removeWindow: () => {
9
- },
10
- updateWindow: () => {
11
- },
12
- setActiveWindow: () => {
13
- },
14
- activeWindow: ""
15
- });
16
- exports.ModalContext = ModalContext;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const nanoid = require("nanoid");
4
- const React = require("react");
5
- const ModalContext = require("./ModalContext.cjs");
6
- const windowStackReducer = (state, action) => {
7
- const newWindows = { ...state };
8
- switch (action.type) {
9
- case "ADD_WINDOW": {
10
- newWindows[action.id] = action.window;
11
- return newWindows;
12
- }
13
- case "REMOVE_WINDOW": {
14
- delete newWindows[action.id];
15
- return newWindows;
16
- }
17
- case "UPDATE_WINDOW": {
18
- newWindows[action.id] = action.window;
19
- return newWindows;
20
- }
21
- default:
22
- return state;
23
- }
24
- };
25
- const ModalProvider = ({
26
- children
27
- }) => {
28
- const [windows, dispatch] = React.useReducer(windowStackReducer, {});
29
- const [activeWindow, setActiveWindow] = React.useState();
30
- const addWindows = (window) => {
31
- const id = nanoid.nanoid();
32
- dispatch({ type: "ADD_WINDOW", id, window });
33
- return id;
34
- };
35
- const removeWindow = (id) => {
36
- dispatch({ type: "REMOVE_WINDOW", id });
37
- };
38
- const updateWindow = (id, window) => {
39
- dispatch({ type: "UPDATE_WINDOW", id, window });
40
- };
41
- return /* @__PURE__ */ React.createElement(
42
- ModalContext.ModalContext.Provider,
43
- {
44
- value: {
45
- windows,
46
- addWindows,
47
- removeWindow,
48
- updateWindow,
49
- setActiveWindow,
50
- activeWindow
51
- }
52
- },
53
- children
54
- );
55
- };
56
- exports.ModalProvider = ModalProvider;
@@ -1,16 +0,0 @@
1
- import { createContext } from "react";
2
- const ModalContext = createContext({
3
- windows: {},
4
- addWindows: () => {
5
- },
6
- removeWindow: () => {
7
- },
8
- updateWindow: () => {
9
- },
10
- setActiveWindow: () => {
11
- },
12
- activeWindow: ""
13
- });
14
- export {
15
- ModalContext
16
- };
@@ -1,56 +0,0 @@
1
- import { nanoid } from "nanoid";
2
- import React, { useReducer, useState } from "react";
3
- import { ModalContext } from "./ModalContext.mjs";
4
- const windowStackReducer = (state, action) => {
5
- const newWindows = { ...state };
6
- switch (action.type) {
7
- case "ADD_WINDOW": {
8
- newWindows[action.id] = action.window;
9
- return newWindows;
10
- }
11
- case "REMOVE_WINDOW": {
12
- delete newWindows[action.id];
13
- return newWindows;
14
- }
15
- case "UPDATE_WINDOW": {
16
- newWindows[action.id] = action.window;
17
- return newWindows;
18
- }
19
- default:
20
- return state;
21
- }
22
- };
23
- const ModalProvider = ({
24
- children
25
- }) => {
26
- const [windows, dispatch] = useReducer(windowStackReducer, {});
27
- const [activeWindow, setActiveWindow] = useState();
28
- const addWindows = (window) => {
29
- const id = nanoid();
30
- dispatch({ type: "ADD_WINDOW", id, window });
31
- return id;
32
- };
33
- const removeWindow = (id) => {
34
- dispatch({ type: "REMOVE_WINDOW", id });
35
- };
36
- const updateWindow = (id, window) => {
37
- dispatch({ type: "UPDATE_WINDOW", id, window });
38
- };
39
- return /* @__PURE__ */ React.createElement(
40
- ModalContext.Provider,
41
- {
42
- value: {
43
- windows,
44
- addWindows,
45
- removeWindow,
46
- updateWindow,
47
- setActiveWindow,
48
- activeWindow
49
- }
50
- },
51
- children
52
- );
53
- };
54
- export {
55
- ModalProvider
56
- };
@@ -1,15 +0,0 @@
1
- import type { ReactElement } from 'react';
2
- export type Windows = {
3
- icon?: ReactElement;
4
- title: string;
5
- hasButton: boolean;
6
- };
7
- export interface IModalContextProps {
8
- windows: Record<string, Windows>;
9
- addWindows(window: Windows): string | void;
10
- removeWindow(id: string): void;
11
- updateWindow(id: string, window: Windows): void;
12
- setActiveWindow(title: string): void;
13
- activeWindow?: string;
14
- }
15
- export declare const ModalContext: import("react").Context<IModalContextProps>;
@@ -1,3 +0,0 @@
1
- import type { FC, PropsWithChildren } from 'react';
2
- export type ModalProviderProps = {};
3
- export declare const ModalProvider: FC<PropsWithChildren<ModalProviderProps>>;
File without changes
File without changes
File without changes
File without changes