svelte-common 4.6.1 → 4.6.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "4.6.1",
3
+ "version": "4.6.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,9 +21,9 @@
21
21
  "license": "BSD-2-Clause",
22
22
  "scripts": {
23
23
  "prepare": "vite build",
24
- "start": "vite dev",
24
+ "start": "vite",
25
25
  "test": "npm run test:ava && npm run test:cafe",
26
- "test:cafe": "testcafe $BROWSER:headless tests/cafe/*.js -s build/test --page-request-timeout 9000 --app-init-delay 3000 --app \"vite\"",
26
+ "test:cafe": "testcafe $BROWSER:headless tests/cafe/*.js -s build/test --page-request-timeout 9000 --app-init-delay 3000 --app vite",
27
27
  "test:ava": "ava --timeout 2m tests/*.mjs",
28
28
  "docs": "documentation readme --section=API ./src/**/*.mjs",
29
29
  "lint": "npm run lint:css && npm run lint:docs && documentation lint ./src/index.mjs",
@@ -32,27 +32,27 @@
32
32
  "preview": "vite preview"
33
33
  },
34
34
  "dependencies": {
35
- "svelte-command": "^1.1.13",
36
- "svelte-entitlement": "^1.2.23"
35
+ "svelte-command": "^1.1.18",
36
+ "svelte-entitlement": "^1.2.25"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@semantic-release/commit-analyzer": "^9.0.2",
40
40
  "@semantic-release/exec": "^6.0.3",
41
41
  "@semantic-release/release-notes-generator": "^10.0.3",
42
- "@sveltejs/vite-plugin-svelte": "^1.0.0-next.49",
43
- "ava": "^4.3.0",
42
+ "@sveltejs/vite-plugin-svelte": "^1.0.1",
43
+ "ava": "^4.3.1",
44
44
  "documentation": "^13.2.5",
45
- "mf-styling": "^1.2.22",
46
- "npm-pkgbuild": "^10.9.2",
45
+ "mf-styling": "^1.2.26",
46
+ "npm-pkgbuild": "^10.11.2",
47
47
  "semantic-release": "^19.0.3",
48
48
  "stylelint": "^14.9.1",
49
49
  "stylelint-config-standard": "^26.0.0",
50
- "svelte": "^3.48.0",
50
+ "svelte": "^3.49.0",
51
51
  "testcafe": "^1.19.0",
52
- "vite": "^2.9.12"
52
+ "vite": "^3.0.0"
53
53
  },
54
54
  "optionalDependencies": {
55
- "mf-hosting": "^1.6.3"
55
+ "mf-hosting": "^1.7.0"
56
56
  },
57
57
  "repository": {
58
58
  "type": "git",
@@ -67,8 +67,8 @@
67
67
  "${install.dir}": "build/",
68
68
  "${nginx.sites.dir}${name}.conf": "pkg/nginx.conf"
69
69
  },
70
- "hooks": "pkg/hooks.sh",
71
- "groups": "web"
70
+ "groups": "examples",
71
+ "http.base.path": "/examples"
72
72
  },
73
73
  "release": {
74
74
  "plugins": [
@@ -1,31 +1,25 @@
1
1
  <script>
2
2
  import { setContext } from "svelte";
3
+ import { DataGrid, DATA_GRID} from "../data-grid.mjs";
3
4
 
4
- export let columns = [];
5
5
  export let source = { entries: [] };
6
6
 
7
- const dataGrid = {
8
- columns,
9
- addColumn: c => {
10
- console.log("addColumn", c);
11
- columns.push(c);
12
- }
13
- };
14
-
15
- setContext("DATA_GRID", dataGrid);
16
-
7
+ const dataGrid = new DataGrid();
8
+ setContext(DATA_GRID, dataGrid);
17
9
  </script>
18
10
 
19
11
  <table>
12
+ <!--<slot/>-->
20
13
  <thead>
21
- {#each columns as column}
22
- <svelte:component this={column.component} />
14
+ {#each dataGrid.columns as column}
15
+ {column.id} {column.headerComponent}
16
+ <svelte:component this={column.headerComponent} />
23
17
  {/each}
24
18
  </thead>
25
19
  <tbody>
26
20
  {#each source.entries as entry}
27
21
  <tr>
28
- {#each columns as column}
22
+ {#each dataGrid.columns as column}
29
23
  <td>{entry[column.id]}</td>
30
24
  {/each}
31
25
  </tr>
@@ -1,17 +1,18 @@
1
1
  <script>
2
2
  import { getContext } from "svelte";
3
+ import { DATA_GRID} from "../data-grid.mjs";
3
4
 
4
5
  export let id;
5
6
 
6
- const dataGrid = getContext("DATA_GRID");
7
+ const dataGrid = getContext(DATA_GRID);
7
8
 
8
- let component;
9
+ let headerComponent;
9
10
 
10
- dataGrid.addColumn({ id, component });
11
+ dataGrid.addColumn({ id, headerComponent });
11
12
  </script>
12
13
 
13
- <th {id} bind:this={component}>
14
- <slot>
14
+ <th {id} bind:this={headerComponent}>
15
+ <slot name="header">
15
16
  {id}
16
17
  </slot>
17
18
  </th>
@@ -11,8 +11,17 @@
11
11
  heapTotal: 0,
12
12
  heapUsed: 0,
13
13
  external: 0,
14
- rss: 0
14
+ rss: 0,
15
+ arrayBuffers: 0
15
16
  };
17
+
18
+ const memSlots = [
19
+ { key: "external", title: "External" },
20
+ { key: "heapTotal", title: "Heap Total" },
21
+ { key: "heapUsed", title: "Heap Used" },
22
+ { key: "arrayBuffers", title: "Array Buffers" },
23
+ { key: "rss", title: "RSS" }
24
+ ];
16
25
  </script>
17
26
 
18
27
  <tr>
@@ -32,23 +41,11 @@
32
41
  {:else}<div class="error">down</div>{/if}
33
42
  </td>
34
43
  </tr>
35
- <tr>
36
- <td />
37
- <td>Heap Total</td>
38
- <td><Bytes value={memory.heapTotal} /></td>
39
- </tr>
40
- <tr>
41
- <td />
42
- <td>Heap Used</td>
43
- <td><Bytes value={memory.heapUsed} /></td>
44
- </tr>
45
- <tr>
46
- <td />
47
- <td>External</td>
48
- <td><Bytes value={memory.external} /></td>
49
- </tr>
50
- <tr>
51
- <td />
52
- <td>RSS</td>
53
- <td><Bytes value={memory.rss} /></td>
54
- </tr>
44
+
45
+ {#each memSlots as { key, title }}
46
+ <tr>
47
+ <td />
48
+ <td>{title}</td>
49
+ <td><Bytes value={memory[key]} /></td>
50
+ </tr>
51
+ {/each}
@@ -0,0 +1,10 @@
1
+
2
+ export const DATA_GRID = "DATA_GRID";
3
+
4
+ export class DataGrid {
5
+ columns = [];
6
+
7
+ addColumn(c) {
8
+ this.columns.push(c);
9
+ }
10
+ }
package/vite.config.js DELETED
@@ -1,47 +0,0 @@
1
- import { svelte } from "@sveltejs/vite-plugin-svelte";
2
- //import { extractFromPackage } from "npm-pkgbuild/src/module.mjs";
3
- import { defineConfig } from "vite";
4
-
5
- export default defineConfig(async ({ command, mode }) => {
6
- const { extractFromPackage } = await import(
7
- new URL("node_modules/npm-pkgbuild/src/module.mjs", import.meta.url)
8
- );
9
- const res = extractFromPackage({
10
- dir: new URL("./", import.meta.url).pathname
11
- });
12
- const first = await res.next();
13
- const pkg = first.value;
14
- const properties = pkg.properties;
15
- const base = properties["http.path"] + "/";
16
- const production = mode === "production";
17
-
18
- process.env["VITE_NAME"] = properties.name;
19
- process.env["VITE_DESCRIPTION"] = properties.description;
20
- process.env["VITE_VERSION"] = properties.version;
21
-
22
- return {
23
- base,
24
- root: "tests/app/src",
25
- worker: { format: "es" },
26
- plugins: [
27
- svelte({
28
- compilerOptions: {
29
- dev: !production
30
- }
31
- })
32
- ],
33
- optimizeDeps: {
34
- exclude: [
35
- ...Object.keys(pkg.dependencies).filter(d => d.startsWith("svelte"))
36
- ]
37
- },
38
- server: { host: true },
39
- build: {
40
- outDir: "../../../build",
41
- target: "esnext",
42
- emptyOutDir: true,
43
- minify: production,
44
- sourcemap: true
45
- }
46
- };
47
- });