lupine.components 1.0.21 → 1.0.23
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.tsx +2 -2
- package/src/components/float-window.tsx +2 -2
- package/src/components/html-var.tsx +1 -1
- package/src/components/tabs.tsx +3 -3
- package/src/lib/document-ready.ts +0 -2
- package/src/lib/dynamical-load.ts +4 -8
- package/src/lib/lite-dom.ts +0 -2
- package/src/lib/message-hub.ts +0 -1
- package/src/lib/path-utils.ts +6 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CssProps, RefProps, VNode,
|
|
1
|
+
import { CssProps, RefProps, VNode, mountInnerComponent } from 'lupine.web';
|
|
2
2
|
|
|
3
3
|
export type ActionSheetCloseProps = () => void;
|
|
4
4
|
|
|
@@ -147,7 +147,7 @@ export class ActionSheet {
|
|
|
147
147
|
base.style.position = 'fixed';
|
|
148
148
|
base.style.zIndex = zIndex || 'var(--layer-actionsheet-window)';
|
|
149
149
|
document.body.appendChild(base);
|
|
150
|
-
await
|
|
150
|
+
await mountInnerComponent(base, component);
|
|
151
151
|
return handleClose;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CssProps, RefProps, VNode,
|
|
1
|
+
import { CssProps, RefProps, VNode, mountInnerComponent } from 'lupine.web';
|
|
2
2
|
import { stopPropagation } from '../lib';
|
|
3
3
|
|
|
4
4
|
export type FloatWindowCloseProps = () => void;
|
|
@@ -184,7 +184,7 @@ export class FloatWindow {
|
|
|
184
184
|
base.style.position = 'fixed';
|
|
185
185
|
base.style.zIndex = zIndex || 'var(--layer-float-window)';
|
|
186
186
|
document.body.appendChild(base);
|
|
187
|
-
await
|
|
187
|
+
await mountInnerComponent(base, component);
|
|
188
188
|
return handleClose;
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -6,7 +6,7 @@ export const HtmlVar = (initial?: string | VNode<any>): HtmlVarResult => {
|
|
|
6
6
|
let _dirty = false;
|
|
7
7
|
const waitUpdate = async (value: string | VNode<any>) => {
|
|
8
8
|
if (!ref.current) return;
|
|
9
|
-
await ref.
|
|
9
|
+
await ref.mountInnerComponent!(value);
|
|
10
10
|
_dirty = false;
|
|
11
11
|
};
|
|
12
12
|
const ref: RefProps = {
|
package/src/components/tabs.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefProps, VNode,
|
|
1
|
+
import { RefProps, VNode, mountInnerComponent } from 'lupine.web';
|
|
2
2
|
import { stopPropagation } from '../lib';
|
|
3
3
|
|
|
4
4
|
export type TabsHookProps = {
|
|
@@ -86,8 +86,8 @@ export const Tabs = ({ pages, defaultIndex, topClassName, pagePadding, hook: ref
|
|
|
86
86
|
ref.$(`.pages[data-refid=${ref.id}]`).insertBefore(newPage, pages[newPageIndex]);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
await
|
|
90
|
-
await
|
|
89
|
+
await mountInnerComponent(newTab, newTab2);
|
|
90
|
+
await mountInnerComponent(newPage, page);
|
|
91
91
|
updateIndex(newPageIndex);
|
|
92
92
|
};
|
|
93
93
|
const createTabHeader = (title: string, className: string) => {
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* for my-apps
|
|
3
3
|
*/
|
|
4
4
|
export class DynamicalLoad {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
loadScript(url: string, idForReplace?: string, removeOnLoaded = false): Promise<string> {
|
|
5
|
+
static loadScript(url: string, idForReplace?: string, removeOnLoaded = false): Promise<string> {
|
|
8
6
|
return new Promise((resolve, reject) => {
|
|
9
7
|
if (this.existScript(url, idForReplace)) {
|
|
10
8
|
resolve(url);
|
|
@@ -36,7 +34,7 @@ export class DynamicalLoad {
|
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
// TODO: more accuracy
|
|
39
|
-
existScript(url: string, id?: string) {
|
|
37
|
+
static existScript(url: string, id?: string) {
|
|
40
38
|
if (id) {
|
|
41
39
|
const scriptDom = document.getElementById(id);
|
|
42
40
|
if (scriptDom && scriptDom.tagName === 'SCRIPT') {
|
|
@@ -56,7 +54,7 @@ export class DynamicalLoad {
|
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
loadCss(url: string, idForReplace?: string): Promise<string> {
|
|
57
|
+
static loadCss(url: string, idForReplace?: string): Promise<string> {
|
|
60
58
|
return new Promise((resolve, reject) => {
|
|
61
59
|
if (this.existCss(url, idForReplace)) {
|
|
62
60
|
resolve(url);
|
|
@@ -90,7 +88,7 @@ export class DynamicalLoad {
|
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
// TODO: more accuracy
|
|
93
|
-
existCss(url: string, id?: string) {
|
|
91
|
+
static existCss(url: string, id?: string) {
|
|
94
92
|
if (id) {
|
|
95
93
|
const linkDom = document.getElementById(id);
|
|
96
94
|
if (linkDom && linkDom.tagName === 'LINK') {
|
|
@@ -134,5 +132,3 @@ export class DynamicalLoad {
|
|
|
134
132
|
// }
|
|
135
133
|
// }
|
|
136
134
|
}
|
|
137
|
-
|
|
138
|
-
export default new DynamicalLoad();
|
package/src/lib/lite-dom.ts
CHANGED
package/src/lib/message-hub.ts
CHANGED
package/src/lib/path-utils.ts
CHANGED
|
@@ -21,7 +21,12 @@ export const pathUtils = {
|
|
|
21
21
|
p = p.replace(/\/+$/, '');
|
|
22
22
|
const idx = p.lastIndexOf('/');
|
|
23
23
|
let base = idx === -1 ? p : p.slice(idx + 1);
|
|
24
|
-
if (ext
|
|
24
|
+
if (!ext) {
|
|
25
|
+
const lastPot = p.lastIndexOf('.');
|
|
26
|
+
if (lastPot >= 0) {
|
|
27
|
+
base = base.slice(0, lastPot);
|
|
28
|
+
}
|
|
29
|
+
} else if (ext && base.endsWith(ext)) {
|
|
25
30
|
base = base.slice(0, -ext.length);
|
|
26
31
|
}
|
|
27
32
|
return base;
|