framework7-svelte 7.0.0-beta.11 → 7.0.0-beta.16

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.
@@ -5,6 +5,7 @@ import { SvelteComponentTyped } from 'svelte';
5
5
 
6
6
 
7
7
  interface ViewProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap['div']> {
8
+ initRouterOnTabShow?: boolean;
8
9
  tab ?: boolean;
9
10
  tabActive ?: boolean;
10
11
  name ?: string;
@@ -18,7 +18,9 @@
18
18
 
19
19
  const emit = createEmitter(createEventDispatcher, $$props);
20
20
 
21
- const { main, tab, tabActive, browserHistoryInitialMatch = true } = $$props;
21
+ const { main, tab, tabActive, browserHistoryInitialMatch = true, initRouterOnTabShow } = $$props;
22
+
23
+ const shouldInitRouter = !(initRouterOnTabShow && tab && !tabActive);
22
24
 
23
25
  let initialPage;
24
26
  let initialRoute;
@@ -54,7 +56,7 @@
54
56
  instance: f7View,
55
57
  };
56
58
  app.f7routers.views.push(routerData);
57
- if (f7View && f7View.router && (url || main)) {
59
+ if (shouldInitRouter && f7View && f7View.router && (url || main)) {
58
60
  const initialData = getRouterInitialComponent(f7View.router);
59
61
  initialPage = initialData.initialPage;
60
62
  initialRoute = initialData.initialRoute;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Framework7 Svelte 7.0.0-beta.11
2
+ * Framework7 Svelte 7.0.0-beta.16
3
3
  * Build full featured iOS & Android apps using Framework7 & Svelte
4
4
  * https://framework7.io/svelte/
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Released under the MIT License
9
9
  *
10
- * Released on: February 17, 2022
10
+ * Released on: April 12, 2022
11
11
  */
12
12
  import Framework7Svelte from './shared/plugin.js';
13
13
  import { f7, f7ready, theme, app } from './shared/f7.js';
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "framework7-svelte",
3
- "version": "7.0.0-beta.11",
3
+ "version": "7.0.0-beta.16",
4
4
  "description": "Build full featured iOS & Android apps using Framework7 & Svelte",
5
5
  "type": "module",
6
+ "svelte": "./framework7-svelte.js",
6
7
  "exports": {
7
8
  ".": "./framework7-svelte.js",
8
9
  "./components/*": "./components/*"
@@ -23,6 +24,7 @@
23
24
  "ipad",
24
25
  "apple",
25
26
  "phonegap",
27
+ "capacitor",
26
28
  "native",
27
29
  "touch",
28
30
  "appstore",
package/shared/f7.js CHANGED
@@ -1,27 +1,27 @@
1
1
  /* eslint-disable import/no-mutable-exports */
2
2
  // eslint-disable-next-line
3
- import Framework7 from 'framework7/lite';
4
3
  import { extend, unsetRouterIds } from './utils.js';
5
4
  let f7;
6
- const theme = {}; // eslint-disable-next-line
5
+ const theme = {};
6
+ /* eslint-disable no-restricted-globals */
7
7
 
8
- if (!Framework7.__app__) {
9
- // eslint-disable-next-line
10
- Framework7.__app__ = {
11
- f7: undefined,
12
- f7events: undefined,
13
- theme: {},
14
- f7routers: {
15
- views: [],
16
- tabs: [],
17
- modals: null
18
- }
19
- };
8
+ const app = typeof window !== 'undefined' && window.Framework7ComponentsApp ? window.Framework7ComponentsApp : {
9
+ Framework7: undefined,
10
+ f7: undefined,
11
+ f7events: undefined,
12
+ theme: {},
13
+ f7routers: {
14
+ views: [],
15
+ tabs: [],
16
+ modals: null
17
+ }
18
+ };
19
+
20
+ if (typeof window !== 'undefined') {
21
+ window.Framework7ComponentsApp = app;
20
22
  }
23
+ /* eslint-enable no-restricted-globals */
21
24
 
22
- const {
23
- __app__: app
24
- } = Framework7;
25
25
 
26
26
  app.setInstance = instance => {
27
27
  f7 = instance;
@@ -51,7 +51,7 @@ const cleanup = () => {
51
51
  };
52
52
 
53
53
  const f7initEvents = () => {
54
- app.f7events = new Framework7.Events();
54
+ app.f7events = new app.Framework7.Events();
55
55
  };
56
56
 
57
57
  const f7init = (rootEl, params = {}, init = true) => {
@@ -63,7 +63,7 @@ const f7init = (rootEl, params = {}, init = true) => {
63
63
  if (!f7Params.routes) f7Params.routes = [];
64
64
 
65
65
  if (f7Params.userAgent && (f7Params.theme === 'auto' || !f7Params.theme)) {
66
- const device = Framework7.getDevice({
66
+ const device = app.Framework7.getDevice({
67
67
  userAgent: f7Params.userAgent
68
68
  }, true);
69
69
  app.theme.ios = !!device.ios;
@@ -75,7 +75,7 @@ const f7init = (rootEl, params = {}, init = true) => {
75
75
  if (app.f7 && typeof window !== 'undefined') return; // eslint-disable-next-line
76
76
 
77
77
  if (typeof window === 'undefined') cleanup();
78
- const instance = new Framework7(f7Params);
78
+ const instance = new app.Framework7(f7Params);
79
79
  app.f7 = instance;
80
80
  f7 = instance;
81
81
  app.setInstance(instance);
package/shared/plugin.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // eslint-disable-next-line
2
- import Framework7 from 'framework7/lite';
3
2
  import componentsRouter from './components-router.js';
4
3
  import { f7ready, theme, app, f7initEvents, setTheme } from './f7.js';
5
4
  const Framework7Svelte = {
@@ -7,6 +6,8 @@ const Framework7Svelte = {
7
6
  installed: false,
8
7
 
9
8
  install(params = {}) {
9
+ const Framework7 = this;
10
+ app.Framework7 = Framework7;
10
11
  if (Framework7Svelte.installed) return;
11
12
  Framework7Svelte.installed = true;
12
13
  f7initEvents();