lupine.components 1.1.21 → 1.1.22
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 +1 -1
- package/src/components/action-sheet-demo.tsx +87 -0
- package/src/components/button-demo.tsx +24 -0
- package/src/components/button-push-animation-demo.tsx +24 -0
- package/src/components/button-push-animation.tsx +8 -4
- package/src/components/editable-label-demo.tsx +25 -0
- package/src/components/input-with-title-demo.tsx +31 -0
- package/src/components/message-box-demo.tsx +80 -0
- package/src/components/modal-demo.tsx +44 -0
- package/src/components/notice-message-demo.tsx +52 -0
- package/src/components/popup-menu-demo.tsx +49 -0
- package/src/components/popup-menu.tsx +1 -1
- package/src/components/progress-demo.tsx +51 -0
- package/src/components/progress.tsx +3 -3
- package/src/components/radio-label-demo.tsx +27 -0
- package/src/components/redirect-demo.tsx +28 -0
- package/src/components/resizable-splitter-demo.tsx +68 -0
- package/src/components/resizable-splitter.tsx +6 -6
- package/src/components/select-angle-demo.tsx +24 -0
- package/src/components/select-with-title-demo.tsx +36 -0
- package/src/components/spinner-demo.tsx +41 -0
- package/src/components/stars-component-demo.tsx +26 -0
- package/src/components/stars-component.tsx +11 -3
- package/src/components/switch-option-demo.tsx +26 -0
- package/src/components/tabs-demo.tsx +30 -0
- package/src/components/text-glow-demo.tsx +36 -0
- package/src/components/text-scale-demo.tsx +30 -0
- package/src/components/text-wave-demo.tsx +36 -0
- package/src/components/toggle-button-demo.tsx +32 -0
- package/src/components/toggle-play-button-demo.tsx +44 -0
- package/src/components/toggle-switch-demo.tsx +33 -0
- package/src/demo/demo-about.tsx +12 -0
- package/src/demo/demo-container.tsx +57 -0
- package/src/demo/demo-css.tsx +3 -0
- package/src/demo/demo-frame-helper.tsx +395 -0
- package/src/demo/demo-frame.tsx +139 -0
- package/src/demo/demo-index.tsx +14 -0
- package/src/demo/demo-page.tsx +138 -0
- package/src/demo/demo-registry.ts +54 -0
- package/src/demo/demo-render-page.tsx +54 -0
- package/src/demo/demo-types.ts +21 -0
- package/src/html-editor/buttons_morden.gif +0 -0
- package/src/html-editor/h-editor.ts +817 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DemoStory } from './demo-types';
|
|
2
|
+
import { buttonDemo } from '../components/button-demo';
|
|
3
|
+
import { buttonPushAnimationDemo } from '../components/button-push-animation-demo';
|
|
4
|
+
import { toggleSwitchDemo } from '../components/toggle-switch-demo';
|
|
5
|
+
import { spinnerDemo } from '../components/spinner-demo';
|
|
6
|
+
import { starsDemo } from '../components/stars-component-demo';
|
|
7
|
+
import { editableLabelDemo } from '../components/editable-label-demo';
|
|
8
|
+
import { progressDemo } from '../components/progress-demo';
|
|
9
|
+
import { radioLabelDemo } from '../components/radio-label-demo';
|
|
10
|
+
import { selectAngleDemo } from '../components/select-angle-demo';
|
|
11
|
+
import { switchOptionDemo } from '../components/switch-option-demo';
|
|
12
|
+
import { actionSheetDemo } from '../components/action-sheet-demo';
|
|
13
|
+
import { selectWithTitleDemo } from '../components/select-with-title-demo';
|
|
14
|
+
import { inputWithTitleDemo } from '../components/input-with-title-demo';
|
|
15
|
+
import { tabsDemo } from '../components/tabs-demo';
|
|
16
|
+
import { modalDemo } from '../components/modal-demo';
|
|
17
|
+
import { popupMenuDemo } from '../components/popup-menu-demo';
|
|
18
|
+
import { noticeMessageDemo } from '../components/notice-message-demo';
|
|
19
|
+
import { resizableSplitterDemo } from '../components/resizable-splitter-demo';
|
|
20
|
+
import { redirectDemo } from '../components/redirect-demo';
|
|
21
|
+
import { textWaveDemo } from '../components/text-wave-demo';
|
|
22
|
+
import { textScaleDemo } from '../components/text-scale-demo';
|
|
23
|
+
import { textGlowDemo } from '../components/text-glow-demo';
|
|
24
|
+
import { togglePlayButtonDemo } from '../components/toggle-play-button-demo';
|
|
25
|
+
import { toggleButtonDemo } from '../components/toggle-button-demo';
|
|
26
|
+
import { messageBoxDemo } from '../components/message-box-demo';
|
|
27
|
+
|
|
28
|
+
export const demoRegistry: Record<string, DemoStory<any>> = {
|
|
29
|
+
[buttonDemo.id]: buttonDemo,
|
|
30
|
+
[buttonPushAnimationDemo.id]: buttonPushAnimationDemo,
|
|
31
|
+
[toggleSwitchDemo.id]: toggleSwitchDemo,
|
|
32
|
+
[spinnerDemo.id]: spinnerDemo,
|
|
33
|
+
[starsDemo.id]: starsDemo,
|
|
34
|
+
[editableLabelDemo.id]: editableLabelDemo,
|
|
35
|
+
[progressDemo.id]: progressDemo,
|
|
36
|
+
[radioLabelDemo.id]: radioLabelDemo,
|
|
37
|
+
[selectAngleDemo.id]: selectAngleDemo,
|
|
38
|
+
[switchOptionDemo.id]: switchOptionDemo,
|
|
39
|
+
[actionSheetDemo.id]: actionSheetDemo,
|
|
40
|
+
[selectWithTitleDemo.id]: selectWithTitleDemo,
|
|
41
|
+
[inputWithTitleDemo.id]: inputWithTitleDemo,
|
|
42
|
+
[tabsDemo.id]: tabsDemo,
|
|
43
|
+
[modalDemo.id]: modalDemo,
|
|
44
|
+
[popupMenuDemo.id]: popupMenuDemo,
|
|
45
|
+
[noticeMessageDemo.id]: noticeMessageDemo,
|
|
46
|
+
[resizableSplitterDemo.id]: resizableSplitterDemo,
|
|
47
|
+
[redirectDemo.id]: redirectDemo,
|
|
48
|
+
[textWaveDemo.id]: textWaveDemo,
|
|
49
|
+
[textScaleDemo.id]: textScaleDemo,
|
|
50
|
+
[textGlowDemo.id]: textGlowDemo,
|
|
51
|
+
[togglePlayButtonDemo.id]: togglePlayButtonDemo,
|
|
52
|
+
[toggleButtonDemo.id]: toggleButtonDemo,
|
|
53
|
+
[messageBoxDemo.id]: messageBoxDemo,
|
|
54
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CssProps, HtmlVar, isFrontEnd, PageProps } from 'lupine.components';
|
|
2
|
+
import { demoRegistry } from './demo-registry';
|
|
3
|
+
|
|
4
|
+
export const DemoRenderPage = async (props: PageProps) => {
|
|
5
|
+
const dom = new HtmlVar(
|
|
6
|
+
(
|
|
7
|
+
<div
|
|
8
|
+
css={{
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100vh',
|
|
14
|
+
color: 'var(--text-color, #333)',
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
Loading component preview...
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
if (isFrontEnd()) {
|
|
23
|
+
const urlParams = new URL(window.location.href).searchParams;
|
|
24
|
+
const id = urlParams.get('id');
|
|
25
|
+
const story = id ? demoRegistry[id] : null;
|
|
26
|
+
|
|
27
|
+
if (story) {
|
|
28
|
+
// First render using the correct context
|
|
29
|
+
dom.value = story.render(story.args);
|
|
30
|
+
|
|
31
|
+
(window as any)._lj_demo_hook = {
|
|
32
|
+
updateArgs: (newArgs: any) => {
|
|
33
|
+
dom.value = story.render(newArgs);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
dom.value = <div>Component not found</div>;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const css: CssProps = {
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: '100%',
|
|
44
|
+
// Reset any body margins if they exist, though typically handled by global css
|
|
45
|
+
margin: 0,
|
|
46
|
+
padding: 'var(--space-m, 16px)',
|
|
47
|
+
boxSizing: 'border-box',
|
|
48
|
+
display: 'flex',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
alignItems: 'center', // Center components by default
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return <div css={css}>{dom.node}</div>;
|
|
54
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VNode } from 'lupine.components';
|
|
2
|
+
|
|
3
|
+
export type DemoControlType = 'text' | 'boolean' | 'select' | 'number';
|
|
4
|
+
|
|
5
|
+
export type DemoArgType<T = any> = {
|
|
6
|
+
control: DemoControlType;
|
|
7
|
+
options?: T[]; // For 'select'
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type DemoArgTypes<TArgs> = {
|
|
12
|
+
[K in keyof TArgs]?: DemoArgType<TArgs[K]>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface DemoStory<TArgs> {
|
|
16
|
+
id: string;
|
|
17
|
+
text: string;
|
|
18
|
+
args: TArgs;
|
|
19
|
+
argTypes?: DemoArgTypes<TArgs>;
|
|
20
|
+
render: (args: TArgs) => VNode;
|
|
21
|
+
}
|
|
Binary file
|