elegant-cli
Advanced tools
Comparing version 3.0.0-innovators.8 to 3.0.0-innovators.9
{ | ||
"name": "elegant-cli", | ||
"version": "3.0.0-innovators.8", | ||
"version": "3.0.0-innovators.9", | ||
"description": "Elegant is the easiest way to create a new static website or blog, and publish it online. No need for databases, external services, or complicated server setups.", | ||
@@ -11,2 +11,3 @@ "scripts": { | ||
"publish:ui-patch": "cd ./packages/elegant-ui && node scripts/publish-elegant-ui-patch.ts", | ||
"publish:ui-minor-version": "cd ./packages/elegant-ui && node scripts/publish-elegant-ui-minor-version.ts", | ||
"test": "jest --watch --verbose ./integrations --detectOpenHandles --forceExit", | ||
@@ -49,2 +50,3 @@ "test:ci": "jest --ci ./integrations --detectOpenHandles --forceExit && cd source/elegant && npm run test:ci", | ||
"devDependencies": { | ||
"@babel/types": "^7.22.17", | ||
"@types/jest": "^29.5.0", | ||
@@ -51,0 +53,0 @@ "@types/node": "^18.15.0", |
@@ -15,3 +15,3 @@ <p align="center"> | ||
<a href="https://github.com/elegantframework/elegant/actions"> | ||
<img src="https://github.com/elegantframework/elegant/actions/workflows/jest.yml/badge.svg" alt="Build Status"> | ||
<img src="https://github.com/elegantframework/elegant/actions/workflows/install_and_test_elegant_core.yml/badge.svg" alt="Build Status"> | ||
</a> | ||
@@ -18,0 +18,0 @@ <a href="https://github.com/facebook/jest"> |
@@ -23,3 +23,3 @@ { | ||
"@apollo/client": "^3.7.17", | ||
"@brandonowens/elegant-ui": "^0.2.1", | ||
"@brandonowens/elegant-ui": "^0.3.0", | ||
"@docsearch/react": "^3.5.1", | ||
@@ -29,4 +29,2 @@ "@hapi/iron": "^7.0.1", | ||
"@hookform/resolvers": "^2.9.11", | ||
"@mdx-js/loader": "^2.3.0", | ||
"@mdx-js/react": "^2.3.0", | ||
"@napi-rs/canvas": "^0.1.41", | ||
@@ -92,10 +90,10 @@ "@next/env": "^13.4.1", | ||
"@jsdevtools/rehype-toc": "^3.0.2", | ||
"@storybook/addon-a11y": "^7.0.26", | ||
"@storybook/addon-essentials": "^7.0.26", | ||
"@storybook/addon-interactions": "^7.0.26", | ||
"@storybook/addon-links": "^7.0.26", | ||
"@storybook/addon-styling": "^1.3.2", | ||
"@storybook/blocks": "^7.0.26", | ||
"@storybook/nextjs": "^7.0.26", | ||
"@storybook/react": "^7.0.26", | ||
"@storybook/addon-a11y": "^7.4.1", | ||
"@storybook/addon-essentials": "^7.4.1", | ||
"@storybook/addon-interactions": "^7.4.1", | ||
"@storybook/addon-links": "^7.4.1", | ||
"@storybook/addon-styling": "^1.3.7", | ||
"@storybook/blocks": "^7.4.1", | ||
"@storybook/nextjs": "^7.4.1", | ||
"@storybook/react": "^7.4.1", | ||
"@storybook/testing-library": "^0.2.0", | ||
@@ -147,3 +145,2 @@ "@svgr/webpack": "^8.0.1", | ||
"framer-motion": "2.9.5", | ||
"front-matter": "^4.0.2", | ||
"glyphhanger": "^3.1.0", | ||
@@ -177,6 +174,5 @@ "jest": "^29.5.0", | ||
"seedrandom": "^3.0.5", | ||
"simple-functional-loader": "^1.2.1", | ||
"start-server-and-test": "^2.0.0", | ||
"storybook": "^7.0.26", | ||
"storybook-dark-mode": "^3.0.0", | ||
"storybook": "^7.4.1", | ||
"storybook-dark-mode": "^3.0.1", | ||
"stringify-object": "^3.3.0", | ||
@@ -183,0 +179,0 @@ "tailwindcss": "^3.2.7", |
import Link from 'next/link' | ||
import { useRouter } from 'next/router' | ||
import { createContext, forwardRef, useRef } from 'react' | ||
import { useIsomorphicLayoutEffect } from '@/hooks/useIsomorphicLayoutEffect' | ||
import { useIsomorphicLayoutEffect } from '@/utils/core/Hooks/useIsomorphicLayoutEffect'; | ||
import clsx from 'clsx' | ||
import { SearchButton } from '@/components/Search' | ||
import { Dialog } from '@headlessui/react' | ||
import Nav from "@/components/core/Sidebar/Skyline/Nav/Nav"; | ||
@@ -30,161 +30,3 @@ export const SidebarContext = createContext() | ||
/** | ||
* Find the nearest scrollable ancestor (or self if scrollable) | ||
* Code adapted and simplified from the smoothscroll polyfill | ||
* @param {Element} el | ||
*/ | ||
function nearestScrollableContainer(el) { | ||
/** | ||
* indicates if an element can be scrolled | ||
* | ||
* @param {Node} el | ||
*/ | ||
function isScrollable(el) { | ||
const style = window.getComputedStyle(el) | ||
const overflowX = style['overflowX'] | ||
const overflowY = style['overflowY'] | ||
const canScrollY = el.clientHeight < el.scrollHeight | ||
const canScrollX = el.clientWidth < el.scrollWidth | ||
const isScrollableY = canScrollY && (overflowY === 'auto' || overflowY === 'scroll') | ||
const isScrollableX = canScrollX && (overflowX === 'auto' || overflowX === 'scroll') | ||
return isScrollableY || isScrollableX | ||
} | ||
while (el !== document.body && isScrollable(el) === false) { | ||
el = el.parentNode || el.host | ||
} | ||
return el | ||
} | ||
function Nav({ nav, children, fallbackHref, mobile = false }) { | ||
const router = useRouter() | ||
const activeItemRef = useRef() | ||
const previousActiveItemRef = useRef() | ||
const scrollRef = useRef() | ||
useIsomorphicLayoutEffect(() => { | ||
function updatePreviousRef() { | ||
previousActiveItemRef.current = activeItemRef.current | ||
} | ||
if (activeItemRef.current) { | ||
if (activeItemRef.current === previousActiveItemRef.current) { | ||
updatePreviousRef() | ||
return | ||
} | ||
updatePreviousRef() | ||
const scrollable = nearestScrollableContainer(scrollRef.current) | ||
const scrollRect = scrollable.getBoundingClientRect() | ||
const activeItemRect = activeItemRef.current.getBoundingClientRect() | ||
const top = activeItemRef.current.offsetTop | ||
const bottom = top - scrollRect.height + activeItemRect.height | ||
if (scrollable.scrollTop > top || scrollable.scrollTop < bottom) { | ||
scrollable.scrollTop = top - scrollRect.height / 2 + activeItemRect.height / 2 | ||
} | ||
} | ||
}, [router.pathname]) | ||
return ( | ||
<nav ref={scrollRef} id="nav" className="lg:text-sm lg:leading-6 relative"> | ||
<div className="sticky top-0 -ml-0.5 pointer-events-none"> | ||
{!mobile && <div className="h-10 bg-white dark:bg-slate-900" />} | ||
<div className="bg-white dark:bg-slate-900 relative pointer-events-auto"> | ||
{/* <SearchButton className="hidden w-full lg:flex items-center text-sm leading-6 text-slate-400 rounded-md ring-1 ring-slate-900/10 shadow-sm py-1.5 pl-2 pr-3 hover:ring-slate-300 dark:bg-slate-800 dark:highlight-white/5 dark:hover:bg-slate-700"> | ||
{({ actionKey }) => ( | ||
<> | ||
<svg | ||
width="24" | ||
height="24" | ||
fill="none" | ||
aria-hidden="true" | ||
className="mr-3 flex-none" | ||
> | ||
<path | ||
d="m19 19-3.5-3.5" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<circle | ||
cx="11" | ||
cy="11" | ||
r="6" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
Quick search... | ||
{actionKey && ( | ||
<span className="ml-auto pl-3 flex-none text-xs font-semibold"> | ||
{actionKey[0]}K | ||
</span> | ||
)} | ||
</> | ||
)} | ||
</SearchButton> */} | ||
</div> | ||
{!mobile && <div className="h-8 bg-gradient-to-b from-white dark:from-slate-900" />} | ||
</div> | ||
<ul> | ||
{children} | ||
{nav && | ||
Object.keys(nav) | ||
.map((category) => { | ||
let publishedItems = nav[category].filter((item) => item.published !== false) | ||
if (publishedItems.length === 0 && !fallbackHref) return null | ||
return ( | ||
<li key={category} className="mt-12 lg:mt-8"> | ||
<h5 | ||
className={clsx('mb-8 lg:mb-3 font-semibold', { | ||
'text-slate-900 dark:text-slate-200': publishedItems.length > 0, | ||
'text-slate-400': publishedItems.length === 0, | ||
})} | ||
> | ||
{category} | ||
</h5> | ||
<ul | ||
className={clsx( | ||
'space-y-6 lg:space-y-2 border-l border-slate-100', | ||
mobile ? 'dark:border-slate-700' : 'dark:border-slate-800' | ||
)} | ||
> | ||
{(fallbackHref ? nav[category] : publishedItems).map((item, i) => { | ||
let isActive = item.match | ||
? item.match.test(router.asPath) | ||
: item.href === router.asPath | ||
return ( | ||
<NavItem | ||
key={i} | ||
href={item.href} | ||
isActive={isActive} | ||
ref={isActive ? activeItemRef : undefined} | ||
isPublished={item.published !== false} | ||
fallbackHref={fallbackHref} | ||
> | ||
{item.shortTitle || item.title} | ||
</NavItem> | ||
) | ||
})} | ||
</ul> | ||
</li> | ||
) | ||
}) | ||
.filter(Boolean)} | ||
</ul> | ||
</nav> | ||
) | ||
} | ||
function Wrapper({ allowOverflow, children }) { | ||
@@ -208,5 +50,3 @@ return <div className={allowOverflow ? undefined : 'overflow-hidden'}>{children}</div> | ||
<div className="hidden lg:block fixed z-20 inset-0 top-[3.8125rem] left-[max(0px,calc(50%-45rem))] right-auto w-[19.5rem] pb-10 px-8 overflow-y-auto"> | ||
<Nav nav={nav} fallbackHref={fallbackHref}> | ||
{sidebar} | ||
</Nav> | ||
<Nav nav={nav} /> | ||
</div> | ||
@@ -240,5 +80,3 @@ <div className="lg:pl-[19.5rem]">{children}</div> | ||
</button> | ||
<Nav nav={nav} fallbackHref={fallbackHref} mobile={true}> | ||
{sidebar} | ||
</Nav> | ||
<Nav nav={nav} mobile={true} /> | ||
</div> | ||
@@ -245,0 +83,0 @@ </Dialog> |
import Link from 'next/link'; | ||
import { useRouter } from 'next/router'; | ||
import VersionSwitcher from '@/components/core/Headers/VersionSwitcher'; | ||
import { SearchButton } from '@/components/Search'; | ||
import Router from 'next/router'; | ||
@@ -222,18 +221,2 @@ import Logo from '@/components/core/Logos/Logo/Logo'; | ||
</div> | ||
{/* <SearchButton className="ml-auto text-slate-500 w-8 h-8 -my-1 flex items-center justify-center hover:text-slate-600 lg:hidden dark:text-slate-400 dark:hover:text-slate-300"> | ||
<span className="sr-only">Search</span> | ||
<svg | ||
width="24" | ||
height="24" | ||
fill="none" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
aria-hidden="true" | ||
> | ||
<path d="m19 19-3.5-3.5" /> | ||
<circle cx="11" cy="11" r="6" /> | ||
</svg> | ||
</SearchButton> */} | ||
<NavPopover className="ml-auto -my-1" display="lg:hidden" /> | ||
@@ -240,0 +223,0 @@ </div> |
@@ -1,2 +0,2 @@ | ||
import { useIsomorphicLayoutEffect } from '@/hooks/useIsomorphicLayoutEffect'; | ||
import { useIsomorphicLayoutEffect } from '@/utils/core/Hooks/useIsomorphicLayoutEffect'; | ||
import { Listbox } from '@headlessui/react'; | ||
@@ -6,5 +6,3 @@ import clsx from 'clsx'; | ||
import { create } from 'zustand'; | ||
import SunIcon from './core/Icons/SunIcon/SunIcon'; | ||
import MoonIcon from './core/Icons/MoonIcon/MoonIcon'; | ||
import PCIcon from './core/Icons/PCIcon/PCIcon'; | ||
import { MoonIcon, PCIcon, SunIcon } from '@brandonowens/elegant-ui'; | ||
@@ -11,0 +9,0 @@ const useSetting = create((set) => ({ |
@@ -1,28 +0,65 @@ | ||
import { createPageList } from '@/utils/createPageList'; | ||
import { NavigationSection } from '@/types/Navigation'; | ||
// map our documentation files to a page | ||
const pages = createPageList( | ||
require.context(`../../_content/docs/?meta=title,shortTitle,published`, false, /\.mdx$/), | ||
'docs' | ||
); | ||
export const documentationNav = { | ||
'Prologue': [ | ||
pages['release-notes'], | ||
pages['upgrade'], | ||
pages['contribution-guide'] | ||
], | ||
'Getting Started': [ | ||
pages['installation'], | ||
pages['configuration'], | ||
pages['new-documents'], | ||
pages['deployment'] | ||
], | ||
'Customization': [ | ||
pages['theme'] | ||
], | ||
'Plugins': [ | ||
pages['convertkit'], | ||
pages['google-analytics'] | ||
] | ||
} | ||
/** | ||
* The configuration for the documentation sidebar navigation. | ||
*/ | ||
export const documentationNav: NavigationSection[] = [ | ||
{ | ||
title: "Prologue", | ||
links: [ | ||
{ | ||
title: "Release Notes", | ||
href: "/docs/release-notes" | ||
}, | ||
{ | ||
title: "Upgrade Guide", | ||
href: "/docs/upgrade" | ||
}, | ||
{ | ||
title: "Contribution Guide", | ||
href: "/docs/contribution-guide" | ||
} | ||
] | ||
}, | ||
{ | ||
title: "Getting Started", | ||
links: [ | ||
{ | ||
title: "Installation", | ||
href: "/docs/installation" | ||
}, | ||
{ | ||
title: "Configuration", | ||
href: "/docs/configuration" | ||
}, | ||
{ | ||
title: "New Documents", | ||
href: "/docs/new-documents" | ||
}, | ||
{ | ||
title: "Deployment", | ||
href: "/docs/deployment" | ||
} | ||
] | ||
}, | ||
{ | ||
title: "Customization", | ||
links: [{ | ||
title: "Theme", | ||
href: "/docs/theme" | ||
}] | ||
}, | ||
{ | ||
title: "Plugins", | ||
links: [ | ||
{ | ||
title: "ConvertKit", | ||
href: "/docs/convertkit" | ||
}, | ||
{ | ||
title: "Google Analytics", | ||
href: "/docs/google-analytics" | ||
} | ||
] | ||
} | ||
]; |
@@ -12,3 +12,2 @@ import '../css/fonts.css'; | ||
import Head from 'next/head'; | ||
import { SearchProvider } from '@/components/Search'; | ||
import AnalyticsHead from '@/components/core/Analytics/AnalyticsHead'; | ||
@@ -102,7 +101,5 @@ import AnalyticsBody from '@/components/core/Analytics/AnalyticsBody'; | ||
let section = | ||
meta.section || | ||
Object.entries(Component.layoutProps?.Layout?.nav ?? {}).find(([, items]) => | ||
items.find(({ href }) => href === router.pathname) | ||
)?.[0]; | ||
let section = Object.entries(Component.layoutProps?.Layout?.nav ?? {}).find(([, items]) => | ||
items.links.find(({ href }) => href === router.pathname) | ||
)?.[0]; | ||
@@ -161,4 +158,3 @@ // set our url | ||
)} | ||
<SearchProvider> | ||
{stickyHeader && ( | ||
{stickyHeader && ( | ||
<Header | ||
@@ -176,5 +172,4 @@ hasNav={Boolean(Component.layoutProps?.Layout?.nav)} | ||
</Layout> | ||
</SearchProvider> | ||
</> | ||
) | ||
} |
@@ -1,10 +0,8 @@ | ||
import { useContext } from 'react' | ||
import { SidebarContext } from '@/components/core/Layouts/SidebarLayout' | ||
import { useRouter } from 'next/router' | ||
import { useRouter } from 'next/router'; | ||
import { documentationNav } from '@/config/Navigation'; | ||
export function usePrevNext() { | ||
let router = useRouter(); | ||
let { nav } = useContext(SidebarContext); | ||
let pages = Object.keys(nav).flatMap((category) => nav[category]); | ||
let pageIndex = pages.findIndex((page) => page.href === router.pathname); | ||
let pages = documentationNav.flatMap((section) => section.links); | ||
let pageIndex = pages.findIndex((page) => page.href === router.asPath); | ||
@@ -11,0 +9,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
import { useIsomorphicLayoutEffect } from '@/hooks/useIsomorphicLayoutEffect'; | ||
import { useIsomorphicLayoutEffect } from '@/utils/core/Hooks/useIsomorphicLayoutEffect'; | ||
import { useEffect, useRef } from 'react'; | ||
@@ -3,0 +3,0 @@ import { create } from 'zustand'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56002297
77557
10
531