lupine.web 1.0.16 → 1.0.17

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 (70) hide show
  1. package/package.json +1 -5
  2. package/src/core/bind-lang.ts +6 -5
  3. package/src/core/bind-links.ts +2 -2
  4. package/src/core/bind-theme.ts +6 -5
  5. package/src/core/export-lupine.ts +64 -0
  6. package/src/core/index.ts +2 -1
  7. package/src/core/{core.ts → initialize.ts} +9 -67
  8. package/src/core/page-router.ts +3 -2
  9. package/src/core/server-cookie.ts +5 -3
  10. package/src/index.ts +0 -1
  11. package/src/lib/index.ts +2 -13
  12. package/src/lib/is-frontend.ts +3 -0
  13. package/src/styles/index.ts +0 -5
  14. package/src/components/button-push-animation.tsx +0 -138
  15. package/src/components/button.tsx +0 -55
  16. package/src/components/drag-refresh.tsx +0 -110
  17. package/src/components/editable-label.tsx +0 -83
  18. package/src/components/float-window.tsx +0 -226
  19. package/src/components/grid.tsx +0 -18
  20. package/src/components/html-var.tsx +0 -41
  21. package/src/components/index.ts +0 -36
  22. package/src/components/input-with-title.tsx +0 -24
  23. package/src/components/link-item.tsx +0 -13
  24. package/src/components/link-list.tsx +0 -62
  25. package/src/components/menu-bar.tsx +0 -220
  26. package/src/components/menu-item-props.tsx +0 -10
  27. package/src/components/menu-sidebar.tsx +0 -289
  28. package/src/components/message-box.tsx +0 -44
  29. package/src/components/meta-data.tsx +0 -36
  30. package/src/components/meta-description.tsx +0 -12
  31. package/src/components/modal.tsx +0 -29
  32. package/src/components/notice-message.tsx +0 -119
  33. package/src/components/page-title.tsx +0 -6
  34. package/src/components/paging-link.tsx +0 -100
  35. package/src/components/panel.tsx +0 -21
  36. package/src/components/popup-menu.tsx +0 -218
  37. package/src/components/progress.tsx +0 -91
  38. package/src/components/redirect.tsx +0 -19
  39. package/src/components/resizable-splitter.tsx +0 -129
  40. package/src/components/select-with-title.tsx +0 -37
  41. package/src/components/spinner.tsx +0 -100
  42. package/src/components/svg.tsx +0 -24
  43. package/src/components/tabs.tsx +0 -252
  44. package/src/components/text-glow.tsx +0 -36
  45. package/src/components/text-wave.tsx +0 -54
  46. package/src/components/theme-selector.tsx +0 -32
  47. package/src/components/toggle-base.tsx +0 -260
  48. package/src/components/toggle-switch.tsx +0 -156
  49. package/src/lib/date-utils.ts +0 -317
  50. package/src/lib/deep-merge.ts +0 -37
  51. package/src/lib/document-ready.ts +0 -36
  52. package/src/lib/dom/calculate-text-width.ts +0 -13
  53. package/src/lib/dom/download-stream.ts +0 -17
  54. package/src/lib/dom/download.ts +0 -12
  55. package/src/lib/dom/index.ts +0 -71
  56. package/src/lib/dynamical-load.ts +0 -138
  57. package/src/lib/format-bytes.ts +0 -11
  58. package/src/lib/lite-dom.ts +0 -227
  59. package/src/lib/message-hub.ts +0 -105
  60. package/src/lib/observable.ts +0 -188
  61. package/src/lib/promise-timeout.ts +0 -1
  62. package/src/lib/simple-storage.ts +0 -40
  63. package/src/lib/stop-propagation.ts +0 -7
  64. package/src/lib/upload-file.ts +0 -68
  65. package/src/styles/base-themes.ts +0 -17
  66. package/src/styles/dark-themes.ts +0 -86
  67. package/src/styles/light-themes.ts +0 -93
  68. package/src/styles/media-query.ts +0 -93
  69. package/src/styles/shared-themes.ts +0 -52
  70. /package/src/lib/{dom/cookie.ts → cookie.ts} +0 -0
@@ -1,129 +0,0 @@
1
- import { bindGlobalStyles } from '../core';
2
- import { CssProps } from '../jsx';
3
- import { stopPropagation } from '../lib';
4
- /**
5
- How to use:
6
- // getSplitter's first parameter is the container's selector where the Splitter will be in.
7
- // the second parameter is whether it's Vertical
8
- // then the third parameter is it's RightOrTop or not
9
- const locationLeft = false;
10
- const splitter = ResizableSplitter.getSplitter('.body .side', true, locationLeft);
11
- const container = (
12
- <div class='body'>
13
- <div class='side'>
14
- {splitter}
15
- {designPanel}
16
- </div>
17
- ...
18
-
19
- */
20
- export class ResizableSplitter {
21
- static hostNode: HTMLElement;
22
- static isVertical = true;
23
- static isRightOrTop = true;
24
-
25
- private static initialized = false;
26
- private static startXorY = 0;
27
- private static startWidthOrHeight = 0;
28
- private static pressed = false;
29
-
30
- static init() {
31
- /* styles for resizable splitter */
32
- const css: CssProps = {
33
- '.resizable-splitter-v-left, .resizable-splitter-v-right': {
34
- position: 'absolute',
35
- top: 0,
36
- bottom: 0,
37
- left: 0,
38
- width: '2px',
39
- cursor: 'col-resize',
40
- },
41
- '.resizable-splitter-v-right': {
42
- left: 'unset',
43
- right: 0,
44
- },
45
- '.resizable-splitter-v-left:hover, .resizable-splitter-v-right:hover': {
46
- width: '4px',
47
- backgroundColor: '#ccc',
48
- },
49
-
50
- '.resizable-splitter-h-top, .resizable-splitter-h-bottom': {
51
- position: 'absolute',
52
- top: 0,
53
- left: 0,
54
- right: 0,
55
- height: '2px',
56
- cursor: 'row-resize',
57
- },
58
- '.resizable-splitter-h-bottom': {
59
- top: 'unset',
60
- bottom: 0,
61
- },
62
- '.resizable-splitter-h-top:hover, .resizable-splitter-h-bottom:hover': {
63
- height: '4px',
64
- backgroundColor: '#ccc',
65
- },
66
- };
67
- bindGlobalStyles('resizable-splitter', 'html', css);
68
-
69
- window.addEventListener('mousemove', ResizableSplitter.onMousemove.bind(ResizableSplitter), false);
70
- document.documentElement.addEventListener('mouseup', ResizableSplitter.onMouseup.bind(ResizableSplitter), false);
71
- }
72
-
73
- static getSplitterClassName(isVertical: boolean, isRightOrTop: boolean): string {
74
- const className =
75
- 'resizable-splitter-' +
76
- (isVertical ? (isRightOrTop ? 'v-right' : 'v-left') : isRightOrTop ? 'h-top' : 'h-bottom');
77
- return className;
78
- }
79
-
80
- static onMousedown(event: any) {
81
- if (event.buttons !== 1 || event.button !== 0) return;
82
- this.pressed = true;
83
- this.startXorY = this.isVertical ? event.clientX : event.clientY;
84
- const startPosition = document.defaultView!.getComputedStyle(this.hostNode)[this.isVertical ? 'width' : 'height'];
85
- this.startWidthOrHeight = parseInt(startPosition, 10);
86
- }
87
-
88
- static onMousemove(event: any) {
89
- if (!this.pressed || event.buttons !== 1 || event.button !== 0) {
90
- return;
91
- }
92
-
93
- // prevent text/element selection when drag
94
- stopPropagation(event);
95
- if (this.isVertical) {
96
- const movedXorY = this.startWidthOrHeight + (event.clientX - this.startXorY) * (this.isRightOrTop ? 1 : -1);
97
- this.hostNode.style.width = movedXorY + 'px';
98
- } else {
99
- const movedXorY = this.startWidthOrHeight + (event.clientY - this.startXorY) * (this.isRightOrTop ? -1 : 1);
100
- this.hostNode.style.height = movedXorY + 'px';
101
- }
102
- }
103
-
104
- static onMouseup() {
105
- if (this.pressed) this.pressed = false;
106
- }
107
-
108
- static getSplitter(selector: string, isVertical: boolean, isRightOrTop: boolean) {
109
- const className = this.getSplitterClassName(isVertical, isRightOrTop);
110
-
111
- const onMousedown = (event: any) => {
112
- if (!this.initialized) {
113
- this.initialized = true;
114
- this.init();
115
- }
116
-
117
- ResizableSplitter.hostNode = document.querySelector(selector)!;
118
- if (!ResizableSplitter.hostNode) {
119
- console.error(`Can't find element: ${selector}`);
120
- return;
121
- }
122
- ResizableSplitter.isVertical = isVertical;
123
- ResizableSplitter.isRightOrTop = isRightOrTop;
124
- ResizableSplitter.onMousedown.bind(ResizableSplitter)(event);
125
- };
126
-
127
- return <div onMouseDown={onMousedown} class={className}></div>;
128
- }
129
- }
@@ -1,37 +0,0 @@
1
- import { CssProps } from '../jsx';
2
-
3
- export type SelectOptionProps = {
4
- option: string;
5
- value: string;
6
- selected?: boolean;
7
- };
8
- export const SelectWithTitle = (
9
- title: string,
10
- options: SelectOptionProps[],
11
- onOptionChanged: (option: string) => void,
12
- size?: number,
13
- className = 'input-base',
14
- width = '100%',
15
- ) => {
16
- const css: CssProps = {
17
- select: {
18
- height: 'auto',
19
- overflowY: 'auto',
20
- width,
21
- },
22
- };
23
- return (
24
- <div css={css}>
25
- <div>{title}</div>
26
- <div>
27
- <select class={className} onChange={(e: any) => onOptionChanged(e?.target?.value)} size={size}>
28
- {options.map((option) => (
29
- <option value={option.value} selected={option.selected}>
30
- {option.option}
31
- </option>
32
- ))}
33
- </select>
34
- </div>
35
- </div>
36
- );
37
- };
@@ -1,100 +0,0 @@
1
- export enum SpinnerSize {
2
- Small = '22px',
3
- Medium = '30px',
4
- Large = '40px',
5
- LargeLarge = '60px',
6
- }
7
- export const Spinner01 = ({
8
- size = SpinnerSize.Medium,
9
- color = 'var(--primary-color)',
10
- }: {
11
- size?: SpinnerSize;
12
- color?: string;
13
- }) => {
14
- const borderWidth =
15
- size === SpinnerSize.Small || size === SpinnerSize.Medium ? '4px' : size === SpinnerSize.Large ? '6px' : '9px';
16
- const css: any = {
17
- width: size,
18
- aspectRatio: 1,
19
- borderRadius: '50%',
20
- background: `radial-gradient(farthest-side,${color} 94%,#0000) top/8px 8px no-repeat, conic-gradient(#0000 30%,${color})`,
21
- '-webkit-mask': `radial-gradient(farthest-side,#0000 calc(100% - ${borderWidth}),#000 0)`,
22
- animation: 'spinner01 1s infinite linear',
23
- '@keyframes spinner01': {
24
- '100%': { transform: 'rotate(1turn)' },
25
- },
26
- };
27
- return <div css={css}></div>;
28
- };
29
-
30
- export const Spinner02 = ({
31
- size = SpinnerSize.Medium,
32
- color = 'var(--primary-color)',
33
- }: {
34
- size?: SpinnerSize;
35
- color?: string;
36
- }) => {
37
- const base = parseInt(size.replace('px', ''));
38
- const ballSize = Array.from({ length: 7 }, (_, i) => `${i * base / 15 / 7}px`);
39
- const css: any = {
40
- width: size,
41
- height: size,
42
- display: 'flex',
43
- placeItems: 'center',
44
- justifyContent: 'center',
45
- '.spinner02-box': {
46
- '--spin02-w': `${base / 2 - 3}px`,
47
- width: '4px',
48
- height: '4px',
49
- borderRadius: '50%',
50
- color,
51
- boxShadow: `
52
- calc(1*var(--spin02-w)) calc(0*var(--spin02-w)) 0 0,
53
- calc(0.707*var(--spin02-w)) calc(0.707*var(--spin02-w)) 0 ${ballSize[1]},
54
- calc(0*var(--spin02-w)) calc(1*var(--spin02-w)) 0 ${ballSize[2]},
55
- calc(-0.707*var(--spin02-w)) calc(0.707*var(--spin02-w)) 0 ${ballSize[3]},
56
- calc(-1*var(--spin02-w)) calc(0*var(--spin02-w)) 0 ${ballSize[4]},
57
- calc(-0.707*var(--spin02-w)) calc(-0.707*var(--spin02-w)) 0 ${ballSize[5]},
58
- calc(0*var(--spin02-w)) calc(-1*var(--spin02-w)) 0 ${ballSize[6]}`,
59
- animation: 'spinner02 1s infinite steps(8)',
60
- },
61
- '@keyframes spinner02': {
62
- '100%': { transform: 'rotate(1turn)' },
63
- },
64
- };
65
- return (
66
- <div css={css}>
67
- <div class='spinner02-box'></div>
68
- </div>
69
- );
70
- };
71
-
72
- // color should be space splited RGB colors
73
- export const Spinner03 = ({ size = SpinnerSize.Medium, colorRGB = '55 55 55' }: { size?: SpinnerSize; colorRGB?: string }) => {
74
- const css: any = {
75
- width: size,
76
- height: size,
77
- aspectRatio: 1,
78
- display: 'grid',
79
- borderRadius: '50%',
80
- background: `linear-gradient(0deg, rgb(${colorRGB} / 50%) 30%, #0000 0 70%, rgb(${colorRGB} / 100%) 0) 50% / 8% 100%, linear-gradient(90deg, rgb(${colorRGB} / 25%) 30%, #0000 0 70%, rgb(${colorRGB} / 75%) 0) 50% / 100% 8%`,
81
- backgroundRepeat: 'no-repeat',
82
- animation: 'spinner03 1s infinite steps(12)',
83
- '&::before, &::after': {
84
- content: '""',
85
- gridArea: '1/1',
86
- borderRadius: '50%',
87
- background: 'inherit',
88
- opacity: 0.915,
89
- transform: 'rotate(30deg)',
90
- },
91
- '&::after': {
92
- opacity: 0.83,
93
- transform: 'rotate(60deg)',
94
- },
95
- '@keyframes spinner03': {
96
- '100%': { transform: 'rotate(1turn)' },
97
- },
98
- };
99
- return <div css={css}></div>;
100
- };
@@ -1,24 +0,0 @@
1
- // this is not a good approach because if one svg file is used in multiple places
2
- // then the svg string will be rendered multiple times.
3
- export const Svg = ({
4
- children,
5
- width,
6
- height,
7
- color,
8
- }: {
9
- children: string;
10
- width?: string;
11
- height?: string;
12
- color?: string;
13
- }) => {
14
- const css: any = {
15
- svg: {
16
- maxWidth: '100%',
17
- maxHeight: '100%',
18
- width,
19
- height,
20
- fill: color,
21
- },
22
- };
23
- return <div css={css}>{children}</div>;
24
- };
@@ -1,252 +0,0 @@
1
- import { mountComponents } from '../core';
2
- import { RefProps, VNode } from '../jsx';
3
- import { stopPropagation } from '../lib';
4
-
5
- export type TabsUpdateProps = {
6
- updateTitle?: (index: number, title: string) => void;
7
- updateIndex?: (index: number) => void;
8
- newPage?: (title: string, page: VNode<any>, index?: number) => Promise<void>;
9
- removePage?: (index: number) => void;
10
- indexChanged?: (index: number) => void;
11
- getIndex?: () => number;
12
- getCount?: () => number;
13
- findAndActivate?: (title: string) => boolean;
14
- };
15
-
16
- export type TabsPageProps = { title: string; page: VNode<any> };
17
-
18
- export type TabsProps = {
19
- pages: TabsPageProps[];
20
- defaultIndex?: number;
21
- topClassName?: string;
22
- pagePadding?: string;
23
- refUpdate?: TabsUpdateProps;
24
- };
25
- // For CSS or query selectors, please pay attention to that Tabs can be nested
26
- export const Tabs = ({ pages, defaultIndex, topClassName, pagePadding, refUpdate }: TabsProps) => {
27
- const ref: RefProps = {};
28
- let newIndex = typeof defaultIndex === 'number' ? defaultIndex : 0;
29
- const clearIndex = () => {
30
- const header = ref.$(`.tabs[data-refid=${ref.id}] > div > .tab.active`);
31
- header && header.classList.remove('active');
32
- const page = ref.$(`.pages[data-refid=${ref.id}] > .page.active`);
33
- page && page.classList.remove('active');
34
- };
35
- const updateIndex = (index: number) => {
36
- clearIndex();
37
- const doms = ref.$all(`.tabs[data-refid=${ref.id}] > div > .tab`);
38
- if (index >= 0 && index < doms.length) {
39
- doms[index].classList.add('active');
40
- const pages = ref.$all(`.pages[data-refid=${ref.id}] > .page`);
41
- pages[index].classList.add('active');
42
- refUpdate?.indexChanged && refUpdate?.indexChanged(index);
43
- }
44
- };
45
- const removePage = (index: number) => {
46
- const doms = ref.$all(`.tabs[data-refid=${ref.id}] > div > .tab`);
47
- if (index >= 0 && index < doms.length) {
48
- const newIndex = index === doms.length - 1 ? index - 1 : index;
49
- const isAct = doms[index].classList.contains('active');
50
- doms[index].parentNode.remove();
51
- const pages = ref.$all(`.pages[data-refid=${ref.id}] > .page`);
52
- pages[index].remove();
53
-
54
- if (isAct) {
55
- updateIndex(newIndex);
56
- }
57
- }
58
- };
59
- const removePageFromX = (event: any) => {
60
- stopPropagation(event);
61
-
62
- const tab = event.target.parentNode;
63
- const index = Array.prototype.indexOf.call(tab.parentNode.parentNode.children, tab.parentNode);
64
- removePage(index);
65
- };
66
-
67
- const newPage = async (title: string, page: VNode<any>, index?: number) => {
68
- const allTabs = ref.$all(`.tabs[data-refid=${ref.id}] > div > .tab`);
69
- let newPageIndex = allTabs.length;
70
- if (typeof index === 'number' && index >= 0 && index < allTabs.length) {
71
- newPageIndex = index;
72
- }
73
-
74
- clearIndex();
75
- const newTab2 = createTabHeader(title, ' active');
76
- const newTab = document.createElement('div');
77
-
78
- const newPage = document.createElement('div');
79
- newPage.className = 'page';
80
- if (newPageIndex === allTabs.length) {
81
- ref.$(`.tabs[data-refid=${ref.id}]`).appendChild(newTab);
82
- ref.$(`.pages[data-refid=${ref.id}]`).appendChild(newPage);
83
- } else {
84
- ref.$(`.tabs[data-refid=${ref.id}]`).insertBefore(newTab, allTabs[newPageIndex]);
85
- const pages = ref.$all(`.pages[data-refid=${ref.id}] > .page`);
86
- ref.$(`.pages[data-refid=${ref.id}]`).insertBefore(newPage, pages[newPageIndex]);
87
- }
88
-
89
- await mountComponents(newTab, newTab2);
90
- await mountComponents(newPage, page);
91
- updateIndex(newPageIndex);
92
- };
93
- const createTabHeader = (title: string, className: string) => {
94
- return (
95
- <div onClick={onTabClick} class={'tab' + className}>
96
- {title}
97
- <span class='modal-close' onClick={removePageFromX}>
98
- ×
99
- </span>
100
- </div>
101
- );
102
- };
103
- const onTabClick = (event: any) => {
104
- stopPropagation(event);
105
-
106
- const tab = event.target;
107
- const index = Array.prototype.indexOf.call(tab.parentNode.parentNode.children, tab.parentNode);
108
- updateIndex(index);
109
- };
110
- const flashTitle = (index: number) => {
111
- const doms = ref.$all(`.tabs[data-refid=${ref.id}] > div > .tab`);
112
- if (index >= 0 && index < doms.length) {
113
- doms[index].classList.add('flash');
114
- setTimeout(() => {
115
- doms[index].classList.remove('flash');
116
- }, 1000);
117
- }
118
- };
119
- if (refUpdate) {
120
- refUpdate.updateTitle = (index: number, title: string) => {
121
- const doms = ref.$all(`.tabs[data-refid=${ref.id}] > div > .tab`);
122
- if (index >= 0 && index < doms.length) {
123
- doms[index].innerHTML = title;
124
- }
125
- };
126
- refUpdate.updateIndex = updateIndex;
127
- refUpdate.removePage = removePage;
128
- refUpdate.newPage = newPage;
129
- refUpdate.getIndex = () => {
130
- const header = ref.$(`.tabs[data-refid=${ref.id}] > div > .tab.active`);
131
- return header ? Array.prototype.indexOf.call(header.parentNode.parentNode.children, header.parentNode) : -1;
132
- };
133
- refUpdate.getCount = () => {
134
- const doms = ref.$all(`.tabs[data-refid=${ref.id}] > div > .tab`);
135
- return doms.length;
136
- };
137
- refUpdate.findAndActivate = (title: string) => {
138
- const doms = ref.$all(`.tabs[data-refid=${ref.id}] > div > .tab`);
139
- for (let i = 0; i < doms.length; i++) {
140
- if (doms[i].innerText === title) {
141
- updateIndex(i);
142
- flashTitle(i);
143
- return true;
144
- }
145
- }
146
- return false;
147
- };
148
- }
149
-
150
- // pay attention to nest tabs
151
- const newCss: any = {
152
- display: 'flex',
153
- 'flex-direction': 'column',
154
- width: '100%',
155
- height: '100%',
156
- // border: 'solid 1px grey',
157
- '&:not(:has(.pages .page))': {
158
- // hide tabs when there is no tabs (not need to show borders)
159
- display: 'none',
160
- },
161
- '> .tabs': {
162
- display: 'flex',
163
- height: 'auto',
164
- 'border-bottom': '1px solid grey',
165
- '> div > .tab': {
166
- padding: '2px 3px',
167
- width: 'auto',
168
- 'font-size': 'smaller',
169
- 'text-overflow': 'ellipsis',
170
- overflow: 'hidden',
171
- 'white-space': 'nowrap',
172
- margin: '1px 1px 0 1px',
173
- cursor: 'pointer',
174
- position: 'relative',
175
- // transition: 'all 1s',
176
- 'border-top-right-radius': '4px',
177
- 'border-top-left-radius': '4px',
178
- 'border-top': 'solid 1px var(--primary-border-color)',
179
- 'border-left': 'solid 1px var(--primary-border-color)',
180
- 'border-right': 'solid 1px var(--primary-border-color)',
181
- // 'border-bottom': '2px solid transparent',
182
- color: 'var(--activatable-color-normal)',
183
- backgroundColor: 'var(--activatable-bg-color-normal)',
184
- },
185
- '> div > .tab:hover': {
186
- padding: '3px 3px 1px 3px',
187
- // color: 'var(--activatable-color-hover)',
188
- // backgroundColor: 'var(--activatable-bg-color-hover)',
189
- },
190
- '> div > .tab.flash': {
191
- backgroundColor: 'red',
192
- },
193
- '> div > .active': {
194
- // 'border-bottom': '2px solid red',
195
- color: 'var(--activatable-color-selected)',
196
- backgroundColor: 'var(--activatable-bg-color-selected)',
197
- marginBottom: '-1px',
198
- borderBottom: '1px solid #FFFFFF00',
199
- },
200
- '> div > .tab > .modal-close': {
201
- display: 'none',
202
- float: 'right',
203
- fontSize: '12px',
204
- fontWeight: 'bold',
205
- cursor: 'pointer',
206
- position: 'absolute',
207
- top: '-4px',
208
- right: '1px',
209
- },
210
- '> div > .tab:hover > .modal-close': {
211
- display: 'inline-block',
212
- color: '#ff0000',
213
- },
214
- },
215
- '> .pages': {
216
- display: 'flex',
217
- flex: '1',
218
- position: 'relative',
219
- '> .page': {
220
- display: 'none',
221
- position: 'absolute',
222
- padding: pagePadding || '0px',
223
- overflow: 'auto',
224
- width: '100%',
225
- maxWidth: '100%',
226
- height: '100%',
227
- overflowX: 'auto',
228
- overflowY: 'auto',
229
- },
230
- '> .active': {
231
- display: 'inline-block',
232
- },
233
- },
234
- };
235
-
236
- return (
237
- <div ref={ref} css={newCss} class={'tabs-box' + (topClassName ? ' ' + topClassName : '')}>
238
- <div class='tabs' data-refid={ref}>
239
- {pages.map((i, index) => {
240
- const className = index === newIndex ? ' active' : '';
241
- return <div>{createTabHeader(i.title, className)}</div>;
242
- })}
243
- </div>
244
- <div class='pages' data-refid={ref}>
245
- {pages.map((i, index) => {
246
- const className = index === newIndex ? ' active' : '';
247
- return <div class={'page' + className}>{i.page}</div>;
248
- })}
249
- </div>
250
- </div>
251
- );
252
- };
@@ -1,36 +0,0 @@
1
- import { CssProps } from '../jsx';
2
-
3
- export type TextGlowProps = {
4
- text: string;
5
- color?: string;
6
- padding?: string;
7
- fontSize?: string;
8
- fontWeight?: string;
9
- };
10
- export const TextGlow = (props: TextGlowProps) => {
11
- const css: CssProps = {
12
- width: `100%`,
13
- height: `100%`,
14
- textAlign: 'center',
15
- color: props.color || '#22b8ff',
16
- padding: props.padding || '10px',
17
- fontSize: props.fontSize || '30px',
18
- fontWeight: props.fontWeight || '500',
19
- '.text-glow': {
20
- animation: 'text-glow-a 1.5s infinite alternate',
21
- },
22
- '@keyframes text-glow-a': {
23
- '0%': {
24
- textShadow: '0 0 5px #ff005e, 0 0 10px #ff005e, 0 0 20px #ff005e, 0 0 40px #ff005e, 0 0 80px #ff005e',
25
- },
26
- '100%': {
27
- textShadow: '0 0 10px #00d4ff, 0 0 20px #00d4ff, 0 0 40px #00d4ff, 0 0 80px #00d4ff, 0 0 160px #00d4ff',
28
- },
29
- },
30
- };
31
- return (
32
- <div css={css} class='text-glow-top'>
33
- <div class='text-glow'>{props.text}</div>
34
- </div>
35
- );
36
- };
@@ -1,54 +0,0 @@
1
- import { CssProps } from "../jsx";
2
-
3
- export type TextLoadingProps = {
4
- text: string;
5
- color?: string;
6
- padding?: string;
7
- fontSize?: string;
8
- fontWeight?: string;
9
- };
10
- export const TextWave = (props: TextLoadingProps) => {
11
- const cssMap: CssProps = {};
12
- props.text.split('').forEach((char, index) => {
13
- cssMap[`.span${index}`] = { animationDelay: `${index * 0.1}s` };
14
- });
15
- const css: CssProps = {
16
- width: `100%`,
17
- height: `100%`,
18
- textAlign: 'center',
19
- color: props.color || '#22b8ff',
20
- padding: props.padding || '10px',
21
- fontSize: props.fontSize || '20px',
22
- fontWeight: props.fontWeight,
23
- textShadow: '1px -1px #ffffff, -2px 2px #999, -6px 7px 3px #131f5be6',
24
- '.text-loading.wave-animetion span': {
25
- display: 'inline-block',
26
- padding: '0 4px',
27
- animation: 'wave-text 1s ease-in-out infinite',
28
- },
29
- '.text-loading.wave-animetion': {
30
- marginTop: '0.6em',
31
- ...cssMap,
32
- },
33
- '@keyframes wave-text': {
34
- '0%': {
35
- transform: 'translateY(0em)',
36
- },
37
- '60%': {
38
- transform: 'translateY(-0.6em)',
39
- },
40
- '100%': {
41
- transform: 'translateY(0em)',
42
- },
43
- },
44
- };
45
- return (
46
- <div css={css} class='text-loading-top'>
47
- <div class='text-loading wave-animetion'>
48
- {props.text.split('').map((char, index) => (
49
- <span class={`span${index}`}>{char}</span>
50
- ))}
51
- </div>
52
- </div>
53
- );
54
- };
@@ -1,32 +0,0 @@
1
- import { bindGlobalStyles, getCurrentTheme, updateTheme } from '../core';
2
- import { CssProps } from '../jsx';
3
- import { PopupMenu } from './popup-menu';
4
-
5
- export type ThemeSelectorProps = {
6
- className?: string;
7
- css?: CssProps;
8
- };
9
-
10
- export const ThemeSelector = ({ className, css }: ThemeSelectorProps) => {
11
- const newCss: CssProps = {
12
- display: 'flex',
13
- flexDirection: 'column',
14
- alignSelf: 'end',
15
- ...css,
16
- };
17
-
18
- bindGlobalStyles('theme-switch', '.theme-switch', newCss);
19
- const handleSelected = (themeName: string) => {
20
- updateTheme(themeName);
21
- };
22
- const currentTheme = getCurrentTheme();
23
- const list = [];
24
- for (let themeName in currentTheme.themes) {
25
- list.push(themeName);
26
- }
27
- return (
28
- <div css={newCss} class={['theme-switch', className].join(' ')} title='Select theme'>
29
- <PopupMenu list={list} defaultValue={currentTheme.themeName} handleSelected={handleSelected}></PopupMenu>
30
- </div>
31
- );
32
- };