amotify 0.0.64 → 0.0.66

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 (114) hide show
  1. package/dist/amotify.js +3 -2
  2. package/dist/amotify.min.css +2 -2
  3. package/dist/coreVender.js +14 -2
  4. package/package.json +10 -10
  5. package/tsconfig.json +13 -5
  6. package/@types/_.tsx +0 -7
  7. package/@types/amot.tsx +0 -357
  8. package/@types/fn.tsx +0 -1280
  9. package/@types/jsminAmotifyExtension.tsx +0 -137
  10. package/@types/module.tsx +0 -1
  11. package/@types/state.tsx +0 -231
  12. package/src/@atoms.tsx +0 -34
  13. package/src/@functions.tsx +0 -29
  14. package/src/@global.tsx +0 -149
  15. package/src/@jsminAmotifyExtension/_.tsx +0 -4
  16. package/src/@jsminAmotifyExtension/fetch.tsx +0 -110
  17. package/src/@jsminAmotifyExtension/formCollect.tsx +0 -94
  18. package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -165
  19. package/src/@jsminAmotifyExtension/variables.tsx +0 -137
  20. package/src/@molecules.tsx +0 -96
  21. package/src/@organisms.tsx +0 -1
  22. package/src/@reactPacks/reactProduction@18.2.0.js +0 -79
  23. package/src/@reactPacks/reactRouterDomProduction@18.2.0.js +0 -31
  24. package/src/@styles/@app.scss +0 -4
  25. package/src/@styles/UniStyling.scss +0 -1028
  26. package/src/@styles/init.scss +0 -94
  27. package/src/@styles/props.scss +0 -109
  28. package/src/@styles/styleSet.scss +0 -38
  29. package/src/@styles/themeColor.scss +0 -71
  30. package/src/@styles/var.scss +0 -182
  31. package/src/@templates.tsx +0 -7
  32. package/src/@variables.tsx +0 -74
  33. package/src/atoms/FAI/parts.tsx +0 -139
  34. package/src/atoms/Logo/parts.tsx +0 -335
  35. package/src/atoms/Logo/style.module.scss +0 -96
  36. package/src/atoms/Various/parts.tsx +0 -159
  37. package/src/atoms/Various/style.module.scss +0 -46
  38. package/src/config.tsx +0 -191
  39. package/src/functions/Button/_.tsx +0 -331
  40. package/src/functions/Button/style.module.scss +0 -157
  41. package/src/functions/Cropper/parts.tsx +0 -1084
  42. package/src/functions/Cropper/style.module.scss +0 -64
  43. package/src/functions/Effects/Fade.tsx +0 -76
  44. package/src/functions/Effects/Ripple.tsx +0 -141
  45. package/src/functions/Effects/_.tsx +0 -33
  46. package/src/functions/Effects/style.module.scss +0 -91
  47. package/src/functions/Input/Chips/Selector.tsx +0 -445
  48. package/src/functions/Input/Chips/_.tsx +0 -289
  49. package/src/functions/Input/Chips/style.module.scss +0 -6
  50. package/src/functions/Input/Contenteditable.tsx +0 -114
  51. package/src/functions/Input/DigitCharacters.tsx +0 -235
  52. package/src/functions/Input/File/_.tsx +0 -553
  53. package/src/functions/Input/File/style.module.scss +0 -34
  54. package/src/functions/Input/Hidden.tsx +0 -21
  55. package/src/functions/Input/List/_.tsx +0 -383
  56. package/src/functions/Input/List/style.module.scss +0 -84
  57. package/src/functions/Input/RichSelect/_.tsx +0 -230
  58. package/src/functions/Input/RichSelect/style.module.scss +0 -11
  59. package/src/functions/Input/Segmented/_.tsx +0 -246
  60. package/src/functions/Input/Segmented/style.module.scss +0 -81
  61. package/src/functions/Input/Select/_.tsx +0 -218
  62. package/src/functions/Input/Select/style.module.scss +0 -11
  63. package/src/functions/Input/Slider/_.tsx +0 -524
  64. package/src/functions/Input/Slider/style.module.scss +0 -67
  65. package/src/functions/Input/Switch/_.tsx +0 -176
  66. package/src/functions/Input/Switch/style.module.scss +0 -18
  67. package/src/functions/Input/Text.tsx +0 -487
  68. package/src/functions/Input/TextArea.tsx +0 -109
  69. package/src/functions/Input/Time/Picker.tsx +0 -1361
  70. package/src/functions/Input/Time/_.tsx +0 -749
  71. package/src/functions/Input/Time/style.module.scss +0 -79
  72. package/src/functions/Input/_.tsx +0 -881
  73. package/src/functions/Input/core.tsx +0 -473
  74. package/src/functions/Input/style.module.scss +0 -102
  75. package/src/functions/Inputs/_.tsx +0 -5
  76. package/src/functions/Inputs/style.module.scss +0 -15
  77. package/src/functions/Inputs/text.tsx +0 -53
  78. package/src/functions/Inputs/types.d.ts +0 -13
  79. package/src/functions/Layout/PageNotFound.tsx +0 -78
  80. package/src/functions/Layout/PageRouter.tsx +0 -89
  81. package/src/functions/Layout/PageViewController/parts.tsx +0 -27
  82. package/src/functions/Layout/Plate.tsx +0 -30
  83. package/src/functions/Layout/RootViewController/parts.tsx +0 -300
  84. package/src/functions/Layout/RootViewController/style.module.scss +0 -23
  85. package/src/functions/Layout/SwipeView/parts.tsx +0 -375
  86. package/src/functions/Layout/SwipeView/style.module.scss +0 -20
  87. package/src/functions/Layout/TabBar.tsx +0 -60
  88. package/src/functions/Layout/_.tsx +0 -20
  89. package/src/functions/Loader/corner.tsx +0 -74
  90. package/src/functions/Loader/mini.tsx +0 -114
  91. package/src/functions/Loader/parts.tsx +0 -103
  92. package/src/functions/Loader/style.module.scss +0 -223
  93. package/src/functions/Loader/top.tsx +0 -84
  94. package/src/functions/Sheet/parts.tsx +0 -994
  95. package/src/functions/Sheet/style.module.scss +0 -208
  96. package/src/functions/SnackBar/parts.tsx +0 -215
  97. package/src/functions/SnackBar/style.module.scss +0 -25
  98. package/src/functions/Table/Data/parts.tsx +0 -965
  99. package/src/functions/Table/Drag/parts.tsx +0 -442
  100. package/src/functions/Table/Normal/parts.tsx +0 -124
  101. package/src/functions/Table/_.tsx +0 -177
  102. package/src/functions/Table/style.module.scss +0 -93
  103. package/src/functions/Tooltips/parts.tsx +0 -53
  104. package/src/global/LaunchReactApplication.tsx +0 -74
  105. package/src/global/styleConverter.tsx +0 -465
  106. package/src/launch.tsx +0 -119
  107. package/src/molecules/Accordion/parts.tsx +0 -146
  108. package/src/molecules/Accordion/style.module.scss +0 -13
  109. package/src/molecules/LinkifyText/parts.tsx +0 -52
  110. package/src/molecules/List.tsx +0 -31
  111. package/src/preload.tsx +0 -31
  112. package/src/templates/PlayGround/parts.tsx +0 -96
  113. package/src/templates/PlayGround/style.module.scss +0 -38
  114. package/webpack.config.js +0 -146
@@ -1,994 +0,0 @@
1
- import {
2
- launchID,
3
- React,
4
- LaunchSubApplication,
5
- useStore,
6
- } from '@global'
7
- import {
8
- Img,
9
- Box,
10
- Flex,
11
- FAI
12
- } from '@atoms'
13
- import {
14
- Column,
15
- Row,
16
- Text
17
- } from '@mols'
18
- import {
19
- Buttons,
20
- Input,
21
- Layout
22
- } from '@fn'
23
-
24
- import style from './style.module.scss'
25
-
26
- type Params = amotify.fn.Sheet.Params & {
27
- type: amotify.fn.Sheet.SheetTypes
28
- }
29
-
30
- const Comps = {
31
- contents: {} as {
32
- [ key: string ]: {
33
- open: boolean
34
- hold_state: boolean
35
- params: Params
36
- created_at: Time.Methods
37
- }
38
- },
39
- Launch: function ( params: Params ) {
40
- params = {
41
- sheetID: $.uuidGen(),
42
- sheetGroups: params.sheetGroups || [],
43
- backgroundEffect: true,
44
- overwrap: params.type == 'custom' ? true : false,
45
- hold_state: false,
46
- ...params,
47
- close_option: {
48
- pageTransit: true,
49
- escapeKeyDown: true,
50
- aroundClick: params.type == 'custom',
51
- ...params.close_option
52
- },
53
- }
54
-
55
- if ( this.contents[ params.sheetID! ] ) {
56
- /** open Exist Sheet */
57
- let component = useStore.get( params.sheetID! )
58
- if ( component && component.refresh ) component.refresh( params,true )
59
- return
60
- }
61
- /** create Sheet */
62
- let Content = <Comps.Core { ...params } />
63
-
64
- this.contents[ params.sheetID! ] = {
65
- open: true,
66
- hold_state: !!params.hold_state,
67
- params: params,
68
- created_at: $.Time()
69
- }
70
-
71
- $( '#' + launchID + ' .AMOTIFY_be_sheet' )
72
- .append( `<div id="Sheet-${ params.sheetID }"></div>` )
73
- .callback( () => {
74
- LaunchSubApplication( {
75
- isRoot: false,
76
- baseElement: '#Sheet-' + params.sheetID,
77
- reactElement: Content,
78
- } )
79
- } )
80
- },
81
- mainSheetScrolls: 0,
82
- subSheetLength: 0,
83
- currentIndex: 0,
84
- Core: ( params: Params ) => {
85
- let [ val_componentID ] = React.useState( $.uuidGen() )
86
- let [ val_params,set_params ] = React.useState( params )
87
- let [ val_open,set_open ] = React.useState( true )
88
-
89
- let {
90
- type,
91
- sheetID,
92
- openAfter,
93
- closeAfter,
94
- } = val_params
95
-
96
- let isNewSheet = !params.overwrap
97
-
98
- let ContentFC: any = Comps.Types[ {
99
- 'normal.topLeft': 'Normal',
100
- 'normal.topCenter': 'Normal',
101
- 'normal.topRight': 'Normal',
102
- 'normal.middleLeft': 'Normal',
103
- 'normal.middleCenter': 'Normal',
104
- 'normal.middleRight': 'Normal',
105
- 'normal.bottomLeft': 'Normal',
106
- 'normal.bottomCenter': 'Normal',
107
- 'normal.bottomRight': 'Normal',
108
- 'image': 'Normal',
109
-
110
- 'drawer.left': 'Edge',
111
- 'drawer.right': 'Edge',
112
- 'drawer.bottom': 'Bottom',
113
-
114
- 'custom': 'Custom',
115
- }[ type ] as 'Normal' ]
116
-
117
- React.useEffect( () => {
118
- useStore.set( {
119
- key: sheetID!,
120
- value: {
121
- refresh: ( params: Params,open?: boolean ) => {
122
- set_params( params )
123
- set_open( open ?? false )
124
- },
125
- resize: ( size: string ) => {
126
- if ( type == 'drawer.bottom' ) {
127
- let component = useStore.get( val_componentID )
128
- if ( component && component.resize ) component.resize( size )
129
- } else if (
130
- val_params.type.includes( 'normal' ) ||
131
- val_params.type.includes( 'drawer' )
132
- ) {
133
- set_params( {
134
- ...val_params,
135
- size: size
136
- } as any )
137
- }
138
- },
139
- close: ( force: boolean ) => {
140
- Comps.contents[ sheetID! ].open = false
141
-
142
- set_open( false )
143
- },
144
- open: () => {
145
- Comps.contents[ sheetID! ].open = true
146
-
147
- set_open( true )
148
- }
149
- }
150
- } )
151
- } )
152
- React.useEffect( () => {
153
- Comps.currentIndex++
154
-
155
- let {
156
- close_option
157
- } = params
158
-
159
- $.fnScope( () => {
160
- if ( !close_option?.elementBlur ) return
161
- let element = $( close_option.elementBlur )
162
- if ( !element[ 0 ] ) return
163
- $( element ).addEvent( {
164
- eventID: 'SheetClosation-' + sheetID!,
165
- eventType: 'mouseout',
166
- callback: () => {
167
- Sheet.close( sheetID! )
168
-
169
- $().removeEvent( 'SheetClosation-' + sheetID! )
170
- }
171
- } )
172
- } )
173
- },[] )
174
- React.useEffect( () => {
175
- $.fnScope( () => {
176
- if ( !isNewSheet ) return
177
- if ( !params.backgroundEffect ) return
178
-
179
- Comps.subSheetLength = Comps.subSheetLength + ( val_open ? 1 : -1 )
180
- if ( val_open ) {
181
- let html = $( 'html' )
182
-
183
- if ( Comps.subSheetLength == 1 ) {
184
- let scroll = html[ 0 ].scrollTop
185
- Comps.mainSheetScrolls = scroll
186
- }
187
- if ( !amotify.config.device.isPhone ) {
188
- html
189
- .abort()
190
- .addClass( style.FixHeight )
191
- .callback( () => {
192
- $( '#' + launchID + ' .AMOTIFY_be_root' )
193
- .addClass( style.FixScroll )
194
- [ 0 ].scrollTop = Comps.mainSheetScrolls
195
- } )
196
- .addClass( [
197
- style.FloatMainSheet,
198
- style[ 'Type_' + type ]
199
- ] )
200
- [ 0 ].scrollTop = 0
201
- }
202
- } else {
203
- if ( Comps.subSheetLength != 0 ) return
204
- if ( amotify.config.device.isPhone ) return
205
- let html = $( 'html' )
206
- html
207
- .abort()
208
- .removeClass( style.FloatMainSheet )
209
- .await( 251 )
210
- .removeClass( style.FixHeight )
211
- .callback( ( html ) => {
212
- html[ 0 ].scrollTop = Comps.mainSheetScrolls | 0
213
- $( '#' + launchID + ' .AMOTIFY_be_root' )[ 0 ].scrollTop = 0
214
- } )
215
- }
216
- } )
217
- $.fnScope( () => {
218
- if ( val_open ) {
219
- $( '#' + val_componentID )
220
- .abort()
221
- .await( 10 )
222
- .removeClass( style.Hide )
223
- .await( 10 )
224
- .addClass( style.Open )
225
- .callback( () => {
226
- if ( openAfter ) openAfter()
227
- } )
228
- } else {
229
- $( '#' + val_componentID )
230
- .abort()
231
- .await( 10 )
232
- .removeClass( style.Open )
233
- .await( 251 )
234
- .addClass( style.Hide )
235
- .callback( () => {
236
- !closeAfter || closeAfter()
237
-
238
- if ( params.hold_state ) {
239
- return
240
- }
241
- delete Comps.contents[ sheetID! ]
242
- $( '#Sheet-' + sheetID ).remove()
243
- $().removeEvent( 'SheetClosation-' + sheetID! )
244
- } )
245
- }
246
- } )
247
- },[ val_open ] )
248
-
249
- let [ Tcate,Tpos ] = type.split( '.' )
250
-
251
- return <Box
252
- className={ [
253
- style.Wrap,
254
- style[ 'Tcate_' + Tcate ],
255
- style[ 'Tpos_' + Tpos ],
256
- style[ 'isNewSheet_' + isNewSheet ],
257
- ].join( ' ' ) }
258
- width={ 1 }
259
- height={ 0 }
260
- ssAbsoluteCovered
261
- freeCSS={ {
262
- zIndex: Comps.currentIndex + 1
263
- } }
264
- id={ val_componentID }
265
- >
266
- <Column
267
- className={ style.Content }
268
- gap={ 0 }
269
- height={ 'viewHeight' }
270
- overflow={ 'auto' }
271
- transition='middle'
272
- >
273
- { isNewSheet ? <Comps.TapSensor
274
- sheetID={ sheetID! }
275
- delegateAroundClick={ params.close_option?.aroundClick }
276
- /> : null }
277
- <ContentFC
278
- componentID={ val_componentID }
279
- { ...val_params }
280
- />
281
- </Column>
282
- </Box>
283
- },
284
- Types: {
285
- Normal: ( params: amotify.fn.Sheet.NormalParams ) => {
286
- let {
287
- sheetID,
288
- sheetGroups,
289
- content: Content,
290
- className = '',
291
- type,
292
- size = 'R',
293
- freeCSS,
294
- openAfter,
295
- hold_state,
296
- overwrap,
297
- ...styles
298
- } = params
299
- let [ Tcate,Tpos ] = type.split( '.' )
300
-
301
- let SysStyles: amotifyUniStyleParams = {}
302
- let transformOrigins: string[] = []
303
-
304
- if ( Tpos.match( /top/ ) ) {
305
- transformOrigins.push( 'top' )
306
-
307
- SysStyles.marginBottom = 'auto'
308
- } else if ( Tpos.match( /middle/ ) ) {
309
- transformOrigins.push( 'center' )
310
-
311
- SysStyles.marginTop = 'auto'
312
- SysStyles.marginBottom = 'auto'
313
- } else if ( Tpos.match( /bottom/ ) ) {
314
- transformOrigins.push( 'bottom' )
315
-
316
- SysStyles.marginTop = 'auto'
317
- }
318
-
319
- if ( Tpos.match( /left/i ) ) {
320
- transformOrigins.push( 'left' )
321
-
322
- SysStyles.marginRight = 'auto'
323
- } else if ( Tpos.match( /center/i ) ) {
324
- transformOrigins.push( 'center' )
325
-
326
- SysStyles.marginLeft = 'auto'
327
- SysStyles.marginRight = 'auto'
328
- } else if ( Tpos.match( /right/i ) ) {
329
- transformOrigins.push( 'right' )
330
-
331
- SysStyles.marginLeft = 'auto'
332
- }
333
-
334
- return <Box
335
- className={ [
336
- style.BB,
337
- className
338
- ].join( ' ' ) }
339
-
340
- transition='long'
341
- opacity='trans'
342
- { ...SysStyles }
343
- { ...styles }
344
- freeCSS={ {
345
- width: {
346
- 'S': '26rem',
347
- 'R': '36rem',
348
- 'L': '44rem',
349
- '2L': '60rem',
350
- '3L': '72rem',
351
- 'MAX': '95vw'
352
- }[ size ],
353
- maxWidth: '96vw',
354
- transformOrigin: transformOrigins.join( ' ' ),
355
- ...freeCSS
356
- } }
357
- children={ $.is.function( Content ) ? <Content /> : Content }
358
- />
359
- },
360
- Edge: ( params: amotify.fn.Sheet.NormalParams ) => {
361
- let {
362
- sheetID,
363
- sheetGroups,
364
- type,
365
- content: Content,
366
- className = '',
367
- size = 'R',
368
- freeCSS,
369
- close_option,
370
- hold_state,
371
- overwrap,
372
- ...styles
373
- } = params
374
-
375
- return <Box
376
- opacity='trans'
377
- transition='long'
378
- position='relative'
379
- backgroundColor={ '1.layer.base' }
380
- flexSizing={ 'none' }
381
- minHeight={ 'viewHeight' }
382
- boxShadow={ '3.remark' }
383
- className={ [
384
- style.BB,
385
- className
386
- ].join( ' ' ) }
387
- { ...type == 'drawer.right' ? {
388
- marginLeft: 'auto'
389
- } : type == 'drawer.left' ? {
390
- marginRight: 'auto'
391
- } : {} }
392
- { ...styles }
393
- freeCSS={ {
394
- width: {
395
- 'S': '20rem',
396
- 'R': '27rem',
397
- 'L': '32rem',
398
- '2L': '40rem',
399
- '3L': '58rem',
400
- 'MAX': '95vw'
401
- }[ size ],
402
- ...freeCSS
403
- } }
404
- children={ $.is.function( Content ) ? <Content /> : Content }
405
- />
406
- },
407
- Bottom: ( params: amotify.fn.Sheet.Bottom.Params ) => {
408
- let {
409
- componentID,
410
- sheetID,
411
- sheetGroups,
412
- content: Content,
413
- size = 'R',
414
- sizeChanged,
415
- baseStyles,
416
- close_option: {
417
- swipeDown = true,
418
- } = {},
419
- hold_state,
420
- overwrap,
421
- ...styles
422
- } = params
423
- let screen = $.getScreenSize()
424
-
425
- let sizeArray = [ 0,.2,.6,.95 ]
426
- let SizeSets = {
427
- 'ZERO': 0,
428
- 'S': 1,
429
- 'R': 2,
430
- 'L': 3
431
- }
432
-
433
- let [ val_stableSize,set_stableSize ] = React.useState( size as any )
434
- let [ val_edit,set_edit ] = React.useState( {
435
- process: false,
436
- processStart: 0,
437
- originY: 0,
438
- originValue: 0,
439
- viewHeight: 0,
440
- value: sizeArray[ SizeSets[ size ] ]
441
- } )
442
-
443
- useStore.update( {
444
- key: componentID!,
445
- value: {
446
- val_edit,
447
- resize: ( size: amotify.fn.Sheet.Bottom.Sizes ) => {
448
- let Size = sizeArray[ SizeSets[ size ] ]
449
- set_edit( {
450
- ...val_edit,
451
- value: Size
452
- } )
453
- set_stableSize( size )
454
- }
455
- }
456
- } )
457
-
458
- const Effects = {
459
- Start: ( event: any ) => {
460
- $( document )
461
- .addEvent( { eventID: 'BottomSheetMouseMove',eventType: 'mousemove',callback: Effects.Move } )
462
- .addEvent( { eventID: 'BottomSheetTouchMove',eventType: 'touchmove',callback: Effects.Move } )
463
- .addEvent( { eventID: 'BottomSheetMouseUp',eventType: 'mouseup',callback: Effects.End } )
464
- .addEvent( { eventID: 'BottomSheetTouchEnd',eventType: 'touchend',callback: Effects.End } )
465
-
466
- let cursor = $.getCursor( event )
467
- let newEditInfo = {
468
- ...val_edit,
469
- process: true,
470
- processStart: new Date().getTime(),
471
- originY: cursor.y,
472
- originValue: val_edit.value,
473
- viewHeight: $.getScreenSize().height,
474
- }
475
- useStore.update( {
476
- key: componentID!,
477
- value: {
478
- val_edit: newEditInfo
479
- }
480
- } )
481
- set_edit( newEditInfo )
482
- },
483
- Move: ( event: any ) => {
484
- let editInfo = useStore.get( componentID! )?.val_edit as typeof val_edit
485
- if ( !editInfo.process ) return
486
-
487
- let margin = $.getCursor( event ).y - editInfo.originY
488
- let marginRate = margin / editInfo.viewHeight
489
- let newRate = editInfo.originValue - marginRate
490
-
491
- if ( newRate > .95 ) {
492
- let margin = newRate - .95
493
- newRate = .95 + margin * .5
494
- } else if ( newRate < .2 ) {
495
- let margin = .2 - newRate
496
- margin -= .1
497
- newRate = .1 + ( .1 - margin ) * .5
498
- }
499
-
500
- set_edit( {
501
- ...editInfo,
502
- value: newRate
503
- } )
504
- },
505
- End: ( event: any ) => {
506
- let editInfo = useStore.get( componentID! )?.val_edit as typeof val_edit
507
- if ( !editInfo.process ) return
508
- $( document ).removeEvent( [
509
- 'BottomSheetMouseMove',
510
- 'BottomSheetTouchMove',
511
- 'BottomSheetMouseUp',
512
- 'BottomSheetTouchEnd'
513
- ] )
514
-
515
- let sizeIndex = 0
516
- if ( editInfo.value < .1 ) {
517
- } else if ( editInfo.value < .5 ) {
518
- sizeIndex = 1
519
- } else if ( editInfo.value > .75 ) {
520
- sizeIndex = 3
521
- } else {
522
- sizeIndex = 2
523
- }
524
-
525
- let ms = new Date().getTime() - editInfo.processStart
526
- if ( ms < 300 ) {
527
- let margin = $.getCursor( event ).y - editInfo.originY
528
- if ( Math.abs( margin ) >= 20 ) {
529
- let dir = Number( margin < 0 ) * 2 - 1
530
- sizeIndex += dir
531
- sizeIndex = Math.min( Math.max( sizeIndex,0 ),sizeArray.length - 1 )
532
- }
533
- }
534
-
535
- if ( sizeIndex == 0 ) {
536
- if ( !swipeDown ) sizeIndex = 1
537
- }
538
- set_stableSize( [ 'ZERO','S','R','L' ][ sizeIndex ] as any )
539
- set_edit( {
540
- ...editInfo,
541
- value: sizeArray[ sizeIndex ],
542
- process: false
543
- } )
544
- }
545
- }
546
-
547
- const mounted = React.useRef( false )
548
- React.useEffect( () => {
549
- if ( mounted.current ) {
550
- if ( val_stableSize == 'ZERO' ) {
551
- if ( swipeDown ) Sheet.close( sheetID! )
552
- } else {
553
- setTimeout( () => {
554
- if ( params.sizeChanged ) params.sizeChanged( val_stableSize )
555
- },250 )
556
- }
557
- } else {
558
- mounted.current = true
559
- }
560
- },[ val_stableSize ] )
561
-
562
- return <Box
563
- className={ style.BB }
564
- margin={ [ 0,'auto' ] }
565
- marginTop={ 'auto' }
566
- opacity='trans'
567
- width={ 1 }
568
- transition='long'
569
- freeCSS={ {
570
- maxWidth: 12 * 60,
571
- height: screen.height * val_edit.value,
572
- ...val_edit.process ? {
573
- transition: '0s'
574
- } : {},
575
- } }
576
- >
577
- <Column
578
- gap={ 0 }
579
- flexSizing={ 'none' }
580
- borderTopLeftRadius={ '1.tone.primary' }
581
- borderTopRightRadius={ '1.tone.primary' }
582
- border
583
- borderBottom='unset'
584
- boxShadow={ '3.remark' }
585
- position='relative'
586
- overflow={ 'hidden' }
587
- height={ 1 }
588
- { ...baseStyles }
589
- >
590
- <Row.Separate
591
- padding={ '1/2' }
592
- backgroundColor='1.layer.base'
593
- position='relative'
594
- freeCSS={ {
595
- userSelect: 'none'
596
- } }
597
- >
598
- <Row.Center
599
- flexSizing={ 0 }
600
- padding={ '2/3' }
601
- onMouseDown={ Effects.Start }
602
- onTouchStart={ Effects.Start }
603
- ssPushable
604
- isRounded
605
- freeCSS={ {
606
- cursor: 'grab',
607
- userSelect: 'none'
608
- } }
609
- >
610
- <Box
611
- unitWidth={ 6 }
612
- unitHeight={ '1/2' }
613
- backgroundColor='5.layer.darker'
614
- isRounded
615
- className={ style.DragBar }
616
- />
617
- </Row.Center>
618
-
619
- <Buttons.Button.Sub.R
620
- color='cloud'
621
- ssSphere={ 2 }
622
- onClick={ () => {
623
- Sheet.close( sheetID! )
624
- } }
625
- >
626
- <FAI.Times />
627
- </Buttons.Button.Sub.R>
628
- </Row.Separate>
629
- <Box
630
- backgroundColor={ '1.layer.base' }
631
- flexSizing={ 0 }
632
- overflow={ 'auto' }
633
- { ...styles }
634
- >
635
- { $.is.function( Content ) ? <Content /> : Content }
636
- </Box>
637
- </Column>
638
- </Box>
639
- },
640
- Custom: ( params: amotify.fn.Sheet.CustomParams ) => {
641
- let {
642
- sheetID,
643
- sheetGroups,
644
- parent,
645
- gravityPoint: GPT = 22,
646
- content: Content,
647
- close_option,
648
- hold_state,
649
- overwrap,
650
- openAfter,
651
- closeAfter,
652
- ...others
653
- } = params
654
-
655
- let [ val_componentID ] = React.useState( $.uuidGen() )
656
- let Parent = $( parent )
657
- let Query = '[data-sheet-id="' + val_componentID + '"]'
658
- let ContentQuery = '[data-sheet-content="' + val_componentID + '"]'
659
-
660
- GPT = GPT!
661
- let column = GPT % 5 || 5
662
- let row = Math.ceil( GPT / 5 )
663
-
664
- const getWrapperCSS = () => {
665
- let WrapperCSS: React.CSSProperties = {}
666
- let { top,right,bottom,left,height,width } = Parent.position()
667
-
668
- if ( [ 1,2 ].includes( column ) ) {
669
- WrapperCSS.left = left
670
- } else if ( column == 3 ) {
671
- WrapperCSS.left = left + width / 2
672
- } else if ( [ 4,5 ].includes( column ) ) {
673
- WrapperCSS.left = right
674
- }
675
-
676
- if ( GPT <= 10 ) {
677
- WrapperCSS.top = top
678
- } else if ( GPT <= 15 ) {
679
- WrapperCSS.top = top + height / 2
680
- } else if ( GPT <= 25 ) {
681
- WrapperCSS.top = bottom
682
- }
683
- return WrapperCSS
684
- }
685
-
686
- let [ val_Styles,set_Styles ] = React.useState( getWrapperCSS() )
687
- const AdjustExtrusion = () => {
688
- let BaseRect = $( Query ).position()
689
- let ContentRect = $( ContentQuery ).position()
690
- let screen = $.getScreenSize()
691
-
692
- let newStyles = { ...val_Styles }
693
- if ( ContentRect.top < 0 ) {
694
- newStyles.top = BaseRect.top - ContentRect.top
695
- }
696
- if ( ContentRect.left < 0 ) {
697
- newStyles.left = BaseRect.left - ContentRect.left
698
- }
699
- if ( ContentRect.right > screen.width ) {
700
- newStyles.left = BaseRect.left - ( ContentRect.right - screen.width )
701
- }
702
- if ( ContentRect.bottom > screen.height ) {
703
- newStyles.top = BaseRect.top - ( ContentRect.bottom - screen.height )
704
- }
705
-
706
- return newStyles
707
- }
708
-
709
- React.useEffect( () => {
710
- $( Query )
711
- .await( 10 )
712
- .addClass( style.Open )
713
- .await( 250 )
714
- .callback( () => {
715
- set_Styles( AdjustExtrusion() )
716
- } )
717
-
718
- useStore.update( {
719
- key: 'customSheet-' + params.sheetID!,
720
- value: {
721
- reposition: () => {
722
- setTimeout( () => {
723
- set_Styles( AdjustExtrusion() )
724
- },200 )
725
- }
726
- }
727
- } )
728
- },[] )
729
-
730
- if ( !Parent[ 0 ] ) return null
731
-
732
- return <Box
733
- className={ [
734
- style.BB,
735
- style.CustomSheet
736
- ].join( ' ' ) }
737
- data-sheet-id={ val_componentID }
738
- transition='long'
739
- opacity='trans'
740
- position='absolute'
741
- width={ 0 }
742
- height={ 0 }
743
- flexCenter
744
- freeCSS={ val_Styles }
745
- >
746
- <Flex
747
- className={ [
748
- style.GPT,
749
- style[ 'GPT_' + GPT ],
750
- style[ 'Col_' + column ],
751
- style[ 'Row_' + row ],
752
- ].join( ' ' ) }
753
- position='absolute'
754
- >
755
- <Box
756
- flexSizing={ 'none' }
757
- data-sheet-content={ val_componentID }
758
- maxHeight={ 'viewHeight' }
759
- overflow={ 'auto' }
760
- padding={ 1 }
761
- { ...others }
762
- freeCSS={ {
763
- maxWidth: '98vw',
764
- ...others.freeCSS
765
- } }
766
- >
767
- { $.is.function( Content ) ? <Content /> : Content }
768
- </Box>
769
- </Flex>
770
- </Box>
771
- },
772
- },
773
- TapSensor: ( params: {
774
- sheetID: string
775
- delegateAroundClick?: boolean
776
- } ) => ( <Buttons.Button.Plain
777
- className={ style.TapSensor }
778
- onClick={ () => {
779
- if ( params.delegateAroundClick ?? false ) Sheet.close( params.sheetID )
780
- } }
781
- freeCSS={ {
782
- cursor: 'default'
783
- } }
784
- >
785
- <Box
786
- className={ style.TapContent }
787
- />
788
- </Buttons.Button.Plain> )
789
- }
790
-
791
- $( document )
792
- .addEvent( {
793
- eventType: 'keyup',
794
- callback: function ( event ) {
795
- let { key,metaKey } = event as any
796
- if ( key == 'Escape' || key == ',' && metaKey ) {
797
- let OpenSheets = Object.values( Comps.contents ).filter( ( elm ) => elm.open )
798
- if ( !OpenSheets.length ) return
799
- let latestSheet = OpenSheets.reduce( ( a,b ) => {
800
- return a.created_at.value > b.created_at.value ? a : b
801
- } )
802
- Sheet.close( latestSheet.params.sheetID!,key )
803
- }
804
- }
805
- } )
806
- .addEvent( {
807
- eventType: 'click',
808
- callback: function ( event ) {
809
- let customSheets = Object.values( Comps.contents ).filter( ( elm ) => elm.params.type == 'custom' )
810
- if ( !customSheets.length ) return
811
- let isParent = !!customSheets.find( ( customSheet ) => {
812
- let { params } = customSheet
813
- let Parent = $( ( params as amotify.fn.Sheet.CustomParams ).parent )
814
- let Target = $( event.target )
815
- return Parent[ 0 ] == Target[ 0 ] || !!Parent.find( Target ).length
816
- } )
817
- if ( isParent ) return
818
- if ( event.target?.closest( '.' + style.CustomSheet ) ) return
819
-
820
- customSheets.forEach( ( customSheets ) => {
821
- if ( !!customSheets.params.close_option?.aroundClick ) {
822
- Sheet.close( customSheets.params.sheetID! )
823
- }
824
- } )
825
- }
826
- } )
827
-
828
- const Sheet: amotify.fn.Sheet.Methods = {
829
- open: ( params ) => {
830
- params.sheetID = ( params.sheetID || '' ).replace( /\./g,'-' )
831
- if ( params.type == 'image' ) {
832
- let {
833
- type,
834
- sheetID = $.uuidGen(),
835
- src,
836
- ...others
837
- } = params as amotify.fn.Sheet.ImageParams
838
-
839
- Sheet.open( {
840
- type: 'normal.topCenter',
841
- sheetID: sheetID,
842
- backgroundColor: 'trans',
843
- boxShadow: 'none',
844
- ...others,
845
- close_option: {
846
- ...params.close_option,
847
- },
848
- freeCSS: {
849
- maxWidth: '96vw',
850
- transformOrigin: 'top'
851
- },
852
- content: () => {
853
- let [ val_image ] = React.useState( $.flatArray( src ) )
854
- let [ val_viewIndex,set_viewIndex ] = React.useState( 0 )
855
-
856
- let Radio: amotify.fn.Input.List.OptionParams[] = []
857
- let Slides: ReactElement[] = []
858
- val_image.forEach( ( src,index ) => {
859
- Radio.push( {
860
- value: index,
861
- label: <Img
862
- src={ $.flatArray( src )[ 0 ] }
863
- width={ 'auto' }
864
- height={ 1 }
865
- freeCSS={ {
866
- maxHeight: 12 * 3
867
- } }
868
- />
869
- } )
870
- Slides.push( <Img
871
- width={ 1 }
872
- height={ 'auto' }
873
- src={ $.flatArray( src )[ 0 ] }
874
- /> )
875
- } )
876
- return <Column
877
- gap={ 0 }
878
- >
879
- <Row.Separate
880
- gap={ 2 }
881
- padding={ 1 }
882
- backgroundColor='1.layer.base'
883
- borderTopLeftRadius={ '1.tone.primary' }
884
- borderTopRightRadius={ '1.tone.primary' }
885
- >
886
- <Input.Radio
887
- tone='border'
888
- icon={ false }
889
- value={ val_viewIndex }
890
- override='force'
891
- horizontalAlign='center'
892
- onUpdateValidValue={ ( { value } ) => {
893
- set_viewIndex( value[ 0 ] )
894
- } }
895
- cellStyles={ {
896
- borderWidth: 2,
897
- padding: '1/3'
898
- } }
899
- options={ Radio }
900
- />
901
- <Buttons.Button.Sub.R
902
- color='cloud'
903
- ssSphere={ 3 }
904
- fontSize={ '4.thirdTitle' }
905
- onClick={ () => {
906
- Sheet.close( sheetID! )
907
- } }
908
- >
909
- <FAI.Times />
910
- </Buttons.Button.Sub.R>
911
- </Row.Separate>
912
- <Layout.SwipeView
913
- slideIndex={ val_viewIndex }
914
- options={ {
915
- loop: val_image.length > 1,
916
- onSlideCallback: ( index ) => {
917
- set_viewIndex( index )
918
- }
919
- } }
920
- slides={ Slides }
921
- wrapper={ ( View ) => ( <Box
922
- borderBottomLeftRadius={ '1.tone.primary' }
923
- borderBottomRightRadius={ '1.tone.primary' }
924
- >
925
- { View }
926
- </Box> ) }
927
- />
928
- </Column>
929
- },
930
- } )
931
- return
932
- }
933
- Comps.Launch( params )
934
- },
935
- refresh: ( params,open ) => {
936
- params.sheetID = ( params.sheetID || '' ).replace( /\./g,'-' )
937
-
938
- let component = useStore.get( params.sheetID! )
939
- if ( component && component.refresh ) component.refresh( params,open )
940
- },
941
- resize: ( params ) => {
942
- params.sheetID = ( params.sheetID || '' ).replace( /\./g,'-' )
943
- let component = useStore.get( params.sheetID! )
944
- if ( component && component.resize ) component.resize( params.size )
945
- },
946
- reposition: ( sheetID ) => {
947
- let Comps = useStore.get( 'customSheet-' + sheetID )
948
- if ( Comps && Comps.reposition ) Comps.reposition()
949
- },
950
- close: function ( sheetID,et,force ) {
951
- let Content
952
- sheetID = sheetID?.replace( /\./g,'-' )
953
- Content = Comps.contents[ sheetID ]
954
-
955
- if ( !Content ) return
956
- if ( et == 'Escape' && !Content.params.close_option?.escapeKeyDown ) return
957
-
958
- {
959
- let { params } = Content
960
- let { sheetID } = params
961
-
962
- let component = useStore.get( sheetID! )
963
- component && component.close && component.close( force )
964
- }
965
- },
966
- closeGroup: ( sheetGroup ) => {
967
- sheetGroup = ( sheetGroup || '' ).replace( /\./g,'-' )
968
-
969
- for ( let [ key,value ] of Object.entries( Comps.contents ) ) {
970
- if ( value.params.sheetGroups?.includes( sheetGroup ) ) Sheet.close( key )
971
- }
972
- },
973
- closeAll: ( pageTransit ) => {
974
- for ( let [ key,value ] of Object.entries( Comps.contents ) ) {
975
- if ( pageTransit ) {
976
- if ( value.params.close_option?.pageTransit == false ) continue
977
- }
978
- Sheet.close( key,'pageTransit',true )
979
- }
980
- },
981
- Comps: {
982
- Body: ( params ) => ( <Box
983
- className={ style.BaseBody }
984
- backgroundColor='1.layer.base'
985
- borderRadius={ '1.tone.primary' }
986
- position='relative'
987
- boxShadow={ '3.remark' }
988
- transition='long'
989
- { ...params }
990
- /> ),
991
- }
992
- }
993
-
994
- export { Sheet }