elseware-ui 2.26.2 → 2.27.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 (30) hide show
  1. package/README.md +109 -109
  2. package/build/components/general/index.d.ts +0 -1
  3. package/build/components/markdown/{editor → com/editor}/MarkdownEditor.d.ts +1 -1
  4. package/build/components/markdown/com/toc/MarkdownTOC.d.ts +5 -0
  5. package/build/components/markdown/{viewer → com/viewer}/MarkdownViewer.d.ts +2 -2
  6. package/build/components/markdown/hooks/useMarkdown.d.ts +1 -0
  7. package/build/components/markdown/index.d.ts +5 -2
  8. package/build/components/markdown/provider/MarkdownContext.d.ts +9 -0
  9. package/build/components/markdown/provider/MarkdownProvider.d.ts +7 -0
  10. package/build/components/markdown/types/markdown.d.ts +5 -0
  11. package/build/components/markdown/utils/extractHeadings.d.ts +2 -0
  12. package/build/components/markdown/utils/generateHeadingNumbers.d.ts +5 -0
  13. package/build/components/markdown/utils/sanitizeHeading.d.ts +1 -0
  14. package/build/components/markdown/utils/slugify.d.ts +1 -0
  15. package/build/components/navigation/menu/Menu.d.ts +1 -1
  16. package/build/components/navigation/menu/index.d.ts +2 -1
  17. package/build/components/navigation/menu/types.d.ts +1 -2
  18. package/build/compositions/navigation/index.d.ts +1 -0
  19. package/build/compositions/navigation/sidebar/Sidebar.d.ts +10 -0
  20. package/build/data/test/md/index.d.ts +2 -0
  21. package/build/data/test/test-data.d.ts +0 -1
  22. package/build/index.es.js +1793 -1965
  23. package/build/index.js +1795 -1964
  24. package/build/layouts/index.d.ts +2 -1
  25. package/build/layouts/secondary/documentation-layout/DocumentationLayout.d.ts +6 -0
  26. package/package.json +128 -126
  27. package/build/components/general/sidebar/Sidebar.d.ts +0 -10
  28. package/build/components/markdown/editor/index.d.ts +0 -2
  29. package/build/components/markdown/viewer/index.d.ts +0 -2
  30. /package/build/{components/general → compositions/navigation}/sidebar/index.d.ts +0 -0
package/README.md CHANGED
@@ -1,109 +1,109 @@
1
- # elseware UI
2
-
3
- ## Component Imports Structure
4
-
5
- ```javascript
6
- // External
7
- import { ReactNode } from "react";
8
-
9
- // Internal
10
- import { cn } from "@/utils";
11
-
12
- // Types
13
- import { BaseComponentProps } from "@/interfaces";
14
- import { Variant, Shape, Size } from "@/types";
15
-
16
- // Data
17
- import {
18
- shapes,
19
- variants,
20
- borderVariants,
21
- avatarSizes,
22
- } from "@/data/styles";
23
- ```
24
-
25
- Copy the following and define the component imports accordingly
26
-
27
- ```javascript
28
- // External
29
-
30
- // Internal
31
-
32
- // Types
33
-
34
- // Data
35
- ```
36
-
37
-
38
- ## Folder Hierarchy
39
- - components: Base UI primitives (buttons, inputs, modals, etc.)
40
- - compositions: Composite reusable structures built from primitives
41
- - data: Metadata used on the components/compositions
42
- - layouts: Page layouts that can be used to quickly structure the page formats
43
- - styles: Tailwind/CSS stylings
44
- - types: Custom react types
45
- - utils: Reusable utility functions and hooks
46
-
47
- ## Setup
48
-
49
- Install the dependendecies via `npm i`.
50
-
51
- ## Run Storybook
52
-
53
- To test the components and its features start storybook using `npm run dev`.
54
-
55
- ## Build
56
-
57
- Run `npm run build` to build the UI framework.
58
-
59
- ## Publishing to npm
60
-
61
- ### Publishing a New Version
62
-
63
- 1. **Update the version number**:
64
- - Before publishing a new version, update the version in `package.json` following [semantic versioning](https://semver.org/).
65
- - Example:
66
- ```json
67
- {
68
- "name": "elseware-ui",
69
- "version": "1.0.1",
70
- ...
71
- }
72
- ```
73
-
74
- 2. **Build the UI Framework**:
75
- - Run the following command to ensure your changes are built and ready to be published:
76
- ```bash
77
- npm run build
78
- ```
79
-
80
- 3. **Login to npm**:
81
- - If you're not already logged in to npm, log in using:
82
- ```bash
83
- npm login
84
- ```
85
-
86
- 4. **Publish the package**:
87
- - To publish the package, run the following command:
88
- ```bash
89
- npm publish --access public
90
- ```
91
- - Make sure the package name in `package.json` is unique and does not conflict with other packages on npm.
92
-
93
- ### Unpublishing an Older Version
94
-
95
- If you need to unpublish a specific version of the package:
96
-
97
- 1. **Unpublish a specific version**:
98
- - To unpublish a specific version of your package (e.g., `1.0.0`), run:
99
- ```bash
100
- npm unpublish elseware-ui@1.0.0
101
- ```
102
-
103
- 2. **Unpublish the entire package**:
104
- - If you need to unpublish the entire package, you can run the following command (not recommended for public packages):
105
- ```bash
106
- npm unpublish elseware-ui --force
107
- ```
108
-
109
- **Note:** Be cautious when using `--force` as npm restricts package unpublishing for packages that are older than 72 hours to avoid breaking dependencies.
1
+ # elseware UI
2
+
3
+ ## Component Imports Structure
4
+
5
+ ```javascript
6
+ // External
7
+ import { ReactNode } from "react";
8
+
9
+ // Internal
10
+ import { cn } from "@/utils";
11
+
12
+ // Types
13
+ import { BaseComponentProps } from "@/interfaces";
14
+ import { Variant, Shape, Size } from "@/types";
15
+
16
+ // Data
17
+ import {
18
+ shapes,
19
+ variants,
20
+ borderVariants,
21
+ avatarSizes,
22
+ } from "@/data/styles";
23
+ ```
24
+
25
+ Copy the following and define the component imports accordingly
26
+
27
+ ```javascript
28
+ // External
29
+
30
+ // Internal
31
+
32
+ // Types
33
+
34
+ // Data
35
+ ```
36
+
37
+
38
+ ## Folder Hierarchy
39
+ - components: Base UI primitives (buttons, inputs, modals, etc.)
40
+ - compositions: Composite reusable structures built from primitives
41
+ - data: Metadata used on the components/compositions
42
+ - layouts: Page layouts that can be used to quickly structure the page formats
43
+ - styles: Tailwind/CSS stylings
44
+ - types: Custom react types
45
+ - utils: Reusable utility functions and hooks
46
+
47
+ ## Setup
48
+
49
+ Install the dependendecies via `npm i`.
50
+
51
+ ## Run Storybook
52
+
53
+ To test the components and its features start storybook using `npm run dev`.
54
+
55
+ ## Build
56
+
57
+ Run `npm run build` to build the UI framework.
58
+
59
+ ## Publishing to npm
60
+
61
+ ### Publishing a New Version
62
+
63
+ 1. **Update the version number**:
64
+ - Before publishing a new version, update the version in `package.json` following [semantic versioning](https://semver.org/).
65
+ - Example:
66
+ ```json
67
+ {
68
+ "name": "elseware-ui",
69
+ "version": "1.0.1",
70
+ ...
71
+ }
72
+ ```
73
+
74
+ 2. **Build the UI Framework**:
75
+ - Run the following command to ensure your changes are built and ready to be published:
76
+ ```bash
77
+ npm run build
78
+ ```
79
+
80
+ 3. **Login to npm**:
81
+ - If you're not already logged in to npm, log in using:
82
+ ```bash
83
+ npm login
84
+ ```
85
+
86
+ 4. **Publish the package**:
87
+ - To publish the package, run the following command:
88
+ ```bash
89
+ npm publish --access public
90
+ ```
91
+ - Make sure the package name in `package.json` is unique and does not conflict with other packages on npm.
92
+
93
+ ### Unpublishing an Older Version
94
+
95
+ If you need to unpublish a specific version of the package:
96
+
97
+ 1. **Unpublish a specific version**:
98
+ - To unpublish a specific version of your package (e.g., `1.0.0`), run:
99
+ ```bash
100
+ npm unpublish elseware-ui@1.0.0
101
+ ```
102
+
103
+ 2. **Unpublish the entire package**:
104
+ - If you need to unpublish the entire package, you can run the following command (not recommended for public packages):
105
+ ```bash
106
+ npm unpublish elseware-ui --force
107
+ ```
108
+
109
+ **Note:** Be cautious when using `--force` as npm restricts package unpublishing for packages that are older than 72 hours to avoid breaking dependencies.
@@ -1,2 +1 @@
1
1
  export * from "./content-area";
2
- export * from "./sidebar";
@@ -1,5 +1,5 @@
1
1
  import { FieldHookConfig } from "formik";
2
- import "../../../styles/components/markdown/index.css";
2
+ import "../../../../styles/components/markdown/index.css";
3
3
  import "@mdxeditor/editor/style.css";
4
4
  interface MarkdownEditorProps {
5
5
  placeholder?: string;
@@ -0,0 +1,5 @@
1
+ interface MarkdownTOCProps {
2
+ title?: string;
3
+ }
4
+ declare function MarkdownTOC({ title }: MarkdownTOCProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export default MarkdownTOC;
@@ -1,7 +1,7 @@
1
- import "../../../styles/components/markdown/index.css";
2
1
  import "@mdxeditor/editor/style.css";
2
+ import "../../../../styles/components/markdown/index.css";
3
3
  interface MarkdownViewerProps {
4
- value: string;
4
+ value?: string;
5
5
  }
6
6
  declare function MarkdownViewer({ value }: MarkdownViewerProps): import("react/jsx-runtime").JSX.Element;
7
7
  export default MarkdownViewer;
@@ -0,0 +1 @@
1
+ export declare function useMarkdown(): import("../provider/MarkdownContext").MarkdownContextType | null;
@@ -1,2 +1,5 @@
1
- export * from "./editor";
2
- export * from "./viewer";
1
+ import MarkdownEditor from "./com/editor/MarkdownEditor";
2
+ import MarkdownTOC from "./com/toc/MarkdownTOC";
3
+ import MarkdownViewer from "./com/viewer/MarkdownViewer";
4
+ import MarkdownProvider from "./provider/MarkdownProvider";
5
+ export { MarkdownEditor, MarkdownTOC, MarkdownViewer, MarkdownProvider };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { MarkdownHeading } from "../types/markdown";
3
+ export interface MarkdownContextType {
4
+ markdown: string;
5
+ headings: MarkdownHeading[];
6
+ activeHeading: string;
7
+ setActiveHeading: (id: string) => void;
8
+ }
9
+ export declare const MarkdownContext: import("react").Context<MarkdownContextType | null>;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface MarkdownProviderProps {
3
+ markdown: string;
4
+ children: React.ReactNode;
5
+ }
6
+ declare function MarkdownProvider({ markdown, children }: MarkdownProviderProps): import("react/jsx-runtime").JSX.Element;
7
+ export default MarkdownProvider;
@@ -0,0 +1,5 @@
1
+ export interface MarkdownHeading {
2
+ id: string;
3
+ text: string;
4
+ level: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ import { MarkdownHeading } from "../types/markdown";
2
+ export declare function extractHeadings(markdown: string): MarkdownHeading[];
@@ -0,0 +1,5 @@
1
+ import { MarkdownHeading } from "../types/markdown";
2
+ export interface NumberedHeading extends MarkdownHeading {
3
+ numbering: string;
4
+ }
5
+ export declare function generateHeadingNumbers(headings: MarkdownHeading[]): NumberedHeading[];
@@ -0,0 +1 @@
1
+ export declare function sanitizeHeading(text: string): string;
@@ -0,0 +1 @@
1
+ export declare function slugify(text: string): string;
@@ -1,2 +1,2 @@
1
1
  import { MenuProps } from "./types";
2
- export declare const Menu: ({ items, defaultMenuElements, className, selectedKey, defaultSelectedKey, navigate }: MenuProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const Menu: ({ items, className, navigate, defaultMenuElements, currentPath, }: MenuProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,6 @@ import { Menu } from "./Menu";
2
2
  import { MenuGroup } from "./com/MenuGroup";
3
3
  import { MenuItem } from "./com/MenuItem";
4
4
  import { MenuItemTitle } from "./com/MenuItemTitle";
5
- export { Menu, MenuGroup, MenuItem, MenuItemTitle };
5
+ import { MenuNode } from "./types";
6
+ export { Menu, MenuGroup, MenuItem, MenuItemTitle, MenuNode };
6
7
  export * from "./types";
@@ -31,7 +31,6 @@ export interface MenuProps {
31
31
  items: MenuNode[];
32
32
  defaultMenuElements?: DefaultMenuElements;
33
33
  className?: string;
34
- selectedKey?: string;
35
- defaultSelectedKey?: string;
36
34
  navigate?: (to: string) => void;
35
+ currentPath?: string;
37
36
  }
@@ -1,2 +1,3 @@
1
1
  export * from "./box-nav";
2
+ export * from "./sidebar";
2
3
  export * from "./top-nav";
@@ -0,0 +1,10 @@
1
+ import { BaseComponentProps } from "../../../interfaces";
2
+ import { MenuNode } from "../../../components/navigation/menu";
3
+ import "./sidebar.css";
4
+ export interface SidebarProps extends BaseComponentProps {
5
+ items?: MenuNode[];
6
+ navigate?: (to: string) => void;
7
+ currentPath?: string;
8
+ }
9
+ declare function Sidebar({ items, navigate, currentPath, className, ...rest }: SidebarProps): import("react/jsx-runtime").JSX.Element;
10
+ export default Sidebar;
@@ -0,0 +1,2 @@
1
+ import sample from "./sample.md";
2
+ export { sample };
@@ -18,4 +18,3 @@ export declare const artifactOptions: {
18
18
  label: string;
19
19
  value: string;
20
20
  }[];
21
- export declare const sampleMarkdownContent = "\n# Hello Markdown\n\nWelcome to the **Markdown Editor**! \nThis editor supports *rich formatting*, _underline_, ~~strikethrough~~ and more.\n\n---\n\n## \uD83D\uDD17 Links\nCheck out [Elseware Games](https://elseware.games) \u2014 your source for game tools.\n\n---\n\n## \uD83D\uDCF7 Images\n![Example Image](https://via.placeholder.com/150)\n\n---\n\n## \uD83D\uDD22 Lists\n\n### - Unordered List\n- Item one\n- Item two\n - Nested item\n- Item three\n\n### 1. Ordered List\n1. First\n2. Second\n3. Third\n\n### \u2705 Task List\n- [x] Task completed\n- [ ] Task pending\n- [ ] Another task\n\n---\n\n## \uD83D\uDCE6 Blockquote\n> \"Great software is built, not bought.\"\n\n---\n\n## \uD83D\uDCCA Table\n\n| Feature | Supported |\n| ------------- | --------- |\n| Headings | \u2705 |\n| Lists | \u2705 |\n| Links | \u2705 |\n| Tables | \u2705 |\n| Images | \u2705 |\n| Quotes | \u2705 |\n| Thematic Line | \u2705 |\n\n---\n\n## \uD83D\uDC4B Final Words\n\nHappy editing with **Markdown Editor**!\n";