amotify 0.0.19 → 0.0.21

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": "amotify",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "UI Component for React",
5
5
  "main": "dist/launch.js",
6
6
  "types": "dist/@types.d.ts",
package/src/@global.tsx CHANGED
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import * as ReactRouterDOM from 'react-router-dom';
4
- import { baseElements } from './launch';
4
+ import { launchID } from './@variables';
5
5
 
6
- import { LaunchReactApplication } from './global/LaunchReactApplication';
6
+ import {
7
+ LaunchReactApplication,
8
+ LaunchSubApplication
9
+ } from './global/LaunchReactApplication';
7
10
 
8
- export { baseElements }
11
+ export { launchID }
9
12
  const Inmemory: {
10
13
  [ key: string ]: {
11
14
  privateKey?: string
@@ -141,5 +144,6 @@ export {
141
144
  useStore,
142
145
  useRecycle,
143
146
  StyleConverter,
144
- LaunchReactApplication
147
+ LaunchReactApplication,
148
+ LaunchSubApplication
145
149
  }
@@ -27,6 +27,9 @@ html {
27
27
  transition: opacity $animation-time-middle;
28
28
  background-color: $color-dark;
29
29
  }
30
+ amotify-app {
31
+ all: initial !important;
32
+ }
30
33
  .AMOTIFY_be_origin {
31
34
  max-width: 200rem;
32
35
  min-height: $viewHeight;
package/src/config.tsx CHANGED
@@ -28,7 +28,10 @@ export const deviceIdentifier = () => {
28
28
  }
29
29
 
30
30
 
31
- import { ColorKeys } from './@variables';
31
+ import {
32
+ launchID,
33
+ ColorKeys
34
+ } from './@variables';
32
35
 
33
36
  export const SetThemeColorTag = () => {
34
37
  let hex = '#45515c';
@@ -62,6 +65,7 @@ ColorKeys.forEach( ( key ) => {
62
65
 
63
66
  export const defaultConfig: amotify.config.Methods = {
64
67
  version: Version,
68
+ launchID,
65
69
  tone: 'default',
66
70
  darkMode: 'light',
67
71
  themeColor: 'comun',
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import {
3
- baseElements,
4
- LaunchReactApplication,
3
+ launchID,
4
+ LaunchSubApplication,
5
5
  useStore
6
6
  } from '@global';
7
7
 
@@ -92,9 +92,9 @@ const Loader: amotify.fn.Loader.Methods = {
92
92
  }
93
93
  export { Loader }
94
94
 
95
- LaunchReactApplication( {
95
+ LaunchSubApplication( {
96
96
  isRoot: false,
97
- baseElement: '#' + baseElements.loaderID,
97
+ baseElement: '#' + launchID + ' .AMOTIFY_be_loader',
98
98
  reactElement: <>
99
99
  <Top />
100
100
  <Corner />
@@ -1,7 +1,7 @@
1
1
  import {
2
- baseElements,
2
+ launchID,
3
3
  React,
4
- LaunchReactApplication,
4
+ LaunchSubApplication,
5
5
  useStore
6
6
  } from '@global';
7
7
  import {
@@ -68,10 +68,10 @@ const Comps = {
68
68
  created_at: $.Time()
69
69
  }
70
70
 
71
- $( '#' + baseElements.sheetID )
71
+ $( '#' + launchID + ' .AMOTIFY_be_sheet' )
72
72
  .append( `<div id="Sheet-${ params.sheetID }"></div>` )
73
73
  .callback( () => {
74
- LaunchReactApplication( {
74
+ LaunchSubApplication( {
75
75
  isRoot: false,
76
76
  baseElement: '#Sheet-' + params.sheetID,
77
77
  reactElement: Content,
@@ -186,7 +186,7 @@ const Comps = {
186
186
  .abort()
187
187
  .addClass( style.FixHeight )
188
188
  .callback( () => {
189
- $( '#' + baseElements.rootID + '.AMOTIFY_be_origin' )
189
+ $( '#' + launchID + ' .AMOTIFY_be_root' )
190
190
  .addClass( style.FixScroll )
191
191
  [ 0 ].scrollTop = Comps.mainSheetScrolls;
192
192
  } )
@@ -207,7 +207,7 @@ const Comps = {
207
207
  .removeClass( style.FixHeight )
208
208
  .callback( ( html ) => {
209
209
  html[ 0 ].scrollTop = Comps.mainSheetScrolls | 0;
210
- $( '#' + baseElements.rootID )[ 0 ].scrollTop = 0;
210
+ $( '#' + launchID + ' .AMOTIFY_be_root' )[ 0 ].scrollTop = 0;
211
211
  } );
212
212
  }
213
213
  } );
@@ -1,6 +1,6 @@
1
1
  import {
2
- baseElements,
3
- LaunchReactApplication,
2
+ launchID,
3
+ LaunchSubApplication,
4
4
  useStore,
5
5
  React
6
6
  } from '@global';
@@ -205,9 +205,9 @@ const SnackBarsWrap: React.FC<{}> = () => {
205
205
  />;
206
206
  }
207
207
 
208
- LaunchReactApplication( {
208
+ LaunchSubApplication( {
209
209
  isRoot: false,
210
- baseElement: '#' + baseElements.snackbarID,
210
+ baseElement: '#' + launchID + ' .AMOTIFY_be_snackbar',
211
211
  reactElement: <SnackBarsWrap />,
212
212
  nonRouter: true
213
213
  } );
@@ -1,11 +1,13 @@
1
- import { baseElements } from '@global';
1
+ import { launchID } from '@global';
2
2
  import React from 'react';
3
3
  import ReactDOMCLient from 'react-dom/client';
4
4
  import * as ReactRouterDom from 'react-router-dom';
5
5
 
6
- export const LaunchReactApplication: amotify.global.LaunchReactApplicationParams = ( props ) => {
6
+ export const LaunchSubApplication = ( props: amotify.global.LaunchReactApplicationInput & {
7
+ baseElement?: HTMLElement | string
8
+ } ) => {
7
9
  let {
8
- baseElement = '#' + baseElements.rootID,
10
+ baseElement = '#' + launchID + ' .AMOTIFY_be_root',
9
11
  reactElement,
10
12
  nonRouter = false,
11
13
  isRoot = true,
@@ -32,11 +34,38 @@ export const LaunchReactApplication: amotify.global.LaunchReactApplicationParams
32
34
  if ( isRoot ) {
33
35
  $( 'body' ).addClass( 'AMOTIFY_be_body' );
34
36
  base.addClass( 'AMOTIFY_be AMOTIFY_be_root AMOTIFY_be_origin' );
35
- if ( base[ 0 ].id ) {
36
- baseElements.rootID = base[ 0 ].id;
37
- } else {
38
- base.setAttribute( 'id',baseElements.rootID );
39
- }
37
+ }
38
+
39
+ ReactDOMCLient.createRoot( base[ 0 ] ).render( <>{ reactDom }</> );
40
+ }
41
+ export const LaunchReactApplication = ( props: amotify.global.LaunchReactApplicationInput ) => {
42
+ let {
43
+ reactElement,
44
+ nonRouter = false,
45
+ isRoot = true,
46
+ appearances
47
+ } = props;
48
+ let base = $( '#' + launchID + ' .AMOTIFY_be_root' );
49
+ if ( !base[ 0 ] || !reactElement ) return;
50
+ if ( appearances ) {
51
+ let {
52
+ roundness,
53
+ tone,
54
+ themeColor,
55
+ darkMode
56
+ } = appearances;
57
+
58
+ if ( $.is.exist( roundness ) ) amotify.config.update.roundness( roundness! );
59
+ if ( $.is.exist( tone ) ) amotify.config.update.tone( tone! );
60
+ if ( $.is.exist( themeColor ) ) amotify.config.update.themeColor( themeColor! );
61
+ if ( $.is.exist( darkMode ) ) amotify.config.update.darkMode( darkMode! );
62
+ }
63
+
64
+ let reactDom = nonRouter ? reactElement : <ReactRouterDom.BrowserRouter children={ reactElement } />;
65
+
66
+ if ( isRoot ) {
67
+ $( 'body' ).addClass( 'AMOTIFY_be_body' );
68
+ base.addClass( 'AMOTIFY_be AMOTIFY_be_root AMOTIFY_be_origin' );
40
69
  }
41
70
 
42
71
  ReactDOMCLient.createRoot( base[ 0 ] ).render( <>{ reactDom }</> );
package/src/launch.tsx CHANGED
@@ -4,17 +4,17 @@ import '../@types/_';
4
4
  if ( !global.$ ) console.log( `%c※can not find global.$,please read Jsmin to launch amotify.`,'color:orange;' );
5
5
 
6
6
  import { launchID } from './@variables';
7
- export const baseElements = {
8
- rootID: 'ROOT_' + launchID,
9
- loaderID: 'LOADER_' + launchID,
10
- sheetID: 'SHEET_' + launchID,
11
- snackbarID: 'SNACKBARS_' + launchID
12
- }
13
7
 
14
8
  let publicURI = 'https://public.comun.jp/';
15
9
  export { publicURI }
16
10
  import './preload';
17
11
 
12
+ import {
13
+ deviceIdentifier,
14
+ defaultConfig,
15
+ SetThemeColorTag
16
+ } from './config';
17
+
18
18
  import './@jsminAmotifyExtension/_';
19
19
  import {
20
20
  React,
@@ -65,12 +65,6 @@ import {
65
65
  Cropper,
66
66
  } from '@fn';
67
67
 
68
- import {
69
- deviceIdentifier,
70
- defaultConfig,
71
- SetThemeColorTag
72
- } from './config';
73
-
74
68
  const amotify: amotify = {
75
69
  config: defaultConfig,
76
70
  global: {
@@ -87,13 +81,12 @@ const amotify: amotify = {
87
81
  }
88
82
 
89
83
  export { amotify }
90
- global.amotify = amotify;
91
- Object.freeze( global.amotify.atoms );
92
- Object.freeze( global.amotify.mols );
93
- Object.freeze( global.amotify.orgs );
94
- Object.freeze( global.amotify.temps );
95
- Object.freeze( global.amotify.fn );
96
- Object.freeze( global.amotify );
84
+
85
+ if ( global.amotify ) {
86
+ global[ ( 'amotify_' + launchID ) as 'amotify' ] = amotify;
87
+ } else {
88
+ global.amotify = amotify;
89
+ }
97
90
 
98
91
  import './@styles/@app.scss';
99
92
 
package/src/preload.tsx CHANGED
@@ -1,57 +1,59 @@
1
- import { baseElements } from './launch';
1
+ import { launchID } from './@variables';
2
2
 
3
3
  let tags: Jsmin.CreateElement.Args[] = [
4
4
  {
5
- tag: 'meta',parent: document.head,attr: {
5
+ tag: 'meta',
6
+ parent: document.head,
7
+ attr: {
6
8
  name: 'viewport',content: 'width=device-width,initial-scale=1.0,maximum-scale=5.0,minimum-scale=1.0,viewport-fit=cover'
7
9
  },
8
10
  },{
9
- tag: 'link',parent: document.head,attr: {
11
+ tag: 'link',
12
+ parent: document.head,
13
+ attr: {
10
14
  href: 'https://fonts.googleapis.com',rel: 'preconnect',async: true
11
15
  }
12
16
  },{
13
- tag: 'link',parent: document.head,attr: {
17
+ tag: 'link',
18
+ parent: document.head,
19
+ attr: {
14
20
  href: 'https://fonts.gstatic.com',rel: 'preconnect',async: true
15
21
  }
16
22
  },
17
23
  {
18
- tag: 'link',parent: document.head,attr: {
24
+ tag: 'link',
25
+ parent: document.head,
26
+ attr: {
19
27
  href: 'https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap',
20
28
  rel: 'stylesheet',
21
29
  async: true
22
30
  }
23
31
  },{
24
- tag: 'link',parent: document.head,attr: {
32
+ tag: 'link',
33
+ parent: document.head,
34
+ attr: {
25
35
  href: 'https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;400;600&display=swap',
26
36
  rel: 'stylesheet',
27
37
  async: true
28
38
  }
29
39
  },{
30
- tag: 'meta',parent: document.head,attr: {
31
- name: 'theme-color',
32
- content: '#45515c',
33
- },
34
- id: 'ThemeColorMetaTag'
35
- },{
36
- parent: document.body,
37
- id: baseElements.sheetID,
38
- className: 'AMOTIFY_be AMOTIFY_be_sheet',
39
- },{
40
- parent: document.body,
41
- id: baseElements.snackbarID,
42
- className: 'AMOTIFY_be AMOTIFY_be_snackbar',
43
- },{
44
- parent: document.body,
45
- id: baseElements.loaderID,
46
- className: 'AMOTIFY_be AMOTIFY_be_loader',
40
+ tag: 'meta',
41
+ parent: document.head,
42
+ id: 'ThemeColorMetaTag',
43
+ attr: { name: 'theme-color',content: '#45515c' },
47
44
  },{
48
45
  parent: document.body,
49
- id: baseElements.rootID,
50
- className: 'AMOTIFY_be AMOTIFY_be_root',
51
- },
46
+ tag: 'amotify-app',
47
+ id: launchID,
48
+ html: `
49
+ <div class="AMOTIFY_be AMOTIFY_be_sheet"></div>
50
+ <div class="AMOTIFY_be AMOTIFY_be_snackbar"></div>
51
+ <div class="AMOTIFY_be AMOTIFY_be_loader"></div>
52
+ <div class="AMOTIFY_be AMOTIFY_be_root"></div>
53
+ `
54
+ }
52
55
  ];
53
56
  for ( let tag of tags ) {
54
- let { id } = tag;
55
- if ( id && $( '#' + id )[ 0 ] ) continue;
57
+ if ( tag.id && $( '#' + tag.id )[ 0 ] ) continue;
56
58
  $.createElement( tag );
57
59
  }