amotify 0.0.6 → 0.0.8
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/dist/@jsminAmotifyExtension/formCollect.js +2 -2
- package/dist/Atoms/Logo/parts.js +11 -11
- package/dist/Atoms/Various/parts.js +5 -5
- package/dist/Functions/Button/_.js +5 -5
- package/dist/Functions/Cropper/parts.js +47 -47
- package/dist/Functions/Effects/Fade.js +5 -5
- package/dist/Functions/Input/Chips/Selector.js +32 -32
- package/dist/Functions/Input/Chips/_.js +10 -10
- package/dist/Functions/Input/DigitCharacters.js +8 -8
- package/dist/Functions/Input/File/_.js +33 -33
- package/dist/Functions/Input/List/_.js +17 -17
- package/dist/Functions/Input/Segmented/_.js +13 -13
- package/dist/Functions/Input/Select/_.js +12 -12
- package/dist/Functions/Input/Slider/_.js +16 -16
- package/dist/Functions/Input/Switch/_.js +12 -12
- package/dist/Functions/Input/Text.js +12 -12
- package/dist/Functions/Input/TextArea.js +4 -4
- package/dist/Functions/Input/Time/Picker.js +65 -65
- package/dist/Functions/Input/Time/_.js +10 -10
- package/dist/Functions/Input/_.js +31 -31
- package/dist/Functions/Input/core.js +27 -27
- package/dist/Functions/Inputs/text.js +2 -2
- package/dist/Functions/Layout/PageNotFound.js +15 -15
- package/dist/Functions/Layout/PageRouter.js +5 -5
- package/dist/Functions/Layout/PageViewController/parts.js +5 -5
- package/dist/Functions/Layout/Plate.js +2 -2
- package/dist/Functions/Layout/RootViewController/parts.js +22 -22
- package/dist/Functions/Layout/SwipeView/parts.js +6 -6
- package/dist/Functions/Layout/TabBar.js +7 -7
- package/dist/Functions/Loader/corner.js +13 -13
- package/dist/Functions/Loader/mini.js +4 -4
- package/dist/Functions/Loader/parts.js +9 -9
- package/dist/Functions/Loader/top.js +22 -22
- package/dist/Functions/Sheet/parts.js +46 -46
- package/dist/Functions/SnackBar/parts.js +16 -16
- package/dist/Functions/Table/Data/parts.js +72 -72
- package/dist/Functions/Table/Drag/parts.js +15 -15
- package/dist/Functions/Table/_.js +11 -11
- package/dist/Functions/Tooltips/parts.js +6 -6
- package/dist/Molecules/@export.js +14 -14
- package/dist/Molecules/Accordion/parts.js +10 -10
- package/dist/Molecules/LinkifyText/parts.js +4 -4
- package/dist/Molecules/List.js +3 -3
- package/dist/Organisms/DisplayStyleInput/darkmode.js +17 -17
- package/dist/Organisms/DisplayStyleInput/themeColor.js +25 -25
- package/dist/Templates/PlayGround/parts.js +22 -22
- package/dist/launch.js +12 -12
- package/package.json +1 -1
- package/public/amotify.js +47 -47
- package/src/@jsminAmotifyExtension/_.tsx +4 -0
- package/src/@jsminAmotifyExtension/fetch.tsx +107 -0
- package/src/@jsminAmotifyExtension/formCollect.tsx +89 -0
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +159 -0
- package/src/@jsminAmotifyExtension/variables.tsx +130 -0
- package/src/@styles/@app.scss +4 -0
- package/src/@styles/UniStyling.scss +996 -0
- package/src/@styles/init.scss +154 -0
- package/src/@styles/props.scss +109 -0
- package/src/@styles/styleSet.scss +38 -0
- package/src/@styles/themeColor.scss +71 -0
- package/src/@styles/var.scss +171 -0
- package/src/@types/_.tsx +6 -0
- package/src/@types/amot.tsx +323 -0
- package/src/@types/fn.tsx +1210 -0
- package/src/@types/index.tsx +74 -0
- package/src/@types/jsminAmotifyExtension.tsx +143 -0
- package/src/@types/module.tsx +2 -0
- package/src/@types/state.tsx +199 -0
- package/src/Atoms/@export.tsx +32 -0
- package/src/Atoms/FAIcon/parts.tsx +117 -0
- package/src/Atoms/FAIcon/style.module.scss +9 -0
- package/src/Atoms/Logo/parts.tsx +335 -0
- package/src/Atoms/Logo/style.module.scss +96 -0
- package/src/Atoms/Various/parts.tsx +157 -0
- package/src/Atoms/Various/style.module.scss +40 -0
- package/src/Functions/@export.tsx +29 -0
- package/src/Functions/Button/_.tsx +305 -0
- package/src/Functions/Button/style.module.scss +183 -0
- package/src/Functions/Cropper/parts.tsx +1061 -0
- package/src/Functions/Cropper/style.module.scss +62 -0
- package/src/Functions/Effects/Fade.tsx +81 -0
- package/src/Functions/Effects/Ripple.tsx +141 -0
- package/src/Functions/Effects/_.tsx +33 -0
- package/src/Functions/Effects/style.module.scss +83 -0
- package/src/Functions/Input/Chips/Selector.tsx +451 -0
- package/src/Functions/Input/Chips/_.tsx +286 -0
- package/src/Functions/Input/Chips/style.module.scss +6 -0
- package/src/Functions/Input/DigitCharacters.tsx +241 -0
- package/src/Functions/Input/File/_.tsx +596 -0
- package/src/Functions/Input/File/style.module.scss +34 -0
- package/src/Functions/Input/Hidden.tsx +18 -0
- package/src/Functions/Input/List/_.tsx +383 -0
- package/src/Functions/Input/List/style.module.scss +84 -0
- package/src/Functions/Input/Segmented/_.tsx +238 -0
- package/src/Functions/Input/Segmented/style.module.scss +81 -0
- package/src/Functions/Input/Select/_.tsx +225 -0
- package/src/Functions/Input/Select/style.module.scss +10 -0
- package/src/Functions/Input/Slider/_.tsx +519 -0
- package/src/Functions/Input/Slider/style.module.scss +67 -0
- package/src/Functions/Input/Switch/_.tsx +177 -0
- package/src/Functions/Input/Switch/style.module.scss +18 -0
- package/src/Functions/Input/Text.tsx +437 -0
- package/src/Functions/Input/TextArea.tsx +115 -0
- package/src/Functions/Input/Time/Picker.tsx +950 -0
- package/src/Functions/Input/Time/_.tsx +736 -0
- package/src/Functions/Input/Time/style.module.scss +72 -0
- package/src/Functions/Input/_.tsx +793 -0
- package/src/Functions/Input/core.tsx +461 -0
- package/src/Functions/Input/style.module.scss +43 -0
- package/src/Functions/Inputs/_.tsx +5 -0
- package/src/Functions/Inputs/style.module.scss +15 -0
- package/src/Functions/Inputs/text.tsx +67 -0
- package/src/Functions/Inputs/types.d.ts +1 -0
- package/src/Functions/Layout/PageNotFound.tsx +81 -0
- package/src/Functions/Layout/PageRouter.tsx +107 -0
- package/src/Functions/Layout/PageViewController/parts.tsx +32 -0
- package/src/Functions/Layout/Plate.tsx +30 -0
- package/src/Functions/Layout/RootViewController/parts.tsx +290 -0
- package/src/Functions/Layout/RootViewController/style.module.scss +24 -0
- package/src/Functions/Layout/SwipeView/parts.tsx +380 -0
- package/src/Functions/Layout/SwipeView/style.module.scss +19 -0
- package/src/Functions/Layout/TabBar.tsx +64 -0
- package/src/Functions/Layout/_.tsx +20 -0
- package/src/Functions/Loader/corner.tsx +78 -0
- package/src/Functions/Loader/mini.tsx +117 -0
- package/src/Functions/Loader/parts.tsx +105 -0
- package/src/Functions/Loader/style.module.scss +222 -0
- package/src/Functions/Loader/top.tsx +90 -0
- package/src/Functions/Sheet/parts.tsx +972 -0
- package/src/Functions/Sheet/style.module.scss +235 -0
- package/src/Functions/SnackBar/parts.tsx +215 -0
- package/src/Functions/SnackBar/style.module.scss +25 -0
- package/src/Functions/Table/Data/parts.tsx +955 -0
- package/src/Functions/Table/Drag/parts.tsx +448 -0
- package/src/Functions/Table/Normal/parts.tsx +123 -0
- package/src/Functions/Table/_.tsx +170 -0
- package/src/Functions/Table/style.module.scss +92 -0
- package/src/Functions/Tooltips/parts.tsx +52 -0
- package/src/Global/@export.tsx +138 -0
- package/src/Global/LaunchReactApplication.tsx +30 -0
- package/src/Global/exe.tsx +0 -0
- package/src/Global/styleConverter.tsx +435 -0
- package/src/Molecules/@export.tsx +95 -0
- package/src/Molecules/Accordion/parts.tsx +146 -0
- package/src/Molecules/Accordion/style.module.scss +13 -0
- package/src/Molecules/LinkifyText/parts.tsx +54 -0
- package/src/Molecules/List.tsx +30 -0
- package/src/Organisms/@export.tsx +5 -0
- package/src/Organisms/DisplayStyleInput/_.tsx +18 -0
- package/src/Organisms/DisplayStyleInput/darkmode.tsx +112 -0
- package/src/Organisms/DisplayStyleInput/themeColor.tsx +210 -0
- package/src/Templates/@export.tsx +7 -0
- package/src/Templates/PlayGround/parts.tsx +116 -0
- package/src/Templates/PlayGround/style.module.scss +38 -0
- package/src/config.tsx +132 -0
- package/src/index.js +0 -0
- package/src/launch.tsx +100 -0
- package/src/preload.tsx +49 -0
- package/tsconfig.json +4 -22
- package/webpack.config.js +105 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StyleConverter,
|
|
3
|
+
useStore
|
|
4
|
+
} from '~/Global/@export';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Box,
|
|
8
|
+
FAIcon
|
|
9
|
+
} from '~/Atoms/@export';
|
|
10
|
+
|
|
11
|
+
export const Comps: amotify.fn.Tables.CompsMethods = {
|
|
12
|
+
Table: ( params ) => ( <table { ...StyleConverter.ToClassName( params ) } /> ),
|
|
13
|
+
Head: ( params ) => ( <thead { ...StyleConverter.ToClassName( params ) } /> ),
|
|
14
|
+
Body: ( params ) => ( <tbody { ...StyleConverter.ToClassName( params ) } /> ),
|
|
15
|
+
Row: ( params ) => ( <tr { ...StyleConverter.ToClassName( params ) } /> ),
|
|
16
|
+
|
|
17
|
+
TH: ( params ) => ( <th { ...StyleConverter.ToClassName( params ) } /> ),
|
|
18
|
+
TD: ( params ) => ( <td { ...StyleConverter.ToClassName( params ) } /> ),
|
|
19
|
+
|
|
20
|
+
RightIndicator: {
|
|
21
|
+
type: 'td',
|
|
22
|
+
unitWidth: 4,
|
|
23
|
+
// data: '',
|
|
24
|
+
children: <FAIcon.AngleRight
|
|
25
|
+
fontColor={ 'theme' }
|
|
26
|
+
fontSize={ '4.thirdTitle' }
|
|
27
|
+
/>
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
import { NormalTable } from './Normal/parts';
|
|
32
|
+
import {
|
|
33
|
+
DataTable,
|
|
34
|
+
DataFNs,
|
|
35
|
+
DataComps
|
|
36
|
+
} from './Data/parts';
|
|
37
|
+
import { DragTable } from './Drag/parts';
|
|
38
|
+
|
|
39
|
+
import style from './style.module.scss';
|
|
40
|
+
|
|
41
|
+
const Wrapper: FNC<amotify.fn.Tables.Uni.Params & {
|
|
42
|
+
type: amotify.fn.Tables.Types
|
|
43
|
+
}> = ( params ) => {
|
|
44
|
+
let {
|
|
45
|
+
tone,
|
|
46
|
+
type,
|
|
47
|
+
} = params;
|
|
48
|
+
params.tableID = params.tableID || $.uuidGen();
|
|
49
|
+
tone = tone || 'auto';
|
|
50
|
+
|
|
51
|
+
if ( tone == 'auto' ) {
|
|
52
|
+
if ( type == 'drag' ) {
|
|
53
|
+
tone = 'rowBorder';
|
|
54
|
+
} else {
|
|
55
|
+
tone = 'border';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let Params = {
|
|
60
|
+
...tone != 'plain' ? {
|
|
61
|
+
backgroundColor: '1.layer.base',
|
|
62
|
+
borderRadius: '1.tone.primary',
|
|
63
|
+
} as amotifyUniStyleParams : {},
|
|
64
|
+
...params,
|
|
65
|
+
cellStyles: {
|
|
66
|
+
padding: '3/4',
|
|
67
|
+
backgroundColor: '1.layer.base',
|
|
68
|
+
transition: 'short',
|
|
69
|
+
textAlign: 'center',
|
|
70
|
+
...DefaultCellStyles( type,tone! ),
|
|
71
|
+
...params.cellStyles
|
|
72
|
+
},
|
|
73
|
+
tone
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let {
|
|
77
|
+
className,
|
|
78
|
+
style: freeCSS,
|
|
79
|
+
...others
|
|
80
|
+
} = StyleConverter.ToClassName( Params as any );
|
|
81
|
+
|
|
82
|
+
let ClassName = [
|
|
83
|
+
className,
|
|
84
|
+
style.Wrap,
|
|
85
|
+
style[ 'TableType_' + type ],
|
|
86
|
+
style[ 'RowClickable_' + !!( params as any ).onRowClick ]
|
|
87
|
+
].join( ' ' );
|
|
88
|
+
|
|
89
|
+
let TableComponent = {
|
|
90
|
+
'normal': NormalTable,
|
|
91
|
+
'data': DataTable,
|
|
92
|
+
'drag': DragTable,
|
|
93
|
+
'spread': ''
|
|
94
|
+
}[ type ];
|
|
95
|
+
|
|
96
|
+
return ( <Box
|
|
97
|
+
className={ ClassName }
|
|
98
|
+
style={ freeCSS }
|
|
99
|
+
>
|
|
100
|
+
<TableComponent { ...others as any } />
|
|
101
|
+
</Box> );
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let DataComponent: any = ( props: any ) => ( <Wrapper type='data' { ...props } /> );
|
|
105
|
+
Object.entries( DataFNs ).forEach( ( [ key,value ] ) => {
|
|
106
|
+
DataComponent[ key ] = value;
|
|
107
|
+
} );
|
|
108
|
+
Object.entries( DataComps ).forEach( ( [ key,value ] ) => {
|
|
109
|
+
DataComponent[ key ] = value;
|
|
110
|
+
} );
|
|
111
|
+
|
|
112
|
+
export const Table: amotify.fn.Tables.Methods = {
|
|
113
|
+
Normal: ( props ) => ( <Wrapper type='normal' { ...props } /> ),
|
|
114
|
+
Data: DataComponent as amotify.fn.Tables.Data.Methods,
|
|
115
|
+
Drag: ( props ) => ( <Wrapper type='drag' { ...props } /> ),
|
|
116
|
+
Spread: () => ( <>Table.Spread ( in Progress )</> ),
|
|
117
|
+
|
|
118
|
+
Comps
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const DefaultCellStyles = ( type: amotify.fn.Tables.Types,tone: amotify.fn.Tables.Tones ) => {
|
|
122
|
+
if ( tone == 'plain' ) return {}
|
|
123
|
+
|
|
124
|
+
let Styles: amotifyUniStyleParams = {}
|
|
125
|
+
if ( type == 'drag' ) {
|
|
126
|
+
Styles.padding = 1;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if ( [ 'border','rowBorder','cellBorder' ].includes( tone ) ) {
|
|
130
|
+
Styles.borderBottom = '2.normal';
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if ( [ 'border','cellBorder' ].includes( tone ) ) {
|
|
134
|
+
Styles.borderRight = '2.normal';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return Styles;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const DefaultCellSystemStyles = ( args: {
|
|
141
|
+
top: boolean
|
|
142
|
+
bottom: boolean
|
|
143
|
+
left: boolean
|
|
144
|
+
right: boolean
|
|
145
|
+
} ) => {
|
|
146
|
+
let Styles: amotifyUniStyleParams = {}
|
|
147
|
+
if ( args.right ) {
|
|
148
|
+
Styles.borderRight = 'unset';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if ( args.top ) {
|
|
152
|
+
if ( args.left ) {
|
|
153
|
+
Styles.borderTopLeftRadius = 'inherit';
|
|
154
|
+
}
|
|
155
|
+
if ( args.right ) {
|
|
156
|
+
Styles.borderTopRightRadius = 'inherit';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if ( args.bottom ) {
|
|
160
|
+
Styles.borderBottom = 'unset';
|
|
161
|
+
if ( args.left ) {
|
|
162
|
+
Styles.borderBottomLeftRadius = 'inherit';
|
|
163
|
+
}
|
|
164
|
+
if ( args.right ) {
|
|
165
|
+
Styles.borderBottomRightRadius = 'inherit';
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return Styles;
|
|
170
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
@use 'src/@styles/props' as *;
|
|
2
|
+
@use'src/@styles/styleSet' as *;
|
|
3
|
+
.Wrap {
|
|
4
|
+
&.RowClickable_true {
|
|
5
|
+
.Row {
|
|
6
|
+
&.BodyRow:not(.DataNotFound) {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
&:hover .Cell {
|
|
9
|
+
background-color: $color-layer2;
|
|
10
|
+
}
|
|
11
|
+
&:active .Cell {
|
|
12
|
+
background-color: $color-layer3;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
.Table {
|
|
18
|
+
@include pureTable();
|
|
19
|
+
height: 100%;
|
|
20
|
+
border-radius: inherit;
|
|
21
|
+
.Row {
|
|
22
|
+
border-radius: inherit;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
.TableType_ {
|
|
27
|
+
&drag {
|
|
28
|
+
* {
|
|
29
|
+
@include DisableduserSelect();
|
|
30
|
+
}
|
|
31
|
+
.DraggerOrigin {
|
|
32
|
+
.Cell {
|
|
33
|
+
transition: $animation-time-middle;
|
|
34
|
+
background-color: $color-layer4;
|
|
35
|
+
opacity: .8;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.DragableButton {
|
|
40
|
+
cursor: grab;
|
|
41
|
+
&:hover {
|
|
42
|
+
color: $color-theme;
|
|
43
|
+
}
|
|
44
|
+
&:active {
|
|
45
|
+
color: $color-theme;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
&data {
|
|
50
|
+
.Console {
|
|
51
|
+
width: 100%;
|
|
52
|
+
border-bottom: $border-normal;
|
|
53
|
+
position: relative;
|
|
54
|
+
z-index: 2;
|
|
55
|
+
flex: none;
|
|
56
|
+
+ .TableBase {
|
|
57
|
+
border-top-left-radius: 0;
|
|
58
|
+
border-top-right-radius: 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
.TableBase {
|
|
62
|
+
border-radius: inherit;
|
|
63
|
+
.Table {
|
|
64
|
+
border-radius: inherit;
|
|
65
|
+
.HeadRow {
|
|
66
|
+
border-radius: inherit;
|
|
67
|
+
position: relative;
|
|
68
|
+
z-index: 2 !important;
|
|
69
|
+
min-width: 100%;
|
|
70
|
+
.Cell {
|
|
71
|
+
.FilterRegion {
|
|
72
|
+
font-size: inherit;
|
|
73
|
+
.Filtering_true {
|
|
74
|
+
border: none;
|
|
75
|
+
background-color: $color-theme !important;
|
|
76
|
+
color: #fff !important;
|
|
77
|
+
box-shadow: $shadow2;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
.BodyRow {
|
|
83
|
+
position: relative;
|
|
84
|
+
z-index: 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
.Cell {
|
|
91
|
+
font-weight: normal;
|
|
92
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box
|
|
3
|
+
} from '~/Atoms/@export';
|
|
4
|
+
import {
|
|
5
|
+
Sheet
|
|
6
|
+
} from '~/Functions/@export';
|
|
7
|
+
|
|
8
|
+
const Tooltips: amotify.fn.Tooltips.Methods = {
|
|
9
|
+
__memoryID: $.uuidGen(),
|
|
10
|
+
open: ( params ) => {
|
|
11
|
+
let {
|
|
12
|
+
tipsID = $.uuidGen(),
|
|
13
|
+
tipsGroups = [],
|
|
14
|
+
...sheetParams
|
|
15
|
+
} = params;
|
|
16
|
+
|
|
17
|
+
Sheet.open( {
|
|
18
|
+
sheetID: tipsID!,
|
|
19
|
+
sheetGroups: [
|
|
20
|
+
'tooltips',
|
|
21
|
+
...tipsGroups,
|
|
22
|
+
],
|
|
23
|
+
closeOption: {
|
|
24
|
+
aroundClick: true,
|
|
25
|
+
elementBlur: params.parent,
|
|
26
|
+
escapeKeyDown: true,
|
|
27
|
+
pageTransit: true,
|
|
28
|
+
...params.closeOption,
|
|
29
|
+
},
|
|
30
|
+
type: 'custom',
|
|
31
|
+
...sheetParams
|
|
32
|
+
} );
|
|
33
|
+
},
|
|
34
|
+
close: ( tipsID ) => {
|
|
35
|
+
Sheet.close( tipsID );
|
|
36
|
+
},
|
|
37
|
+
closeALL: () => {
|
|
38
|
+
Sheet.closeGroup( 'tooltips' );
|
|
39
|
+
},
|
|
40
|
+
Comps: {
|
|
41
|
+
Body: ( params ) => ( <Box
|
|
42
|
+
padding={ [ '1/3','2/3' ] }
|
|
43
|
+
backgroundColor='dark'
|
|
44
|
+
borderRadius={ '2.tone.secondary' }
|
|
45
|
+
fontColor='white'
|
|
46
|
+
boxShadow={ 2 }
|
|
47
|
+
{ ...params }
|
|
48
|
+
/> )
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { Tooltips }
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as ReactDom from 'react-dom';
|
|
3
|
+
import * as ReactRouterDom from 'react-router-dom';
|
|
4
|
+
|
|
5
|
+
import { LaunchReactApplication } from './LaunchReactApplication';
|
|
6
|
+
|
|
7
|
+
const Inmemory: {
|
|
8
|
+
[ key: string ]: {
|
|
9
|
+
privateKey?: string
|
|
10
|
+
value: any
|
|
11
|
+
}
|
|
12
|
+
} = {}
|
|
13
|
+
const useStore: amotify.glob.useStoreParams = {
|
|
14
|
+
set: ( params ) => {
|
|
15
|
+
let {
|
|
16
|
+
key,
|
|
17
|
+
value,
|
|
18
|
+
privateKey
|
|
19
|
+
} = params;
|
|
20
|
+
let Prev = Inmemory[ key ] || {}
|
|
21
|
+
if ( Prev && Prev.privateKey && Prev.privateKey != privateKey ) return false;
|
|
22
|
+
|
|
23
|
+
Inmemory[ key ] = {
|
|
24
|
+
privateKey,
|
|
25
|
+
value
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
},
|
|
29
|
+
update: ( params ) => {
|
|
30
|
+
let {
|
|
31
|
+
key,
|
|
32
|
+
value,
|
|
33
|
+
privateKey
|
|
34
|
+
} = params;
|
|
35
|
+
|
|
36
|
+
let Prev = Inmemory[ key ] || {}
|
|
37
|
+
if ( Prev && Prev.privateKey && Prev.privateKey != privateKey ) return false;
|
|
38
|
+
|
|
39
|
+
Inmemory[ key ] = {
|
|
40
|
+
...Inmemory[ key ],
|
|
41
|
+
value: {
|
|
42
|
+
...Inmemory[ key ]?.value,
|
|
43
|
+
...value
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
},
|
|
48
|
+
get: ( key,privateKey ) => {
|
|
49
|
+
let Data = Inmemory[ key ];
|
|
50
|
+
if ( Data && Data.privateKey && Data.privateKey != privateKey ) return void 0;
|
|
51
|
+
return Data?.value;
|
|
52
|
+
},
|
|
53
|
+
delete: ( key,privateKey ) => {
|
|
54
|
+
let Data = Inmemory[ key ];
|
|
55
|
+
if ( Data && Data.privateKey && Data.privateKey != privateKey ) return false;
|
|
56
|
+
delete Inmemory[ key ];
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const useRecycle: amotify.glob.useRecycleParams = {
|
|
61
|
+
set: ( key ) => {
|
|
62
|
+
let [ val_recycleID ] = React.useState( $.uuidGen() );
|
|
63
|
+
let [ val_refresh,set_refresh ] = React.useState( $.uuidGen() );
|
|
64
|
+
|
|
65
|
+
useStore.set( {
|
|
66
|
+
key: 'RecycleKey_' + val_recycleID,
|
|
67
|
+
value: () => {
|
|
68
|
+
set_refresh( $.uuidGen() );
|
|
69
|
+
}
|
|
70
|
+
} )
|
|
71
|
+
useStore.update( {
|
|
72
|
+
key: 'RecycleKeys_' + key,
|
|
73
|
+
value: {
|
|
74
|
+
keys: [
|
|
75
|
+
...useStore.get( 'RecycleKeys_' + key )?.keys || [],
|
|
76
|
+
val_recycleID
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
} )
|
|
80
|
+
return val_refresh;
|
|
81
|
+
},
|
|
82
|
+
do: ( key ) => {
|
|
83
|
+
let Keys = useStore.get( 'RecycleKeys_' + key )?.keys || [];
|
|
84
|
+
|
|
85
|
+
if ( !Keys.length ) return;
|
|
86
|
+
for ( let key of Keys ) {
|
|
87
|
+
let receiver = useStore.get( 'RecycleKey_' + key );
|
|
88
|
+
if ( receiver ) receiver();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const pageTransit: amotify.glob.PageTransitParams = {
|
|
94
|
+
open: ( url ) => {
|
|
95
|
+
window.open( url );
|
|
96
|
+
},
|
|
97
|
+
pushSync: ( url ) => {
|
|
98
|
+
window.location.href = url;
|
|
99
|
+
},
|
|
100
|
+
pushAsync: ( url ) => {
|
|
101
|
+
if ( url.match( /https?:\/\// ) ) {
|
|
102
|
+
pageTransit.pushSync( url );
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
useStore.get( 'history' ).push( url );
|
|
106
|
+
},
|
|
107
|
+
push: ( url,newTab ) => {
|
|
108
|
+
if ( newTab ) {
|
|
109
|
+
pageTransit.open( url );
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
pageTransit.pushAsync( url );
|
|
113
|
+
},
|
|
114
|
+
back: () => {
|
|
115
|
+
useStore.get( 'history' ).goBack();
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
import {
|
|
120
|
+
ReadStyleSet,
|
|
121
|
+
ToClassName
|
|
122
|
+
} from './styleConverter';
|
|
123
|
+
|
|
124
|
+
const StyleConverter = {
|
|
125
|
+
ReadStyleSet,
|
|
126
|
+
ToClassName
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
React,
|
|
131
|
+
ReactDom,
|
|
132
|
+
ReactRouterDom,
|
|
133
|
+
pageTransit,
|
|
134
|
+
useStore,
|
|
135
|
+
useRecycle,
|
|
136
|
+
StyleConverter,
|
|
137
|
+
LaunchReactApplication
|
|
138
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as ReactDom from 'react-dom';
|
|
2
|
+
import * as ReactRouterDom from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
export const LaunchReactApplication: amotify.glob.LaunchReactApplicationParams = ( props ) => {
|
|
5
|
+
let {
|
|
6
|
+
baseElement = '#ROOT',
|
|
7
|
+
reactElement,
|
|
8
|
+
nonRouter = false,
|
|
9
|
+
appearances
|
|
10
|
+
} = props;
|
|
11
|
+
let Base = $( baseElement )[ 0 ];
|
|
12
|
+
|
|
13
|
+
if ( !Base || !reactElement ) return;
|
|
14
|
+
if ( appearances ) {
|
|
15
|
+
let {
|
|
16
|
+
roundness,
|
|
17
|
+
tone,
|
|
18
|
+
themeColor,
|
|
19
|
+
darkMode
|
|
20
|
+
} = appearances;
|
|
21
|
+
|
|
22
|
+
if ( $.is.exist( roundness ) ) amotify.config.update.roundness( roundness! );
|
|
23
|
+
if ( $.is.exist( tone ) ) amotify.config.update.tone( tone! );
|
|
24
|
+
if ( $.is.exist( themeColor ) ) amotify.config.update.themeColor( themeColor! );
|
|
25
|
+
if ( $.is.exist( darkMode ) ) amotify.config.update.darkMode( darkMode! );
|
|
26
|
+
}
|
|
27
|
+
let reactDom = nonRouter ? reactElement : <ReactRouterDom.BrowserRouter children={ reactElement } />;
|
|
28
|
+
|
|
29
|
+
ReactDom.createRoot( Base ).render( <React.StrictMode children={ reactDom } /> );
|
|
30
|
+
}
|
|
File without changes
|