@konomi-app/ui 2.2.0 → 2.2.2
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/overlay/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getBodyStyle, getRootStyle } from './style';
|
|
2
|
+
const ATTRIBUTE_KEY = 'data-konomi-ui-overlay';
|
|
3
|
+
const ATTRIBUTE_SHOWN = 'data-shown';
|
|
2
4
|
export class Overlay {
|
|
3
5
|
_root;
|
|
4
6
|
_shown;
|
|
@@ -6,23 +8,24 @@ export class Overlay {
|
|
|
6
8
|
constructor() {
|
|
7
9
|
this._shown = false;
|
|
8
10
|
this._disableBeforeUnload = false;
|
|
9
|
-
appendStyle();
|
|
10
11
|
const root = document.createElement('div');
|
|
11
12
|
this._root = root;
|
|
12
|
-
this._root.
|
|
13
|
+
this._root.classList.add(getRootStyle());
|
|
14
|
+
document.body.classList.add(getBodyStyle());
|
|
15
|
+
this._root.setAttribute(ATTRIBUTE_KEY, '');
|
|
13
16
|
document.body.append(root);
|
|
14
17
|
}
|
|
15
18
|
show() {
|
|
16
19
|
this._shown = true;
|
|
17
|
-
this._root.
|
|
18
|
-
document.body.
|
|
20
|
+
this._root.setAttribute(ATTRIBUTE_SHOWN, '');
|
|
21
|
+
document.body.setAttribute(ATTRIBUTE_KEY, '');
|
|
19
22
|
window.addEventListener('beforeunload', this.beforeunload);
|
|
20
23
|
this.render();
|
|
21
24
|
}
|
|
22
25
|
hide() {
|
|
23
26
|
this._shown = false;
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
this._root.removeAttribute(ATTRIBUTE_SHOWN);
|
|
28
|
+
document.body.removeAttribute(ATTRIBUTE_KEY);
|
|
26
29
|
window.removeEventListener('beforeunload', this.beforeunload);
|
|
27
30
|
this.render();
|
|
28
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["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B,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QAC5C,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAC7C,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAES,MAAM,KAAU,CAAC;IAE3B,2CAA2C;IACnC,YAAY,CAAC,KAAwB;QAC3C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,WAAW,GAAG,EAAE,CAAC;IACzB,CAAC;IAED,wDAAwD;IACjD,KAAK;QACV,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IACD,wDAAwD;IACjD,IAAI;QACT,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;CACF"}
|
package/dist/overlay/style.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const getBodyStyle: () => string;
|
|
2
|
+
export declare const getRootStyle: () => string;
|
package/dist/overlay/style.js
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const
|
|
3
|
-
const styleElement = document.querySelector('style[data-konomi-ui-overlay]') ?? document.createElement('style');
|
|
4
|
-
styleElement.dataset.konomiUiOverlay = '';
|
|
5
|
-
styleElement.textContent = `
|
|
6
|
-
${bodyStyle}
|
|
7
|
-
${rootStyle}
|
|
8
|
-
${additionalStyle ?? ''}
|
|
9
|
-
`;
|
|
10
|
-
};
|
|
11
|
-
const bodyStyle = compileString(`
|
|
12
|
-
body {
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
export const getBodyStyle = () => css `
|
|
13
3
|
overflow: visible;
|
|
14
4
|
&[data-konomi-ui-overlay] {
|
|
15
5
|
overflow: hidden;
|
|
16
6
|
}
|
|
17
|
-
|
|
18
|
-
`
|
|
19
|
-
const rootStyle = compileString(`
|
|
20
|
-
div[data-konomi-ui-overlay] {
|
|
7
|
+
`;
|
|
8
|
+
export const getRootStyle = () => css `
|
|
21
9
|
font-family: 'Yu Gothic Medium', '游ゴシック', YuGothic, 'メイリオ', 'Hiragino Kaku Gothic ProN',
|
|
22
10
|
Meiryo, sans-serif;
|
|
23
11
|
color: #356;
|
|
@@ -51,6 +39,5 @@ div[data-konomi-ui-overlay] {
|
|
|
51
39
|
opacity: 1;
|
|
52
40
|
pointer-events: all;
|
|
53
41
|
}
|
|
54
|
-
|
|
55
|
-
`);
|
|
42
|
+
`;
|
|
56
43
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/overlay/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/overlay/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,GAAG,CAAA;;;;;CAKpC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konomi-app/ui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "adachi",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"prepare": "yarn run build"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@emotion/css": "^11.11.2"
|
|
14
|
-
"sass": "^1.69.5"
|
|
13
|
+
"@emotion/css": "^11.11.2"
|
|
15
14
|
},
|
|
16
15
|
"devDependencies": {
|
|
17
16
|
"typescript": "^5.3.3"
|