create-outsystems-astro 0.7.0 → 0.7.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.
@@ -6,6 +6,7 @@ import { useState } from "preact/hooks";
6
6
  import AstroLogo from "../../images/astro.png?url";
7
7
  import OutSystemsLogo from "../../images/outsystems.png?url";
8
8
  import { Operation, setCounterCount } from "../../lib/setCounterCount";
9
+ import { setupStore } from "../../stores/demo";
9
10
 
10
11
  interface DemoProps {
11
12
  children: ComponentChildren;
@@ -28,14 +29,12 @@ export default function Demo({
28
29
  setCount((i) => setCounterCount(i, Operation.Subtract));
29
30
 
30
31
  const showParentMessage = () => {
31
- if (typeof window !== "undefined") {
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- (window as any)[showMessage]?.(count);
34
- }
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ (window as any)[showMessage](count);
35
34
  };
36
35
 
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- const nanoStoreValue = useStore((window as any).Stores?.["preactStore"]);
36
+ const store = setupStore("preactStore");
37
+ const nanoStoreValue = useStore(store);
39
38
 
40
39
  return (
41
40
  <>
@@ -5,6 +5,7 @@ import { useState } from "react";
5
5
  import AstroLogo from "../../images/astro.png?url";
6
6
  import OutSystemsLogo from "../../images/outsystems.png?url";
7
7
  import { Operation, setCounterCount } from "../../lib/setCounterCount";
8
+ import { setupStore } from "../../stores/demo";
8
9
 
9
10
  interface DemoProps {
10
11
  children: React.ReactNode;
@@ -29,8 +30,9 @@ export default function Demo({
29
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
31
  const showParentMessage = () => (window as any)[showMessage](count);
31
32
 
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- const nanoStoreValue = useStore((window as any).Stores["reactStore"]);
33
+ const store = setupStore("reactStore");
34
+
35
+ const nanoStoreValue = useStore(store);
34
36
 
35
37
  return (
36
38
  <>
@@ -2,6 +2,7 @@
2
2
  import AstroLogo from "../../images/astro.png?url";
3
3
  import OutSystemsLogo from "../../images/outsystems.png?url";
4
4
  import { Operation, setCounterCount } from "../../lib/setCounterCount";
5
+ import { setupStore } from "../../stores/demo";
5
6
 
6
7
  export let initialCount: number;
7
8
  export let showMessage: string;
@@ -21,8 +22,7 @@
21
22
  (window as any)[showMessage](count);
22
23
  };
23
24
 
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- const nanoStoreValue = (window as any).Stores["svelteStore"];
25
+ const nanoStoreValue = setupStore("svelteStore");
26
26
  </script>
27
27
 
28
28
  <slot name="header" />
@@ -5,6 +5,7 @@ import { useStore } from "@nanostores/vue";
5
5
  import AstroLogo from "../../images/astro.png?url";
6
6
  import OutSystemsLogo from "../../images/outsystems.png?url";
7
7
  import { Operation, setCounterCount } from "../../lib/setCounterCount";
8
+ import { setupStore } from "../../stores/demo";
8
9
 
9
10
  const props = defineProps<{
10
11
  initialCount: number;
@@ -26,8 +27,8 @@ const showParentMessage = () => {
26
27
  (window as any)[props.showMessage](count.value);
27
28
  };
28
29
 
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- const nanoStoreValue = useStore((window as any).Stores["vueStore"]);
30
+ const store = setupStore("vueStore");
31
+ const nanoStoreValue = useStore(store);
31
32
  </script>
32
33
 
33
34
  <template>
@@ -34,7 +34,7 @@ const showMessage = "showMessage";
34
34
  </div>
35
35
  <hr />
36
36
  <DemoComponent
37
- client:visible
37
+ client:load
38
38
  initialCount={initialCount}
39
39
  showMessage={showMessage}
40
40
  />
@@ -8,12 +8,11 @@ const showMessage = "showMessage";
8
8
  <head>
9
9
  <link href={styles} rel="stylesheet" />
10
10
  <script>
11
- import { atom } from "nanostores";
11
+ import { setupStore } from "../../stores/demo";
12
+ setupStore("preactStore");
12
13
  window["showMessage"] = (count) => {
13
14
  document.getElementById("counter").textContent = count;
14
15
  };
15
- window.Stores = [];
16
- window.Stores["preactStore"] = atom("Test Value");
17
16
  document.addEventListener("DOMContentLoaded", function () {
18
17
  const input = document.getElementById("store");
19
18
  input.value = window.Stores["preactStore"].get();
@@ -8,12 +8,11 @@ const showMessage = "showMessage";
8
8
  <head>
9
9
  <link href={styles} rel="stylesheet" />
10
10
  <script>
11
- import { atom } from "nanostores";
11
+ import { setupStore } from "../../stores/demo";
12
+ setupStore("reactStore");
12
13
  window["showMessage"] = (count) => {
13
14
  document.getElementById("counter").textContent = count;
14
15
  };
15
- window.Stores = [];
16
- window.Stores["reactStore"] = atom("Test Value");
17
16
  document.addEventListener("DOMContentLoaded", function () {
18
17
  const input = document.getElementById("store");
19
18
  input.value = window.Stores["reactStore"].get();
@@ -8,12 +8,11 @@ const showMessage = "showMessage";
8
8
  <head>
9
9
  <link href={styles} rel="stylesheet" />
10
10
  <script>
11
- import { atom } from "nanostores";
11
+ import { setupStore } from "../../stores/demo";
12
+ setupStore("svelteStore");
12
13
  window["showMessage"] = (count) => {
13
14
  document.getElementById("counter").textContent = count;
14
15
  };
15
- window.Stores = [];
16
- window.Stores["svelteStore"] = atom("Test Value");
17
16
  document.addEventListener("DOMContentLoaded", function () {
18
17
  const input = document.getElementById("store");
19
18
  input.value = window.Stores["svelteStore"].get();
@@ -8,12 +8,11 @@ const showMessage = "showMessage";
8
8
  <head>
9
9
  <link href={styles} rel="stylesheet" />
10
10
  <script>
11
- import { atom } from "nanostores";
11
+ import { setupStore } from "../../stores/demo";
12
+ setupStore("vueStore");
12
13
  window["showMessage"] = (count) => {
13
14
  document.getElementById("counter").textContent = count;
14
15
  };
15
- window.Stores = [];
16
- window.Stores["vueStore"] = atom("Test Value");
17
16
  document.addEventListener("DOMContentLoaded", function () {
18
17
  const input = document.getElementById("store");
19
18
  input.value = window.Stores["vueStore"].get();
@@ -0,0 +1,14 @@
1
+ import { atom } from "nanostores";
2
+
3
+ export function setupStore(name: string) {
4
+ // @ts-expect-error: Stores does not exist on window
5
+ if (window.Stores === undefined) {
6
+ // @ts-expect-error: Stores does not exist on window
7
+ window.Stores = [];
8
+ // @ts-expect-error: Stores does not exist on window
9
+ window.Stores[name] = atom("Test Value");
10
+ }
11
+
12
+ // @ts-expect-error: Stores does not exist on window
13
+ return window.Stores[name];
14
+ }