@typed-grid-areas/vue 0.1.0 → 0.1.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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, h, onMounted, onUpdated, ref, } from "vue";
2
- import { createSlotCheck, gridMarkup, isDevelopment } from "typed-grid-areas/adapter";
2
+ import { createSlotCheck, gridMarkup } from "typed-grid-areas/adapter";
3
3
  import { renderAsChild } from "./asChild.js";
4
4
  import { useGridStyle } from "./gridStyles.js";
5
5
  /**
@@ -33,20 +33,29 @@ function createGrid(definition) {
33
33
  useGridStyle(definition);
34
34
  // In development, check the slots after mounting and after every update.
35
35
  const gridRef = ref(null);
36
- if (isDevelopment()) {
37
- const checkSlots = createSlotCheck(definition, {
38
- strayChildRemedy: "make it a slot with as-child",
39
- });
40
- const check = () => {
41
- if (gridRef.value !== null) {
42
- for (const warning of checkSlots(gridRef.value)) {
43
- // eslint-disable-next-line no-console
44
- console.warn(warning);
36
+ // Written out, not `isDevelopment()`, so production builds drop the check.
37
+ try {
38
+ if (process.env.NODE_ENV === "development") {
39
+ const checkSlots = createSlotCheck(definition, {
40
+ strayChildRemedy: "make it a slot with as-child",
41
+ });
42
+ const check = () => {
43
+ if (gridRef.value !== null) {
44
+ for (const warning of checkSlots(gridRef.value)) {
45
+ // eslint-disable-next-line no-console
46
+ console.warn(warning);
47
+ }
45
48
  }
46
- }
47
- };
48
- onMounted(check);
49
- onUpdated(check);
49
+ };
50
+ onMounted(check);
51
+ onUpdated(check);
52
+ }
53
+ }
54
+ catch (error) {
55
+ // Without a bundler, `process` may not exist: then this isn't development.
56
+ if (!(error instanceof ReferenceError)) {
57
+ throw error;
58
+ }
50
59
  }
51
60
  return () => {
52
61
  const { sizeContainer, grid } = markup.elements(props.dataArea);
package/package.json CHANGED
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "name": "@typed-grid-areas/vue",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Vue adapter for typed-grid-areas: render a grid definition as typed slot components.",
5
+ "keywords": [
6
+ "css-grid",
7
+ "grid-template-areas",
8
+ "layout",
9
+ "typescript",
10
+ "vue"
11
+ ],
5
12
  "type": "module",
6
13
  "license": "MIT",
7
14
  "repository": {
@@ -9,7 +16,7 @@
9
16
  "url": "git+https://github.com/MichaelBuss/typed-grid-areas.git",
10
17
  "directory": "packages/vue"
11
18
  },
12
- "homepage": "https://github.com/MichaelBuss/typed-grid-areas#readme",
19
+ "homepage": "https://michaelbuss.github.io/typed-grid-areas/",
13
20
  "bugs": {
14
21
  "url": "https://github.com/MichaelBuss/typed-grid-areas/issues"
15
22
  },
@@ -20,12 +27,13 @@
20
27
  }
21
28
  },
22
29
  "files": [
23
- "dist"
30
+ "dist",
31
+ "REFERENCE.md"
24
32
  ],
25
33
  "scripts": {
26
34
  "build": "tsc -p tsconfig.build.json",
27
- "prepack": "npm run build && cp ../../README.md ../../LICENSE .",
28
- "postpack": "rm README.md LICENSE",
35
+ "prepack": "npm run build && cp ../../README.md ../../REFERENCE.md ../../LICENSE .",
36
+ "postpack": "rm README.md REFERENCE.md LICENSE",
29
37
  "test": "vitest run --project unit --project node",
30
38
  "test:browser": "vitest run --project browser --project browser-development",
31
39
  "typecheck": "node scripts/vue-tsc.cjs --noEmit"
@@ -34,7 +42,7 @@
34
42
  "vue": "^3.5.0"
35
43
  },
36
44
  "dependencies": {
37
- "typed-grid-areas": "^0.2.0"
45
+ "typed-grid-areas": "^0.3.1"
38
46
  },
39
47
  "devDependencies": {
40
48
  "@typed-grid-areas/acceptance": "*",