@typed-grid-areas/solid 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,6 +1,6 @@
1
1
  import { children, createEffect, mergeProps, sharedConfig, splitProps, } from "solid-js";
2
2
  import { Dynamic, isServer, ssr, useAssets } from "solid-js/web";
3
- import { createSlotCheck, gridMarkup, gridStyleTags, insertGridStyle, isDevelopment, } from "typed-grid-areas/adapter";
3
+ import { createSlotCheck, gridMarkup, gridStyleTags, insertGridStyle, } from "typed-grid-areas/adapter";
4
4
  /**
5
5
  * What a server render has registered with `useAssets`, by render. The
6
6
  * render's list of assets is internal to Solid; it's only used here as a
@@ -44,20 +44,31 @@ function createRoot(definition) {
44
44
  grid = element;
45
45
  local.ref?.(element);
46
46
  };
47
- // In development, check the slots after mount and whenever they change.
48
- if (!isServer && isDevelopment()) {
49
- const checkSlots = createSlotCheck(definition, {
50
- strayChildRemedy: "make it a slot with `as`",
51
- });
52
- createEffect(() => {
53
- resolved();
54
- if (grid !== undefined) {
55
- for (const warning of checkSlots(grid)) {
56
- // eslint-disable-next-line no-console
57
- console.warn(warning);
58
- }
47
+ // In development, check the slots after mount and whenever they change. Written out,
48
+ // not `isDevelopment()`, so production builds drop the check.
49
+ try {
50
+ if (process.env.NODE_ENV === "development") {
51
+ if (!isServer) {
52
+ const checkSlots = createSlotCheck(definition, {
53
+ strayChildRemedy: "make it a slot with `as`",
54
+ });
55
+ createEffect(() => {
56
+ resolved();
57
+ if (grid !== undefined) {
58
+ for (const warning of checkSlots(grid)) {
59
+ // eslint-disable-next-line no-console
60
+ console.warn(warning);
61
+ }
62
+ }
63
+ });
59
64
  }
60
- });
65
+ }
66
+ }
67
+ catch (error) {
68
+ // Without a bundler, `process` may not exist: then this isn't development.
69
+ if (!(error instanceof ReferenceError)) {
70
+ throw error;
71
+ }
61
72
  }
62
73
  const element = (<Dynamic component={local.as ?? "div"} {...others} {...gridElement.attributes} ref={ref}>
63
74
  {resolved()}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Dynamic, createComponent, insert, isServer, mergeProps, spread, ssr, template, useAssets } from "solid-js/web";
2
2
  import { children, createEffect, mergeProps as mergeProps$1, sharedConfig, splitProps } from "solid-js";
3
- import { createSlotCheck, gridMarkup, gridStyleTags, insertGridStyle, isDevelopment } from "typed-grid-areas/adapter";
3
+ import { createSlotCheck, gridMarkup, gridStyleTags, insertGridStyle } from "typed-grid-areas/adapter";
4
4
  // src/gridComponent.tsx
5
5
  var _tmpl$ = /*#__PURE__*/ template(`<div>`);
6
6
  /**
@@ -46,12 +46,18 @@ function createRoot(definition) {
46
46
  grid = element;
47
47
  local.ref?.(element);
48
48
  };
49
- if (!isServer && isDevelopment()) {
50
- const checkSlots = createSlotCheck(definition, { strayChildRemedy: "make it a slot with `as`" });
51
- createEffect(() => {
52
- resolved();
53
- if (grid !== void 0) for (const warning of checkSlots(grid)) console.warn(warning);
54
- });
49
+ try {
50
+ if (process.env.NODE_ENV === "development") {
51
+ if (!isServer) {
52
+ const checkSlots = createSlotCheck(definition, { strayChildRemedy: "make it a slot with `as`" });
53
+ createEffect(() => {
54
+ resolved();
55
+ if (grid !== void 0) for (const warning of checkSlots(grid)) console.warn(warning);
56
+ });
57
+ }
58
+ }
59
+ } catch (error) {
60
+ if (!(error instanceof ReferenceError)) throw error;
55
61
  }
56
62
  const element = createComponent(Dynamic, mergeProps({ get component() {
57
63
  return local.as ?? "div";
package/package.json CHANGED
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "name": "@typed-grid-areas/solid",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Solid 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
+ "solid"
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/solid"
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
  },
@@ -21,12 +28,13 @@
21
28
  }
22
29
  },
23
30
  "files": [
24
- "dist"
31
+ "dist",
32
+ "REFERENCE.md"
25
33
  ],
26
34
  "scripts": {
27
35
  "build": "vite build && tsc -p tsconfig.build.json",
28
- "prepack": "npm run build && cp ../../README.md ../../LICENSE .",
29
- "postpack": "rm README.md LICENSE",
36
+ "prepack": "npm run build && cp ../../README.md ../../REFERENCE.md ../../LICENSE .",
37
+ "postpack": "rm README.md REFERENCE.md LICENSE",
30
38
  "test": "vitest run --project unit --project node",
31
39
  "test:browser": "vitest run --project browser --project browser-development",
32
40
  "typecheck": "tsc --noEmit"
@@ -35,7 +43,7 @@
35
43
  "solid-js": "^1.9.0"
36
44
  },
37
45
  "dependencies": {
38
- "typed-grid-areas": "^0.2.0"
46
+ "typed-grid-areas": "^0.3.1"
39
47
  },
40
48
  "devDependencies": {
41
49
  "@typed-grid-areas/acceptance": "*",