@xyd-js/theme-poetry 0.1.0-xyd.6 → 0.1.0-xyd.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyd-js/theme-poetry",
3
- "version": "0.1.0-xyd.6",
3
+ "version": "0.1.0-xyd.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,6 +12,11 @@
12
12
  "import": "./dist/index.js"
13
13
  }
14
14
  },
15
+ "files": [
16
+ "dist",
17
+ "public",
18
+ "package.json"
19
+ ],
15
20
  "dependencies": {
16
21
  "@linaria/atomic": "^6.2.0",
17
22
  "@linaria/core": "^6.2.0",
@@ -22,7 +27,7 @@
22
27
  "react-dom": "^18.3.1",
23
28
  "react-router": "^7.1.1",
24
29
  "@xyd-js/components": "0.1.0-xyd.2",
25
- "@xyd-js/framework": "0.1.0-xyd.17"
30
+ "@xyd-js/framework": "0.1.0-xyd.18"
26
31
  },
27
32
  "devDependencies": {
28
33
  "@babel/preset-typescript": "^7.26.0",
package/rollup.config.js DELETED
@@ -1,77 +0,0 @@
1
- import {createRequire} from "module";
2
-
3
- import resolve from '@rollup/plugin-node-resolve';
4
- import commonjs from '@rollup/plugin-commonjs';
5
- import typescript from '@rollup/plugin-typescript';
6
- import dts from 'rollup-plugin-dts';
7
- import postcss from 'rollup-plugin-postcss';
8
- import postcssImport from 'postcss-import';
9
- import wyw from '@wyw-in-js/rollup';
10
-
11
- const require = createRequire(import.meta.url);
12
- const {dependencies} = require('./package.json', {assert: {type: 'json'}});
13
-
14
- // unify theme build system
15
- const external = [
16
- ...Object.keys(dependencies),
17
- 'react',
18
- 'react-router',
19
-
20
- // TODO: another `@xyd` packages?
21
- '@xyd-js/framework/react'
22
- ];
23
-
24
- export default [
25
- {
26
- input: {
27
- index: './src/index.ts'
28
- },
29
- output: [
30
- {
31
- dir: 'dist',
32
- format: 'esm',
33
- sourcemap: true,
34
- entryFileNames: '[name].js'
35
- }
36
- ],
37
- plugins: [
38
- wyw({
39
- include: ['**/*.{ts,tsx}'],
40
- babelOptions: {
41
- presets: [
42
- '@babel/preset-typescript',
43
- '@babel/preset-react'
44
- ],
45
- },
46
- }),
47
- resolve(),
48
- commonjs(),
49
- typescript({
50
- tsconfig: './tsconfig.json',
51
- }),
52
- postcss({
53
- extensions: ['.css'],
54
- plugins: [postcssImport()],
55
- extract: true, // Extract CSS into a separate file
56
- minimize: true, // Minify the CSS
57
- }),
58
- ],
59
- external
60
- },
61
- {
62
- input: './src/index.ts',
63
- output: {
64
- file: 'dist/index.d.ts',
65
- format: 'es',
66
- },
67
- plugins: [
68
- dts({
69
- respectExternal: true, // Ignore unresolved imports
70
- }),
71
- ],
72
- external: [
73
- ...external,
74
- /\.css$/ // Mark CSS imports as external
75
- ],
76
- },
77
- ];
@@ -1,145 +0,0 @@
1
- import {css} from "@linaria/core";
2
-
3
- const globalPageGutter = '8px';
4
- export const globalHeaderHeight = '46px';
5
- const globalHeaderWarningHeight = "0px";
6
- const contentTopSpace = "12px";
7
-
8
- const globalHeaderHeightWithSub = '90px';
9
-
10
- const cubicMove = "cubic-bezier(.65, 0, .35, 1)";
11
- const sidebarWidth = "450px";
12
-
13
- // TODO: better solution - design tokens
14
- export const globals = css`
15
- :global() {
16
- :root {
17
- --xyd-navbar-height: ${globalHeaderHeight};
18
- --xyd-sidebar-width: ${sidebarWidth};
19
- }
20
- }
21
- `;
22
-
23
- export const $layout = {
24
- host: css`
25
- width: 100%;
26
- `,
27
- header: css`
28
- display: flex;
29
- justify-content: space-between;
30
- align-items: center;
31
-
32
- position: fixed;
33
- top: ${globalHeaderWarningHeight};
34
- right: ${globalPageGutter};
35
- left: ${globalPageGutter};
36
-
37
- height: ${globalHeaderHeight};
38
- `,
39
- header$$sub: css`
40
- flex-direction: column;
41
- height: ${globalHeaderHeightWithSub};
42
- transition: transform 200ms;
43
- `,
44
- header$$hideMain: css`
45
- transform: translateY(calc(-${globalHeaderHeight} + 3px));
46
- `,
47
- main: css`
48
- position: fixed;
49
- top: calc(${globalHeaderHeight} + ${globalHeaderWarningHeight});
50
- bottom: ${globalPageGutter};
51
- left: ${globalPageGutter};
52
- right: ${globalPageGutter};
53
- }`,
54
- main$$sub: css`
55
- top: calc(${globalHeaderHeightWithSub} + ${globalHeaderWarningHeight});
56
- transition: top 200ms;
57
- `,
58
- sidebar: css`
59
- flex-direction: column;
60
- position: absolute;
61
- top: 0;
62
- left: 0;
63
- bottom: 0;
64
- right: 0;
65
- z-index: 101;
66
- width: ${sidebarWidth};
67
- border: 0;
68
- padding: ${contentTopSpace} 0 0;
69
- overflow: visible;
70
- background: none;
71
- border-radius: 0;
72
- opacity: 1;
73
- visibility: visible;
74
- transition: opacity .3s ${cubicMove};
75
- `,
76
- }
77
-
78
- export const $page = {
79
- host: css`
80
- position: absolute;
81
- top: ${contentTopSpace};
82
- right: 0;
83
- bottom: 0;
84
- z-index: 201;
85
- background: #fff;
86
-
87
- overflow: hidden;
88
- transition: opacity .3s ${cubicMove};
89
-
90
- left: ${sidebarWidth};
91
- `,
92
- scroll: css`
93
- overflow: scroll;
94
- height: 100%;
95
-
96
- `,
97
- container: css`
98
- padding: 0;
99
- width: 100%;
100
- //position: relative; TODO: unset if during client render?
101
- min-height: 100%;
102
-
103
- max-width: 100%;
104
- margin: 0 auto;
105
- font-size: 15px;
106
- line-height: 24px;
107
- `,
108
- articleContainer: css`
109
- width: 980px;
110
- padding: 40px 56px;
111
- padding-left: 0;
112
- padding-top: 20px;
113
- margin: 0 auto;
114
- margin-left: 100px;
115
- max-width: 100%;
116
- `,
117
- articleContainer$$fullWidth: css`
118
- width: 1200px;
119
- `,
120
- }
121
-
122
- export const $article = {
123
- host: css`
124
- display: flex;
125
- gap: 30px;
126
- width: 100%;
127
- align-items: flex-start;;
128
- `,
129
- content: css`
130
- flex: 1 1 0;
131
- overflow: hidden;
132
- `,
133
- nav: css`
134
- position: sticky;
135
- top: 30px;
136
- width: 180px;
137
- margin-top: 0;
138
- margin-left: 50px;
139
- padding-left: 16px;
140
- flex: none;
141
- `,
142
- nav$$equal: css`
143
- flex: 1;
144
- `
145
- }
@@ -1,116 +0,0 @@
1
- import React, {useEffect, useState} from "react"
2
-
3
- import {$layout, $page, $article, globalHeaderHeight} from "./Layout.styles"
4
-
5
- export interface LayoutProps {
6
- header: React.ReactNode;
7
- aside: React.ReactNode;
8
- content: React.ReactNode;
9
- contentNav: React.ReactNode;
10
- subheader?: boolean;
11
- kind?: "fullwidth" | "equal"
12
- }
13
-
14
- // TODO: move scroller to xyd-foo
15
- export function Layout(props: LayoutProps) {
16
- const [hideMainHeader, setHideMainHeader] = useState(false)
17
- const [scrollTop, setScrollTop] = useState(0)
18
- const [controlScrollPos, setControlScrollPos] = useState(0)
19
-
20
- useEffect(() => {
21
- if (scrollTop === controlScrollPos) {
22
- return
23
- }
24
-
25
- const checkpoint = parseInt(globalHeaderHeight, 10) / 2
26
- const diff = scrollTop - controlScrollPos
27
- const reversePosDiff = Math.abs(scrollTop - controlScrollPos)
28
-
29
- if (diff > checkpoint) {
30
- setHideMainHeader(true)
31
- } else if (reversePosDiff > checkpoint) {
32
- setHideMainHeader(false)
33
- }
34
- }, [
35
- scrollTop,
36
- controlScrollPos,
37
- ]);
38
-
39
- function onScroll(e: Event) {
40
- if (!(e.target instanceof HTMLElement)) {
41
- return
42
- }
43
-
44
- const scroll = e.target?.scrollTop
45
- setScrollTop(scroll)
46
- }
47
-
48
- function onScrollFinish(e: Event) {
49
- if (!(e.target instanceof HTMLElement)) {
50
- return
51
- }
52
-
53
- setControlScrollPos(e.target?.scrollTop)
54
- }
55
-
56
- // TODO: by ref?
57
- // TODO: MOVE SOMEWHERE ELSE BECAUSE IT DECREASE PERFORMANCE (RERENDER)
58
- useEffect(() => {
59
- // return // TODO: UNCOMMENT
60
-
61
- if (!props.subheader) {
62
- return
63
- }
64
-
65
- document.querySelector(`.${$page.scroll}`)?.addEventListener("scroll", onScroll)
66
- document.querySelector(`.${$page.scroll}`)?.addEventListener("scrollend", onScrollFinish)
67
-
68
- return () => {
69
- document.querySelector(`.${$page.scroll}`)?.removeEventListener("scroll", onScroll)
70
- document.querySelector(`.${$page.scroll}`)?.removeEventListener("scrollend", onScrollFinish)
71
- }
72
- }, []);
73
-
74
- return <div className={$layout.host}>
75
- <header className={`
76
- ${$layout.header}
77
- ${props.subheader && $layout.header$$sub}
78
- ${hideMainHeader && $layout.header$$hideMain}
79
- `}>
80
- {props.header}
81
- </header>
82
- <main className={`
83
- ${$layout.main}
84
- ${!hideMainHeader && props.subheader && $layout.main$$sub}
85
- `}>
86
- <aside className={$layout.sidebar}>
87
- {props.aside}
88
- </aside>
89
- <div className={$page.host}>
90
- <div className={$page.scroll}>
91
- <div className={$page.container}>
92
- <div className={`
93
- ${$page.articleContainer}
94
- ${props.kind == "fullwidth" && $page.articleContainer$$fullWidth}
95
- ${props.kind == "equal" && $page.articleContainer$$fullWidth}
96
- `}>
97
- <article className={$article.host}>
98
- <section className={$article.content}>
99
- {props.content}
100
- </section>
101
- {
102
- props.contentNav && <nav className={`
103
- ${$article.nav}
104
- ${props.kind == "equal" && $article.nav$$equal}
105
- `}>
106
- {props.contentNav}
107
- </nav>
108
- }
109
- </article>
110
- </div>
111
- </div>
112
- </div>
113
- </div>
114
- </main>
115
- </div>
116
- }
@@ -1,5 +0,0 @@
1
- export {
2
- Layout
3
- } from "./Layout";
4
-
5
- export type {LayoutProps} from "./Layout";
package/src/index.css DELETED
@@ -1,67 +0,0 @@
1
- @import "vars.css";
2
-
3
- @font-face {
4
- font-family: 'Mona Sans';
5
- src: url('../public/fonts/MonaSans/Mona-Sans.woff2') format('woff2 supports variations'),
6
- url('../public/fonts/MonaSans/Mona-Sans.woff2') format('woff2-variations');
7
- font-weight: 200 900;
8
- font-stretch: 75% 125%;
9
- }
10
-
11
- html {
12
- font-family: 'Mona Sans', serif;
13
- }
14
-
15
- body {
16
- margin: 0;
17
- }
18
-
19
- ol, ul, menu {
20
- list-style: none;
21
- margin: 0;
22
- padding: 0;
23
- }
24
-
25
- button, input:where([type=button]), input:where([type=reset]), input:where([type=submit]) {
26
- -webkit-appearance: button;
27
- background-color: transparent;
28
- background-image: none;
29
- }
30
-
31
- button, [role=button] {
32
- cursor: pointer;
33
- }
34
-
35
- button, select {
36
- text-transform: none;
37
- }
38
-
39
- button, input, optgroup, select, textarea {
40
- font-family: inherit;
41
- font-feature-settings: inherit;
42
- font-variation-settings: inherit;
43
- font-size: 100%;
44
- font-weight: inherit;
45
- line-height: inherit;
46
- letter-spacing: inherit;
47
- color: inherit;
48
- margin: 0;
49
- padding: 0;
50
- }
51
-
52
- a {
53
- color: inherit;
54
- text-decoration: inherit;
55
- }
56
-
57
- *, :before, :after {
58
- box-sizing: border-box;
59
- border-width: 0;
60
- border-style: solid;
61
- }
62
-
63
- p {
64
- padding: 0;
65
- margin: 0;
66
- }
67
-
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export {default} from "./theme"
package/src/override.css DELETED
@@ -1,7 +0,0 @@
1
- .xyd_ui-comp-sidebar, .xyd_ui-comp-nav-logo {
2
- padding-left: 200px;
3
- }
4
-
5
- .xyd_comp-comp-heading {
6
- font-weight: 400;
7
- }
package/src/theme.tsx DELETED
@@ -1,78 +0,0 @@
1
- import React from "react"
2
-
3
- import {helperContent} from "@xyd-js/components/content"
4
- import type {
5
- ITheme
6
- } from "@xyd-js/framework"
7
- import {
8
- FwNav,
9
- FwToc,
10
- FwNavLinks,
11
-
12
- FwSidebarGroups,
13
- } from "@xyd-js/framework/react"
14
-
15
- import {Layout} from "./components/Layouts";
16
-
17
- import "@xyd-js/ui/index.css";
18
- import "@xyd-js/components/index.css";
19
- // TODO: what about atlas? it's loaded by plugin - probably we need better mechanism for loading css
20
- // import '@xyd-js/atlas/index.css'; TODO: FINISH !!!
21
-
22
- import './index.css';
23
- import './override.css';
24
-
25
- const {Content} = helperContent()
26
-
27
- export interface ThemeSettings {
28
- hideToc?: boolean // TODO: better prop name?
29
- sidebar?: {
30
- onePathBehaviour?: boolean
31
- clientSideRouting?: boolean
32
- }
33
- contentNav?: React.ReactNode
34
- layout?: {
35
- kind?: "fullwidth" | "equal"
36
- }
37
- }
38
-
39
- export interface ThemeProps extends ITheme<ThemeSettings> {
40
- }
41
-
42
- export default function ThemePoetry(props: ThemeProps) {
43
- return <Layout
44
- header={<Navbar/>}
45
- aside={<Sidebar themeSettings={props.themeSettings}/>}
46
- content={<>
47
- {/*TODO: optional breadcrumbs*/}
48
- {/*{props.breadcrumbs ? <FwBreadcrumbs/> : undefined}*/}
49
- <Content>
50
- {props.children}
51
- </Content>
52
-
53
- <FwNavLinks/>
54
- </>
55
- }
56
- contentNav={
57
- props.themeSettings?.hideToc
58
- ? null
59
- : props.themeSettings?.contentNav ? props.themeSettings.contentNav : <FwToc/>
60
- }
61
- kind={props.themeSettings?.layout?.kind || undefined}
62
- />
63
- }
64
-
65
- // TODO: finish search
66
- function Navbar() {
67
- return <>
68
- <FwNav kind="middle"/>
69
- </>
70
- }
71
-
72
- // TODO: onePathBehaviour does not work - fix that
73
- function Sidebar({themeSettings}: { themeSettings?: ThemeSettings }) {
74
- return <FwSidebarGroups
75
- onePathBehaviour={themeSettings?.sidebar?.onePathBehaviour}
76
- clientSideRouting={themeSettings?.sidebar?.clientSideRouting}
77
- />
78
- }
package/src/vars.css DELETED
@@ -1,5 +0,0 @@
1
- :root {
2
- --headingEffect-color-tertiary: rgba(23, 119, 184, 0.5);
3
- --headingEffect-color-secondary: rgb(121, 85, 241);
4
- --headingEffect-color-primary: rgb(255, 105, 180);
5
- }
package/tsconfig.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "module": "esnext",
5
- "moduleResolution": "bundler",
6
- "target": "ES6",
7
- "lib": [
8
- "dom",
9
- "dom.iterable",
10
- "esnext"
11
- ],
12
- "allowJs": true,
13
- "skipLibCheck": true,
14
- "strict": false,
15
- "noEmit": true,
16
- "incremental": false,
17
- "resolveJsonModule": true,
18
- "isolatedModules": true,
19
- "jsx": "react",
20
- "plugins": [
21
- {
22
- "name": "next"
23
- }
24
- ],
25
- "strictNullChecks": true
26
- },
27
- "include": [
28
- "packages/css/src",
29
- "next-env.d.ts",
30
- "**/*.ts",
31
- "**/*.tsx",
32
- ".next/types/**/*.ts"
33
- ],
34
- "exclude": [
35
- "node_modules"
36
- ]
37
- }