@egjs/svelte-infinitegrid 3.2.5 → 4.0.1-beta.1

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.
Files changed (59) hide show
  1. package/.storybook/main.js +32 -0
  2. package/.storybook/manager.js +5 -0
  3. package/.storybook/preview.js +25 -0
  4. package/README.md +79 -155
  5. package/dist/infinitegrid.cjs.js +203 -533
  6. package/dist/infinitegrid.cjs.js.map +1 -1
  7. package/dist/infinitegrid.esm.js +198 -522
  8. package/dist/infinitegrid.esm.js.map +1 -1
  9. package/global.d.ts +8 -0
  10. package/package.json +41 -50
  11. package/public/global.css +6 -5
  12. package/public/index.html +3 -3
  13. package/rollup.config.js +7 -6
  14. package/src/InfiniteGrid.js +23 -16
  15. package/src/InfiniteGrid.svelte +91 -138
  16. package/src/consts.js +8 -13
  17. package/src/grids/FrameInfiniteGrid.js +17 -0
  18. package/src/grids/JustifiedInfiniteGrid.js +17 -0
  19. package/src/grids/MasonryInfiniteGrid.js +17 -0
  20. package/src/grids/PackingInfiniteGrid.js +17 -0
  21. package/src/index.d.ts +14 -27
  22. package/src/index.js +5 -13
  23. package/src/index.umd.js +2 -6
  24. package/src/{demo/main.js → main.ts} +1 -1
  25. package/stories/1-MasonryInfiniteGrid/0-MasonryInfiniteGrid.stories.ts +4 -0
  26. package/stories/1-MasonryInfiniteGrid/1-MasonryInfiniteGrid.stories.ts +27 -0
  27. package/stories/1-MasonryInfiniteGrid/apps/SvelteMasonryInfiniteGridApp.svelte +42 -0
  28. package/stories/2-JustifiedInfiniteGrid/0-JustifiedInfiniteGrid.stories.ts +5 -0
  29. package/stories/2-JustifiedInfiniteGrid/1-JustifiedInfiniteGrid.stories.ts +10 -0
  30. package/stories/2-JustifiedInfiniteGrid/apps/SvelteJustifiedInfiniteGridApp.svelte +43 -0
  31. package/stories/3-FrameInfiniteGrid/0-FrameInfiniteGrid.stories.ts +5 -0
  32. package/stories/3-FrameInfiniteGrid/1-FrameInfiniteGrid.stories.ts +10 -0
  33. package/stories/3-FrameInfiniteGrid/apps/SvelteFrameInfiniteGridApp.svelte +44 -0
  34. package/stories/4-PackingInfiniteGrid/0-PackingInfiniteGrid.stories.ts +5 -0
  35. package/stories/4-PackingInfiniteGrid/1-PackingInfiniteGrid.stories.ts +10 -0
  36. package/stories/4-PackingInfiniteGrid/apps/SveltePackingInfiniteGridApp.svelte +40 -0
  37. package/stories/5-DataLoading/0-DataLoading.stories.ts +7 -0
  38. package/stories/5-DataLoading/1-WaitNReady.stories.ts +10 -0
  39. package/stories/5-DataLoading/2-Placeholder.stories.ts +10 -0
  40. package/stories/5-DataLoading/3-Loading.stories.ts +10 -0
  41. package/stories/5-DataLoading/apps/SvelteLoadingApp.svelte +54 -0
  42. package/stories/5-DataLoading/apps/SveltePlaceholderApp.svelte +54 -0
  43. package/stories/5-DataLoading/apps/SvelteWaitNReadyApp.svelte +47 -0
  44. package/tsconfig.json +4 -61
  45. package/.editorconfig +0 -3
  46. package/LICENSE +0 -19
  47. package/babel.config.js +0 -10
  48. package/jest.config.js +0 -14
  49. package/rollup_start_dev.js +0 -12
  50. package/src/LoadingChecker.svelte +0 -9
  51. package/src/demo/App.svelte +0 -86
  52. package/src/demo/useFirstRender.svelte +0 -67
  53. package/src/layouts/FrameLayout.js +0 -9
  54. package/src/layouts/GridLayout.js +0 -9
  55. package/src/layouts/JustifiedLayout.js +0 -9
  56. package/src/layouts/PackingLayout.js +0 -9
  57. package/src/layouts/SquareLayout.js +0 -9
  58. package/svelte.config.js +0 -5
  59. package/test/unit/demo.spec.ts +0 -23
@@ -0,0 +1,17 @@
1
+ import InfiniteGrid from "../InfiniteGrid.svelte";
2
+ import { MasonryInfiniteGrid as GridClass } from "@egjs/infinitegrid";
3
+
4
+
5
+ let MasonryInfiniteGrid;
6
+
7
+ if (typeof InfiniteGrid === "object") {
8
+ MasonryInfiniteGrid = InfiniteGrid;
9
+ } else {
10
+ MasonryInfiniteGrid = class MasonryInfiniteGrid extends InfiniteGrid {
11
+ constructor(options) {
12
+ options.props.GridClass = GridClass;
13
+ super(options);
14
+ }
15
+ }
16
+ }
17
+ export { MasonryInfiniteGrid };
@@ -0,0 +1,17 @@
1
+ import InfiniteGrid from "../InfiniteGrid.svelte";
2
+ import { PackingInfiniteGrid as GridClass } from "@egjs/infinitegrid";
3
+
4
+
5
+ let PackingInfiniteGrid;
6
+
7
+ if (typeof InfiniteGrid === "object") {
8
+ PackingInfiniteGrid = InfiniteGrid;
9
+ } else {
10
+ PackingInfiniteGrid = class PackingInfiniteGrid extends InfiniteGrid {
11
+ constructor(options) {
12
+ options.props.GridClass = GridClass;
13
+ super(options);
14
+ }
15
+ }
16
+ }
17
+ export { PackingInfiniteGrid };
package/src/index.d.ts CHANGED
@@ -1,33 +1,20 @@
1
- import InfiniteGrid, { InfiniteGridMethods } from "@egjs/infinitegrid";
1
+ import VanillaGrid, {
2
+ FrameGridOptions, GridMethods, GridOptions, JustifiedGridOptions,
3
+ MasonryGridOptions, PackingGridOptions,
4
+ } from "@egjs/grid";
5
+ import { SvelteComponentDev } from "svelte/internal";
2
6
 
3
7
 
4
- interface ComponentOptions {
5
- target: HTMLElement;
6
- anchor?: HTMLElement | null;
7
- props?: {};
8
- hydrate?: boolean;
9
- intro?: boolean;
8
+ export default abstract class Grid<T extends GridOptions> extends SvelteComponentDev {
9
+ $$prop_def: T;
10
+ getInstance(): VanillaGrid;
10
11
  }
11
12
 
12
- interface InfiniteGridComponent extends InfiniteGridMethods {
13
- new(options: ComponentOptions): any;
14
- // client-side methods
15
- $set(props: {}): void;
16
- $on(event: string, callback: (event: CustomEvent) => void): void;
17
- $destroy(): void;
18
- // server-side methods
19
- render(props?: {}): {
20
- html: string;
21
- css: { code: string; map: string | null };
22
- head?: string;
23
- };
13
+ export default interface Grid<T extends GridOptions> extends GridMethods<Grid<T>> {
14
+ // eslint-disable-next-line semi
24
15
  }
25
16
 
26
-
27
- export default InfiniteGridComponent;
28
-
29
- export interface GridLayout extends InfiniteGridComponent {}
30
- export interface JustifiedLayout extends InfiniteGridComponent {}
31
- export interface SquareLayout extends InfiniteGridComponent {}
32
- export interface FrameLayout extends InfiniteGridComponent {}
33
- export interface PackingLayout extends InfiniteGridComponent {}
17
+ export class MasonryGrid extends Grid<MasonryGridOptions> { }
18
+ export class JustifiedGrid extends Grid<JustifiedGridOptions> { }
19
+ export class FrameGrid extends Grid<FrameGridOptions> { }
20
+ export class PackingGrid extends Grid<PackingGridOptions> { }
package/src/index.js CHANGED
@@ -1,15 +1,7 @@
1
1
  import InfiniteGrid from "./InfiniteGrid";
2
- import GridLayout from "./layouts/GridLayout";
3
- import JustifiedLayout from "./layouts/JustifiedLayout";
4
- import FrameLayout from "./layouts/FrameLayout";
5
- import SquareLayout from "./layouts/SquareLayout";
6
- import PackingLayout from "./layouts/PackingLayout";
7
2
 
8
- export default InfiniteGrid;
9
- export {
10
- GridLayout,
11
- JustifiedLayout,
12
- FrameLayout,
13
- PackingLayout,
14
- SquareLayout,
15
- };
3
+ export { InfiniteGrid };
4
+ export * from "./grids/MasonryInfiniteGrid";
5
+ export * from "./grids/JustifiedInfiniteGrid";
6
+ export * from "./grids/FrameInfiniteGrid";
7
+ export * from "./grids/PackingInfiniteGrid";
package/src/index.umd.js CHANGED
@@ -1,8 +1,4 @@
1
- import InfiniteGrid, * as modules from "./index";
1
+ import * as modules from "./index";
2
2
 
3
3
 
4
- for (const name in modules) {
5
- InfiniteGrid[name] = modules[name];
6
- }
7
-
8
- export default InfiniteGrid;
4
+ export default modules;
@@ -7,4 +7,4 @@ const app = new App({
7
7
  }
8
8
  });
9
9
 
10
- export default app;
10
+ export default app;
@@ -0,0 +1,4 @@
1
+ export default {
2
+ title: "Examples/MasonryInfiniteGrid",
3
+ };
4
+ export * from "./1-MasonryInfiniteGrid.stories";
@@ -0,0 +1,27 @@
1
+ import MasonryInfiniteGridApp from "./apps/SvelteMasonryInfiniteGridApp.svelte";
2
+ // import RawMasonryInfiniteGridApp from "!!raw-loader!./apps/SvelteMasonryInfiniteGridApp.svelte";
3
+ // import { MASONRY_GRID_CONTROLS } from "../../../../stories/templates/controls";
4
+ // import { convertPath, convertSvelteTemplate, makeArgs } from "../../../../stories/utils";
5
+ import "../../../../stories/templates/default.css";
6
+
7
+
8
+ export const MasonryInfiniteGridTemplate = (props) => ({
9
+ Component: MasonryInfiniteGridApp,
10
+ props,
11
+ });
12
+
13
+ MasonryInfiniteGridTemplate.storyName = "MasonryInfiniteGrid";
14
+ // MasonryInfiniteGridTemplate.argTypes = MASONRY_GRID_CONTROLS;
15
+ // MasonryInfiniteGridTemplate.args = {
16
+ // ...makeArgs(MasonryInfiniteGridTemplate.argTypes),
17
+ // };
18
+
19
+ // MasonryInfiniteGridTemplate.parameters = {
20
+ // preview: [
21
+ // {
22
+ // tab: "Svelte",
23
+ // template: convertSvelteTemplate(convertPath(RawMasonryInfiniteGridApp, "src", "@egjs/svelte-grid")),
24
+ // language: "html",
25
+ // },
26
+ // ],
27
+ // };
@@ -0,0 +1,42 @@
1
+ <script>
2
+ import { MasonryInfiniteGrid } from "../../../src";
3
+
4
+ let items = getItems(0, 10);
5
+
6
+ function getItems(nextGroupKey, count) {
7
+ const nextItems = [];
8
+
9
+ for (let i = 0; i < count; ++i) {
10
+ const nextKey = nextGroupKey * count + i;
11
+
12
+ nextItems.push({ groupKey: nextGroupKey, key: nextKey });
13
+ }
14
+ return nextItems;
15
+ }
16
+ </script>
17
+
18
+ <MasonryInfiniteGrid
19
+ class="container"
20
+ gap={5}
21
+ {items}
22
+ on:requestAppend={({ detail: e }) => {
23
+ const nextGroupKey = (+e.groupKey || 0) + 1;
24
+
25
+ items = [...items, ...getItems(nextGroupKey, 10)];
26
+ }}
27
+ let:visibleItems
28
+ >
29
+ {#each visibleItems as item (item.key)}
30
+ <div class="item">
31
+ <div class="thumbnail">
32
+ <img
33
+ src={`https://naver.github.io/egjs-infinitegrid/assets/image/${
34
+ (item.key % 33) + 1
35
+ }.jpg`}
36
+ alt="egjs"
37
+ />
38
+ </div>
39
+ <div class="info">{`egjs ${item.key}`}</div>
40
+ </div>
41
+ {/each}
42
+ </MasonryInfiniteGrid>
@@ -0,0 +1,5 @@
1
+ export default {
2
+ title: "Examples/JustifiedInfiniteGrid",
3
+ };
4
+ export * from "./1-JustifiedInfiniteGrid.stories";
5
+
@@ -0,0 +1,10 @@
1
+ import JustifiedInfiniteGridApp from "./apps/SvelteJustifiedInfiniteGridApp.svelte";
2
+ import "../../../../stories/templates/default.css";
3
+
4
+
5
+ export const JustifiedInfiniteGridTemplate = (props) => ({
6
+ Component: JustifiedInfiniteGridApp,
7
+ props,
8
+ });
9
+
10
+ JustifiedInfiniteGridTemplate.storyName = "JustifiedInfiniteGrid";
@@ -0,0 +1,43 @@
1
+ <script>
2
+ import { JustifiedInfiniteGrid } from "../../../src";
3
+
4
+ let items = getItems(0, 10);
5
+
6
+ function getItems(nextGroupKey, count) {
7
+ const nextItems = [];
8
+
9
+ for (let i = 0; i < count; ++i) {
10
+ const nextKey = nextGroupKey * count + i;
11
+
12
+ nextItems.push({ groupKey: nextGroupKey, key: nextKey });
13
+ }
14
+ return nextItems;
15
+ }
16
+ </script>
17
+
18
+ <JustifiedInfiniteGrid
19
+ class="container"
20
+ gap={5}
21
+ {items}
22
+ on:requestAppend={({ detail: e }) => {
23
+ const nextGroupKey = (+e.groupKey || 0) + 1;
24
+
25
+ items = [...items, ...getItems(nextGroupKey, 10)];
26
+ }}
27
+ let:visibleItems
28
+ >
29
+ {#each visibleItems as item (item.key)}
30
+ <div class="item">
31
+ <div class="thumbnail">
32
+ <img
33
+ src={`https://naver.github.io/egjs-infinitegrid/assets/image/${
34
+ (item.key % 33) + 1
35
+ }.jpg`}
36
+ alt="egjs"
37
+ data-grid-maintained-target="true"
38
+ />
39
+ </div>
40
+ <div class="info">{`egjs ${item.key}`}</div>
41
+ </div>
42
+ {/each}
43
+ </JustifiedInfiniteGrid>
@@ -0,0 +1,5 @@
1
+ export default {
2
+ title: "Examples/FrameInfiniteGrid",
3
+ };
4
+ export * from "./1-FrameInfiniteGrid.stories";
5
+
@@ -0,0 +1,10 @@
1
+ import FrameInfiniteGridApp from "./apps/SvelteFrameInfiniteGridApp.svelte";
2
+ import "../../../../stories/templates/default.css";
3
+
4
+
5
+ export const FrameInfiniteGridTemplate = (props) => ({
6
+ Component: FrameInfiniteGridApp,
7
+ props,
8
+ });
9
+
10
+ FrameInfiniteGridTemplate.storyName = "FrameInfiniteGrid";
@@ -0,0 +1,44 @@
1
+ <script>
2
+ import { FrameInfiniteGrid } from "../../../src";
3
+
4
+ let items = getItems(0, 10);
5
+
6
+ function getItems(nextGroupKey, count) {
7
+ const nextItems = [];
8
+
9
+ for (let i = 0; i < count; ++i) {
10
+ const nextKey = nextGroupKey * count + i;
11
+
12
+ nextItems.push({ groupKey: nextGroupKey, key: nextKey });
13
+ }
14
+ return nextItems;
15
+ }
16
+ </script>
17
+
18
+ <FrameInfiniteGrid
19
+ class="container"
20
+ gap={5}
21
+ frame={[
22
+ [1, 1, 2, 2, 3],
23
+ [1, 1, 4, 5, 5],
24
+ ]}
25
+ {items}
26
+ on:requestAppend={({ detail: e }) => {
27
+ const nextGroupKey = (+e.groupKey || 0) + 1;
28
+
29
+ items = [...items, ...getItems(nextGroupKey, 10)];
30
+ }}
31
+ let:visibleItems
32
+ >
33
+ {#each visibleItems as item (item.key)}
34
+ <div class="item">
35
+ <img
36
+ src={`https://naver.github.io/egjs-infinitegrid/assets/image/${
37
+ (item.key % 33) + 1
38
+ }.jpg`}
39
+ alt="egjs"
40
+ style="width: 100%; height: 100%"
41
+ />
42
+ </div>
43
+ {/each}
44
+ </FrameInfiniteGrid>
@@ -0,0 +1,5 @@
1
+ export default {
2
+ title: "Examples/PackingInfiniteGrid",
3
+ };
4
+ export * from "./1-PackingInfiniteGrid.stories";
5
+
@@ -0,0 +1,10 @@
1
+ import PackingInfiniteGridApp from "./apps/SveltePackingInfiniteGridApp.svelte";
2
+ import "../../../../stories/templates/default.css";
3
+
4
+
5
+ export const PackingInfiniteGridTemplate = (props) => ({
6
+ Component: PackingInfiniteGridApp,
7
+ props,
8
+ });
9
+
10
+ PackingInfiniteGridTemplate.storyName = "PackingInfiniteGrid";
@@ -0,0 +1,40 @@
1
+ <script>
2
+ import { PackingInfiniteGrid } from "../../../src";
3
+
4
+ let items = getItems(0, 10);
5
+
6
+ function getItems(nextGroupKey, count) {
7
+ const nextItems = [];
8
+
9
+ for (let i = 0; i < count; ++i) {
10
+ const nextKey = nextGroupKey * count + i;
11
+
12
+ nextItems.push({ groupKey: nextGroupKey, key: nextKey });
13
+ }
14
+ return nextItems;
15
+ }
16
+ </script>
17
+
18
+ <PackingInfiniteGrid
19
+ class="container"
20
+ gap={5}
21
+ {items}
22
+ on:requestAppend={({ detail: e }) => {
23
+ const nextGroupKey = (+e.groupKey || 0) + 1;
24
+
25
+ items = [...items, ...getItems(nextGroupKey, 10)];
26
+ }}
27
+ let:visibleItems
28
+ >
29
+ {#each visibleItems as item (item.key)}
30
+ <div class="item">
31
+ <img
32
+ src={`https://naver.github.io/egjs-infinitegrid/assets/image/${
33
+ (item.key % 33) + 1
34
+ }.jpg`}
35
+ alt="egjs"
36
+ style="width: 100%; height: 100%"
37
+ />
38
+ </div>
39
+ {/each}
40
+ </PackingInfiniteGrid>
@@ -0,0 +1,7 @@
1
+ export default {
2
+ title: "Examples/Data Loading",
3
+ };
4
+ export * from "./1-WaitNReady.stories";
5
+ export * from "./2-Placeholder.stories";
6
+ export * from "./3-Loading.stories";
7
+
@@ -0,0 +1,10 @@
1
+ import WaitNReadyApp from "./apps/SvelteWaitNReadyApp.svelte";
2
+ import "../../../../stories/templates/default.css";
3
+
4
+
5
+ export const WaitNReadyTemplate = (props) => ({
6
+ Component: WaitNReadyApp,
7
+ props,
8
+ });
9
+
10
+ WaitNReadyTemplate.storyName = "Wait & Ready";
@@ -0,0 +1,10 @@
1
+ import PlaceholderApp from "./apps/SveltePlaceholderApp.svelte";
2
+ import "../../../../stories/templates/default.css";
3
+
4
+
5
+ export const PlaceholderTemplate = (props) => ({
6
+ Component: PlaceholderApp,
7
+ props,
8
+ });
9
+
10
+ PlaceholderTemplate.storyName = "Placeholder";
@@ -0,0 +1,10 @@
1
+ import LoadingApp from "./apps/SvelteLoadingApp.svelte";
2
+ import "../../../../stories/templates/default.css";
3
+
4
+
5
+ export const LoadingTemplate = (props) => ({
6
+ Component: LoadingApp,
7
+ props,
8
+ });
9
+
10
+ LoadingTemplate.storyName = "Loading";
@@ -0,0 +1,54 @@
1
+ <script>
2
+ import { ITEM_TYPE } from "@egjs/infinitegrid";
3
+ import { MasonryInfiniteGrid } from "../../../src";
4
+ import { LoadingTemplate } from "../3-Loading.stories";
5
+
6
+ let items = getItems(0, 10);
7
+
8
+ function getItems(nextGroupKey, count) {
9
+ const nextItems = [];
10
+
11
+ for (let i = 0; i < count; ++i) {
12
+ const nextKey = nextGroupKey * count + i;
13
+
14
+ nextItems.push({ groupKey: nextGroupKey, key: nextKey });
15
+ }
16
+ return nextItems;
17
+ }
18
+ </script>
19
+
20
+ <MasonryInfiniteGrid
21
+ class="container"
22
+ gap={5}
23
+ useLoading={true}
24
+ {items}
25
+ on:requestAppend={({ detail: e }) => {
26
+ const nextGroupKey = (+e.groupKey || 0) + 1;
27
+
28
+ e.wait();
29
+
30
+ setTimeout(() => {
31
+ e.ready();
32
+ items = [...items, ...getItems(nextGroupKey, 10)];
33
+ }, 200);
34
+ }}
35
+ let:visibleItems
36
+ >
37
+ {#each visibleItems as item (item.key)}
38
+ {#if item.type === ITEM_TYPE.NORMAL}
39
+ <div class="item">
40
+ <div class="thumbnail">
41
+ <img
42
+ src={`https://naver.github.io/egjs-infinitegrid/assets/image/${
43
+ (item.key % 33) + 1
44
+ }.jpg`}
45
+ alt="egjs"
46
+ />
47
+ </div>
48
+ <div class="info">{`egjs ${item.key}`}</div>
49
+ </div>
50
+ {:else if item.type === ITEM_TYPE.LOADING}
51
+ <div class="loading">Loading...</div>
52
+ {/if}
53
+ {/each}
54
+ </MasonryInfiniteGrid>
@@ -0,0 +1,54 @@
1
+ <script>
2
+ import { ITEM_TYPE } from "@egjs/infinitegrid";
3
+ import { MasonryInfiniteGrid } from "../../../src";
4
+
5
+ let items = getItems(0, 10);
6
+
7
+ function getItems(nextGroupKey, count) {
8
+ const nextItems = [];
9
+
10
+ for (let i = 0; i < count; ++i) {
11
+ const nextKey = nextGroupKey * count + i;
12
+
13
+ nextItems.push({ groupKey: nextGroupKey, key: nextKey });
14
+ }
15
+ return nextItems;
16
+ }
17
+ </script>
18
+
19
+ <MasonryInfiniteGrid
20
+ class="container"
21
+ gap={5}
22
+ usePlaceholder={true}
23
+ {items}
24
+ on:requestAppend={({ detail: e }) => {
25
+ const nextGroupKey = (+e.groupKey || 0) + 1;
26
+
27
+ e.wait();
28
+ e.currentTarget.appendPlaceholders(10, nextGroupKey);
29
+
30
+ setTimeout(() => {
31
+ e.ready();
32
+ items = [...items, ...getItems(nextGroupKey, 10)];
33
+ }, 200);
34
+ }}
35
+ let:visibleItems
36
+ >
37
+ {#each visibleItems as item (item.key)}
38
+ {#if item.type === ITEM_TYPE.NORMAL}
39
+ <div class="item">
40
+ <div class="thumbnail">
41
+ <img
42
+ src={`https://naver.github.io/egjs-infinitegrid/assets/image/${
43
+ (item.key % 33) + 1
44
+ }.jpg`}
45
+ alt="egjs"
46
+ />
47
+ </div>
48
+ <div class="info">{`egjs ${item.key}`}</div>
49
+ </div>
50
+ {:else if item.type === ITEM_TYPE.VIRTUAL}
51
+ <div class="placeholder" />
52
+ {/if}
53
+ {/each}
54
+ </MasonryInfiniteGrid>
@@ -0,0 +1,47 @@
1
+ <script>
2
+ import { MasonryInfiniteGrid } from "../../../src";
3
+
4
+ let items = getItems(0, 10);
5
+
6
+ function getItems(nextGroupKey, count) {
7
+ const nextItems = [];
8
+
9
+ for (let i = 0; i < count; ++i) {
10
+ const nextKey = nextGroupKey * count + i;
11
+
12
+ nextItems.push({ groupKey: nextGroupKey, key: nextKey });
13
+ }
14
+ return nextItems;
15
+ }
16
+ </script>
17
+
18
+ <MasonryInfiniteGrid
19
+ class="container"
20
+ gap={5}
21
+ {items}
22
+ on:requestAppend={({ detail: e }) => {
23
+ const nextGroupKey = (+e.groupKey || 0) + 1;
24
+
25
+ e.wait();
26
+
27
+ setTimeout(() => {
28
+ e.ready();
29
+ items = [...items, ...getItems(nextGroupKey, 10)];;
30
+ }, 1000);
31
+ }}
32
+ let:visibleItems
33
+ >
34
+ {#each visibleItems as item (item.key)}
35
+ <div class="item">
36
+ <div class="thumbnail">
37
+ <img
38
+ src={`https://naver.github.io/egjs-infinitegrid/assets/image/${
39
+ (item.key % 33) + 1
40
+ }.jpg`}
41
+ alt="egjs"
42
+ />
43
+ </div>
44
+ <div class="info">{`egjs ${item.key}`}</div>
45
+ </div>
46
+ {/each}
47
+ </MasonryInfiniteGrid>
package/tsconfig.json CHANGED
@@ -1,63 +1,6 @@
1
1
  {
2
- "include": ["src/**/*"],
3
- "exclude": ["node_modules/*"],
4
- "compilerOptions": {
5
- /* Basic Options */
6
- "target": "ESNEXT", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
7
- "module": "ESNEXT", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
8
- "noImplicitAny": false,
9
- // "lib": [], /* Specify library files to be included in the compilation. */
10
- // "allowJs": true, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13
- // "declaration": true, /* Generates corresponding '.d.ts' file. */
14
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
- // "sourceMap": true, /* Generates corresponding '.map' file. */
16
- // "outFile": "./", /* Concatenate and emit output to single file. */
17
- // "outDir": "./", /* Redirect output structure to the directory. */
18
- // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19
- // "composite": true, /* Enable project compilation */
20
- // "removeComments": true, /* Do not emit comments to output. */
21
- // "noEmit": true, /* Do not emit outputs. */
22
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
23
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
24
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2
+ "extends": "@tsconfig/svelte/tsconfig.json",
25
3
 
26
- /* Strict Type-Checking Options */
27
- "strict": true, /* Enable all strict type-checking options. */
28
- // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
29
- // "strictNullChecks": true, /* Enable strict null checks. */
30
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
31
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
32
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
33
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
34
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
35
-
36
- /* Additional Checks */
37
- // "noUnusedLocals": true, /* Report errors on unused locals. */
38
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
39
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
40
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
41
-
42
- /* Module Resolution Options */
43
- "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
44
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
45
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
46
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
47
- // "typeRoots": [], /* List of folders to include type definitions from. */
48
- "types": ["svelte", "jest"], /* Type declaration files to be included in compilation. */
49
- "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
50
- "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
51
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
52
-
53
- /* Source Map Options */
54
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
55
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
56
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
57
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
58
-
59
- /* Experimental Options */
60
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
61
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62
- }
63
- }
4
+ "include": ["src/**/*", "./global.d.ts", "stories/**/*"],
5
+ "exclude": ["node_modules/*", "__sapper__/*", "public/*"]
6
+ }