@graffy/explore 0.16.1 → 0.16.2-alpha.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 (3) hide show
  1. package/index.cjs +16 -57
  2. package/index.mjs +11 -45
  3. package/package.json +7 -7
package/index.cjs CHANGED
@@ -5,10 +5,7 @@ const GraffyFill = require("@graffy/fill");
5
5
  const GraffyClient = require("@graffy/client");
6
6
  const react = require("@graffy/react");
7
7
  const common = require("@graffy/common");
8
- const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule)
11
- return e;
8
+ function _interopNamespaceDefault(e) {
12
9
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
10
  if (e) {
14
11
  for (const k in e) {
@@ -24,21 +21,9 @@ function _interopNamespace(e) {
24
21
  n.default = e;
25
22
  return Object.freeze(n);
26
23
  }
27
- const React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
28
- const Graffy__default = /* @__PURE__ */ _interopDefaultLegacy(Graffy);
29
- const GraffyFill__default = /* @__PURE__ */ _interopDefaultLegacy(GraffyFill);
30
- const GraffyClient__default = /* @__PURE__ */ _interopDefaultLegacy(GraffyClient);
31
- const common__namespace = /* @__PURE__ */ _interopNamespace(common);
24
+ const common__namespace = /* @__PURE__ */ _interopNamespaceDefault(common);
32
25
  function Result({ result, loading, error }) {
33
- return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, loading ? /* @__PURE__ */ React__default.default.createElement("div", {
34
- className: "status"
35
- }, "Loading...") : error ? /* @__PURE__ */ React__default.default.createElement("div", {
36
- className: "error"
37
- }, error.toString()) : result ? /* @__PURE__ */ React__default.default.createElement("pre", null, JSON.stringify(result, null, 2)) : /* @__PURE__ */ React__default.default.createElement("div", {
38
- className: "status"
39
- }, "No results"), /* @__PURE__ */ React__default.default.createElement("style", {
40
- jsx: true
41
- }, `
26
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, loading ? /* @__PURE__ */ React.createElement("div", { className: "status" }, "Loading...") : error ? /* @__PURE__ */ React.createElement("div", { className: "error" }, error.toString()) : result ? /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(result, null, 2)) : /* @__PURE__ */ React.createElement("div", { className: "status" }, "No results"), /* @__PURE__ */ React.createElement("style", { jsx: true }, `
42
27
  .error {
43
28
  color: #c00;
44
29
  padding: 1rem;
@@ -99,37 +84,15 @@ function Explore(options) {
99
84
  setLoading(false);
100
85
  setWatching((w) => !w);
101
86
  };
102
- return /* @__PURE__ */ React__default.default.createElement("div", null, /* @__PURE__ */ React__default.default.createElement("pre", {
103
- className: "editor",
104
- contentEditable: true,
105
- onFocus: onInputStart,
106
- onBlur: onInputEnd
107
- }), /* @__PURE__ */ React__default.default.createElement("div", {
108
- className: "opbar"
109
- }, /* @__PURE__ */ React__default.default.createElement("button", {
110
- className: "opbtn",
111
- disabled: watching,
112
- onClick: onReadClick
113
- }, "read()"), /* @__PURE__ */ React__default.default.createElement("button", {
114
- className: "opbtn",
115
- disabled: watching,
116
- onClick: onWriteClick
117
- }, "write()"), /* @__PURE__ */ React__default.default.createElement("button", {
118
- className: "opbtn",
119
- "data-active": watching,
120
- onClick: onWatchClick
121
- }, "watch()")), error ? /* @__PURE__ */ React__default.default.createElement("div", {
122
- className: "error"
123
- }, error) : watching ? /* @__PURE__ */ React__default.default.createElement(react.Query, {
124
- query: input,
125
- options
126
- }, (props) => /* @__PURE__ */ React__default.default.createElement(Result, {
127
- ...props
128
- })) : /* @__PURE__ */ React__default.default.createElement(Result, {
129
- ...{ result, loading, error }
130
- }), /* @__PURE__ */ React__default.default.createElement("style", {
131
- jsx: true
132
- }, `
87
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
88
+ "pre",
89
+ {
90
+ className: "editor",
91
+ contentEditable: true,
92
+ onFocus: onInputStart,
93
+ onBlur: onInputEnd
94
+ }
95
+ ), /* @__PURE__ */ React.createElement("div", { className: "opbar" }, /* @__PURE__ */ React.createElement("button", { className: "opbtn", disabled: watching, onClick: onReadClick }, "read()"), /* @__PURE__ */ React.createElement("button", { className: "opbtn", disabled: watching, onClick: onWriteClick }, "write()"), /* @__PURE__ */ React.createElement("button", { className: "opbtn", "data-active": watching, onClick: onWatchClick }, "watch()")), error ? /* @__PURE__ */ React.createElement("div", { className: "error" }, error) : watching ? /* @__PURE__ */ React.createElement(react.Query, { query: input, options }, (props) => /* @__PURE__ */ React.createElement(Result, { ...props })) : /* @__PURE__ */ React.createElement(Result, { ...{ result, loading, error } }), /* @__PURE__ */ React.createElement("style", { jsx: true }, `
133
96
  .error {
134
97
  color: #c00;
135
98
  padding: 1rem;
@@ -177,17 +140,13 @@ function ExploreContainer({
177
140
  }) {
178
141
  const [store, setStore] = React.useState();
179
142
  React.useEffect(() => {
180
- const store2 = new Graffy__default.default();
181
- store2.use(GraffyFill__default.default());
182
- store2.use(GraffyClient__default.default(baseUrl, { getOptions }));
143
+ const store2 = new Graffy();
144
+ store2.use(GraffyFill());
145
+ store2.use(GraffyClient(baseUrl, { getOptions }));
183
146
  setStore(store2);
184
147
  window.store = store2;
185
148
  window.graffy = common__namespace;
186
149
  }, [baseUrl]);
187
- return store ? /* @__PURE__ */ React__default.default.createElement(react.GraffyProvider, {
188
- store
189
- }, /* @__PURE__ */ React__default.default.createElement(Explore, {
190
- ...options
191
- })) : null;
150
+ return store ? /* @__PURE__ */ React.createElement(react.GraffyProvider, { store }, /* @__PURE__ */ React.createElement(Explore, { ...options })) : null;
192
151
  }
193
152
  module.exports = ExploreContainer;
package/index.mjs CHANGED
@@ -5,15 +5,7 @@ import GraffyClient from "@graffy/client";
5
5
  import { useStore, Query, GraffyProvider } from "@graffy/react";
6
6
  import * as common from "@graffy/common";
7
7
  function Result({ result, loading, error }) {
8
- return /* @__PURE__ */ React.createElement(React.Fragment, null, loading ? /* @__PURE__ */ React.createElement("div", {
9
- className: "status"
10
- }, "Loading...") : error ? /* @__PURE__ */ React.createElement("div", {
11
- className: "error"
12
- }, error.toString()) : result ? /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(result, null, 2)) : /* @__PURE__ */ React.createElement("div", {
13
- className: "status"
14
- }, "No results"), /* @__PURE__ */ React.createElement("style", {
15
- jsx: true
16
- }, `
8
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, loading ? /* @__PURE__ */ React.createElement("div", { className: "status" }, "Loading...") : error ? /* @__PURE__ */ React.createElement("div", { className: "error" }, error.toString()) : result ? /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(result, null, 2)) : /* @__PURE__ */ React.createElement("div", { className: "status" }, "No results"), /* @__PURE__ */ React.createElement("style", { jsx: true }, `
17
9
  .error {
18
10
  color: #c00;
19
11
  padding: 1rem;
@@ -74,37 +66,15 @@ function Explore(options) {
74
66
  setLoading(false);
75
67
  setWatching((w) => !w);
76
68
  };
77
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("pre", {
78
- className: "editor",
79
- contentEditable: true,
80
- onFocus: onInputStart,
81
- onBlur: onInputEnd
82
- }), /* @__PURE__ */ React.createElement("div", {
83
- className: "opbar"
84
- }, /* @__PURE__ */ React.createElement("button", {
85
- className: "opbtn",
86
- disabled: watching,
87
- onClick: onReadClick
88
- }, "read()"), /* @__PURE__ */ React.createElement("button", {
89
- className: "opbtn",
90
- disabled: watching,
91
- onClick: onWriteClick
92
- }, "write()"), /* @__PURE__ */ React.createElement("button", {
93
- className: "opbtn",
94
- "data-active": watching,
95
- onClick: onWatchClick
96
- }, "watch()")), error ? /* @__PURE__ */ React.createElement("div", {
97
- className: "error"
98
- }, error) : watching ? /* @__PURE__ */ React.createElement(Query, {
99
- query: input,
100
- options
101
- }, (props) => /* @__PURE__ */ React.createElement(Result, {
102
- ...props
103
- })) : /* @__PURE__ */ React.createElement(Result, {
104
- ...{ result, loading, error }
105
- }), /* @__PURE__ */ React.createElement("style", {
106
- jsx: true
107
- }, `
69
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
70
+ "pre",
71
+ {
72
+ className: "editor",
73
+ contentEditable: true,
74
+ onFocus: onInputStart,
75
+ onBlur: onInputEnd
76
+ }
77
+ ), /* @__PURE__ */ React.createElement("div", { className: "opbar" }, /* @__PURE__ */ React.createElement("button", { className: "opbtn", disabled: watching, onClick: onReadClick }, "read()"), /* @__PURE__ */ React.createElement("button", { className: "opbtn", disabled: watching, onClick: onWriteClick }, "write()"), /* @__PURE__ */ React.createElement("button", { className: "opbtn", "data-active": watching, onClick: onWatchClick }, "watch()")), error ? /* @__PURE__ */ React.createElement("div", { className: "error" }, error) : watching ? /* @__PURE__ */ React.createElement(Query, { query: input, options }, (props) => /* @__PURE__ */ React.createElement(Result, { ...props })) : /* @__PURE__ */ React.createElement(Result, { ...{ result, loading, error } }), /* @__PURE__ */ React.createElement("style", { jsx: true }, `
108
78
  .error {
109
79
  color: #c00;
110
80
  padding: 1rem;
@@ -159,11 +129,7 @@ function ExploreContainer({
159
129
  window.store = store2;
160
130
  window.graffy = common;
161
131
  }, [baseUrl]);
162
- return store ? /* @__PURE__ */ React.createElement(GraffyProvider, {
163
- store
164
- }, /* @__PURE__ */ React.createElement(Explore, {
165
- ...options
166
- })) : null;
132
+ return store ? /* @__PURE__ */ React.createElement(GraffyProvider, { store }, /* @__PURE__ */ React.createElement(Explore, { ...options })) : null;
167
133
  }
168
134
  export {
169
135
  ExploreContainer as default
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graffy/explore",
3
3
  "description": "Graffy client library for the browser.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.16.1",
5
+ "version": "0.16.2-alpha.1",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -16,13 +16,13 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
- "@graffy/core": "0.16.1",
20
- "@graffy/fill": "0.16.1",
21
- "@graffy/client": "0.16.1",
22
- "@graffy/react": "0.16.1",
23
- "@graffy/common": "0.16.1"
19
+ "@graffy/core": "0.16.2-alpha.1",
20
+ "@graffy/fill": "0.16.2-alpha.1",
21
+ "@graffy/client": "0.16.2-alpha.1",
22
+ "@graffy/react": "0.16.2-alpha.1",
23
+ "@graffy/common": "0.16.2-alpha.1"
24
24
  },
25
25
  "peerDependencies": {
26
- "react": "^16.8.0 || ^17.0.0"
26
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
27
27
  }
28
28
  }