proca 0.8.1 → 1.1.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.
Files changed (104) hide show
  1. package/README.md +1027 -28
  2. package/package.json +94 -101
  3. package/proca-cli +8 -0
  4. package/src/commands/action/count.mjs +61 -0
  5. package/src/commands/action/list.mjs +189 -0
  6. package/src/commands/action/replay.mjs +54 -0
  7. package/src/commands/campaign/add.mjs +101 -0
  8. package/src/commands/campaign/delete.mjs +61 -0
  9. package/src/commands/campaign/get.mjs +107 -0
  10. package/src/commands/campaign/list.mjs +156 -0
  11. package/src/commands/campaign/queries.graphql +19 -0
  12. package/src/commands/config/add.mjs +101 -0
  13. package/src/commands/config/get.mjs +33 -0
  14. package/src/commands/config/set.mjs +103 -0
  15. package/src/commands/config/user.mjs +76 -0
  16. package/src/commands/org/add.mjs +66 -0
  17. package/src/commands/org/crm.mjs +88 -0
  18. package/src/commands/org/delete.mjs +48 -0
  19. package/src/commands/org/get.mjs +97 -0
  20. package/src/commands/org/join.mjs +77 -0
  21. package/src/commands/supporter/count.mjs +96 -0
  22. package/src/commands/user/get.mjs +91 -0
  23. package/src/commands/user/leave.mjs +52 -0
  24. package/src/commands/user/list.mjs +71 -0
  25. package/src/commands/widget/add.mjs +101 -0
  26. package/src/commands/widget/get.mjs +59 -0
  27. package/src/commands/widget/list.mjs +116 -0
  28. package/src/config.mjs +36 -0
  29. package/src/generated/schema.json +10677 -0
  30. package/src/hooks/help.mjs +14 -0
  31. package/src/hooks/init.mjs +20 -0
  32. package/src/index.mjs +1 -0
  33. package/src/procaCommand.mjs +218 -0
  34. package/src/queries/campaign.mjs +21 -0
  35. package/src/queries/widget.mjs +12 -0
  36. package/src/urql.mjs +60 -0
  37. package/src/util/twitter.mjs +23 -0
  38. package/theme.json +29 -0
  39. package/LICENSE +0 -661
  40. package/dist/App.css +0 -22
  41. package/dist/App.js +0 -25
  42. package/dist/App.test.js +0 -8
  43. package/dist/Wizard.js +0 -32
  44. package/dist/components/Alert.js +0 -49
  45. package/dist/components/Clickify.js +0 -26
  46. package/dist/components/Consent.js +0 -120
  47. package/dist/components/Country.js +0 -94
  48. package/dist/components/Dialog.js +0 -84
  49. package/dist/components/Disabled.js +0 -3
  50. package/dist/components/Emoji.js +0 -12
  51. package/dist/components/FAB.js +0 -70
  52. package/dist/components/Html.js +0 -56
  53. package/dist/components/Loader.js +0 -14
  54. package/dist/components/Openletter.js +0 -443
  55. package/dist/components/Organisation.js +0 -181
  56. package/dist/components/Petition.js +0 -16
  57. package/dist/components/ProcaRoot.js +0 -23
  58. package/dist/components/ProcaStyle.js +0 -94
  59. package/dist/components/ProgressCounter.js +0 -64
  60. package/dist/components/Register.js +0 -345
  61. package/dist/components/Share.js +0 -177
  62. package/dist/components/TextField.js +0 -58
  63. package/dist/components/Twitter.js +0 -127
  64. package/dist/components/TwitterAction.js +0 -111
  65. package/dist/components/TwitterList.js +0 -25
  66. package/dist/components/TwitterText.js +0 -42
  67. package/dist/components/Widget.js +0 -266
  68. package/dist/components/bespoke/Download.js +0 -49
  69. package/dist/components/bespoke/Register-CH.js +0 -505
  70. package/dist/data/countries.json +0 -114
  71. package/dist/hooks/useConfig.js +0 -217
  72. package/dist/hooks/useCount.js +0 -95
  73. package/dist/hooks/useData.js +0 -59
  74. package/dist/hooks/useElementWidth.js +0 -46
  75. package/dist/hooks/useGeoLocation.js +0 -45
  76. package/dist/hooks/useLayout.js +0 -63
  77. package/dist/images/Twitter.js +0 -16
  78. package/dist/images/Twitter.svg +0 -1
  79. package/dist/index.css +0 -13
  80. package/dist/index.js +0 -114
  81. package/dist/lib/domparser.js +0 -12
  82. package/dist/lib/i18n.js +0 -40
  83. package/dist/lib/init.js +0 -7
  84. package/dist/lib/server.js +0 -331
  85. package/dist/lib/urlparser.js +0 -65
  86. package/dist/lib/uuid.js +0 -30
  87. package/dist/locales/README.md +0 -37
  88. package/dist/locales/common.json +0 -189
  89. package/dist/locales/de/common.json +0 -46
  90. package/dist/locales/de/index.js +0 -0
  91. package/dist/locales/en/common.json +0 -45
  92. package/dist/locales/fr/common.json +0 -51
  93. package/dist/locales/index.js +0 -27
  94. package/dist/locales/it/common.json +0 -46
  95. package/dist/logo.svg +0 -1
  96. package/dist/module.js +0 -14
  97. package/dist/slingshot.xcf +0 -0
  98. package/dist/tmp.config/0.json +0 -21
  99. package/dist/tmp.config/2.json +0 -11
  100. package/dist/tmp.config/20.json +0 -29
  101. package/dist/tmp.config/28.json +0 -14
  102. package/dist/tmp.config/32.json +0 -34
  103. package/dist/tmp.config/35.json +0 -14
  104. package/dist/tmp.config/null.json +0 -1
@@ -1,217 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
-
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
-
15
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
-
17
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
-
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
- // we have migrated from a single Config context to recoil and multiple atoms.
22
- // technically, we are migrating, but more or less done
23
- import React, { useContext, useState, useEffect, useCallback } from 'react';
24
- import { atom, useSetRecoilState, useRecoilValue } from 'recoil';
25
- import useData from "./useData";
26
- import { useSetLayout } from "./useLayout";
27
- import i18next from "../lib/i18n";
28
- export var configState = null;
29
- /*
30
- export const configState = atom({
31
- key:'campaign',
32
- default:{
33
- actionPage:null,
34
- name:null,
35
- organisation:null,
36
- lang:null,
37
- journey: [],
38
- } // check the json config attribute in the actionpage for example of more advanced format
39
- });
40
- */
41
-
42
- export var initConfigState = function initConfigState(config) {
43
- i18next.addResourceBundle("en", "common", config.locales, true, true); // delete config.locales;
44
-
45
- if (configState) return false;
46
- configState = atom({
47
- key: 'campaign',
48
- default: config
49
- });
50
- return true;
51
- };
52
- export var Config = React.createContext();
53
- var id = 'proca-listener';
54
- export var setGlobalState = function setGlobalState(atom, key, value) {
55
- var event = new CustomEvent('proca-set', {
56
- detail: {
57
- atom: atom,
58
- key: key,
59
- value: value
60
- }
61
- });
62
- document.getElementById(id).dispatchEvent(event);
63
- };
64
-
65
- var set = function set(key, value) {
66
- // obsolete, will soon be removed
67
- var event = new CustomEvent('proca-set', {
68
- detail: {
69
- key: key,
70
- value: value
71
- }
72
- });
73
- document.getElementById(id).dispatchEvent(event);
74
- };
75
-
76
- var goStep = function goStep(action) {
77
- var event = new CustomEvent('proca-go', {
78
- detail: {
79
- action: action
80
- }
81
- });
82
- document.getElementById(id).dispatchEvent(event);
83
- };
84
-
85
- var setHook = function setHook(object, action, hook) {
86
- var event = new CustomEvent('proca-hook', {
87
- detail: {
88
- object: object,
89
- action: action,
90
- hook: hook
91
- }
92
- });
93
- document.getElementById(id).dispatchEvent(event);
94
- };
95
-
96
- export var ConfigProvider = function ConfigProvider(props) {
97
- var _useState = useState(props.config),
98
- _useState2 = _slicedToArray(_useState, 2),
99
- config = _useState2[0],
100
- _setConfig = _useState2[1];
101
-
102
- var setLayout = useSetLayout();
103
-
104
- var _setCampaignConfig = useSetRecoilState(configState);
105
-
106
- var _useData = useData(),
107
- _useData2 = _slicedToArray(_useData, 2),
108
- setData = _useData2[1];
109
-
110
- var go = props.go;
111
- var setConfig = useCallback(function (k, v) {
112
- var d = _objectSpread({}, config);
113
-
114
- var keys = k.split(".");
115
-
116
- switch (keys.length) {
117
- case 1:
118
- d[k] = v;
119
- break;
120
-
121
- case 2:
122
- d[keys[0]] ? d[keys[0]][keys[1]] = v : console.log("invalid key", k);
123
- break;
124
-
125
- case 3:
126
- d[keys[0]] ? d[keys[0]][[keys[1][keys[1]]]] = v : console.log("invalid key", k);
127
- break;
128
-
129
- default:
130
- console.log("invalid key", k);
131
- }
132
-
133
- ;
134
-
135
- _setConfig(d);
136
- }, [config]);
137
- var setHook = useCallback(function (object, action, hook) {
138
- var hooks = config.hook;
139
- hooks[object + ":" + action] = hook;
140
- console.log(hooks, object, action);
141
- setConfig("hook", hooks);
142
- console.log(config);
143
- }, [config, setConfig]);
144
- var setCampaignConfig = useCallback(function (key, value) {
145
- if (_typeof(key) === 'object') {
146
- _setCampaignConfig(function (current) {
147
- return _objectSpread({}, current, {}, key);
148
- });
149
-
150
- return;
151
- }
152
-
153
- _setCampaignConfig(function (current) {
154
- var d = _objectSpread({}, current);
155
-
156
- d[key] = value;
157
- return d;
158
- });
159
- }, [_setCampaignConfig]);
160
- useEffect(function () {
161
- var elem = document.getElementById(id);
162
- elem.addEventListener('proca-set', function (e) {
163
- switch (e.detail.atom) {
164
- case "layout":
165
- setLayout(e.detail.key, e.detail.value);
166
- break;
167
-
168
- case "campaign":
169
- setCampaignConfig(e.detail.key, e.detail.value);
170
- break;
171
-
172
- case "data":
173
- setData(e.detail.key, e.detail.value);
174
- break;
175
-
176
- default:
177
- setConfig(e.detail.key, e.detail.value);
178
- }
179
- }, false);
180
- elem.addEventListener('proca-hook', function (e) {
181
- if (!_typeof(e.detail.hook) === 'function') return console.error("After must be a function");
182
- if (!_typeof(e.detail.action) === 'string') return console.error("action must me a string");
183
- if (!_typeof(e.detail.object) === 'string') return console.error("object must me a string");
184
- setHook(e.detail.object, e.detail.action, e.detail.hook);
185
- }, false);
186
- elem.addEventListener('proca-go', function (e) {
187
- if (typeof go === 'function') {
188
- go(e.detail.action);
189
- } else {
190
- console.error("ain't no go fct");
191
- }
192
- }, false);
193
- }, [setConfig, go, setHook, setLayout, setCampaignConfig, setData]); //setCampaignConfig(config);
194
-
195
- return /*#__PURE__*/React.createElement(Config.Provider, {
196
- value: {
197
- config: config,
198
- setConfig: setConfig
199
- }
200
- }, props.children, /*#__PURE__*/React.createElement("div", {
201
- id: id
202
- }));
203
- }; //export const useConfig = () => (useContext(Config));
204
-
205
- export var useConfig = function useConfig() {
206
- return useContext(Config);
207
- };
208
- export var useCampaignConfig = function useCampaignConfig() {
209
- return useRecoilValue(configState);
210
- };
211
- export var useSetCampaignConfig = function useSetCampaignConfig() {
212
- return useSetRecoilState(configState);
213
- };
214
- export { set as setConfig };
215
- export { goStep };
216
- export { setHook as hook };
217
- export default useConfig;
@@ -1,95 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
-
3
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
-
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
-
7
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
-
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
-
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
-
13
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- import { useEffect } from "react";
18
- import { getCount, getCountByUrl } from "../lib/server.js";
19
- import { atom, useRecoilState } from 'recoil';
20
- var CountState = atom({
21
- key: 'actionCount',
22
- default: null
23
- });
24
- export default function useCounter(actionPage, actionUrl) {
25
- var _useRecoilState = useRecoilState(CountState),
26
- _useRecoilState2 = _slicedToArray(_useRecoilState, 2),
27
- count = _useRecoilState2[0],
28
- setCount = _useRecoilState2[1];
29
-
30
- useEffect(function () {
31
- var isCancelled = false;
32
- var c = null;
33
-
34
- _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
35
- return regeneratorRuntime.wrap(function _callee$(_context) {
36
- while (1) {
37
- switch (_context.prev = _context.next) {
38
- case 0:
39
- if (!(count !== null)) {
40
- _context.next = 2;
41
- break;
42
- }
43
-
44
- return _context.abrupt("return");
45
-
46
- case 2:
47
- if (!actionUrl) {
48
- _context.next = 8;
49
- break;
50
- }
51
-
52
- _context.next = 5;
53
- return getCountByUrl(actionUrl);
54
-
55
- case 5:
56
- c = _context.sent;
57
- _context.next = 13;
58
- break;
59
-
60
- case 8:
61
- if (!(!actionPage || isNaN(actionPage))) {
62
- _context.next = 10;
63
- break;
64
- }
65
-
66
- return _context.abrupt("return", {
67
- errors: [{
68
- messsage: "invalid actionPage:" + actionPage
69
- }]
70
- });
71
-
72
- case 10:
73
- _context.next = 12;
74
- return getCount(actionPage);
75
-
76
- case 12:
77
- c = _context.sent;
78
-
79
- case 13:
80
- if (!isCancelled) setCount(c);
81
-
82
- case 14:
83
- case "end":
84
- return _context.stop();
85
- }
86
- }
87
- }, _callee);
88
- }))();
89
-
90
- return function () {
91
- isCancelled = true;
92
- };
93
- }, [actionPage, actionUrl, count, setCount]);
94
- return count || null;
95
- }
@@ -1,59 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
8
-
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
-
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
-
15
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
-
17
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
-
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
- import { useCallback } from 'react';
22
- import { atom, useRecoilState } from 'recoil';
23
- var dataState = null;
24
- export var initDataState = function initDataState(data) {
25
- if (dataState) return false;
26
- dataState = atom({
27
- key: 'data',
28
- default: data
29
- });
30
- return true;
31
- };
32
-
33
- var useData = function useData() {
34
- var _useRecoilState = useRecoilState(dataState),
35
- _useRecoilState2 = _slicedToArray(_useRecoilState, 2),
36
- data = _useRecoilState2[0],
37
- _set = _useRecoilState2[1];
38
-
39
- var setData = useCallback(function (key, value) {
40
- if (_typeof(key) === 'object') {
41
- _set(function (current) {
42
- return _objectSpread({}, current, {}, key);
43
- });
44
-
45
- return;
46
- }
47
-
48
- _set(function (current) {
49
- var d = _objectSpread({}, current);
50
-
51
- d[key] = value;
52
- return d;
53
- });
54
- }, [_set]);
55
- return [data, setData];
56
- };
57
-
58
- export { useData };
59
- export default useData;
@@ -1,46 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- import { useLayoutEffect, useState } from 'react';
14
-
15
- function useElementSize(selector) {
16
- var delay = 250; // debounce delay
17
-
18
- var _useState = useState(0),
19
- _useState2 = _slicedToArray(_useState, 2),
20
- size = _useState2[0],
21
- setSize = _useState2[1];
22
-
23
- useLayoutEffect(function () {
24
- var timeout = false;
25
- var el = document.querySelector(selector);
26
-
27
- function updateSize() {
28
- if (!el) return;
29
- setSize(el.scrollWidth);
30
- }
31
-
32
- function debouncedUpdateSize() {
33
- clearTimeout(timeout);
34
- timeout = setTimeout(updateSize, delay);
35
- }
36
-
37
- window.addEventListener('resize', debouncedUpdateSize);
38
- updateSize();
39
- return function () {
40
- return window.removeEventListener('resize', debouncedUpdateSize);
41
- };
42
- }, [selector]);
43
- return size;
44
- }
45
-
46
- export default useElementSize;
@@ -1,45 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- import { useEffect } from 'react';
14
- import useGeoLocation from "react-ipgeolocation";
15
- import { atom, useRecoilState } from 'recoil';
16
- var State = atom({
17
- key: 'country',
18
- default: {
19
- country: null
20
- }
21
- });
22
-
23
- var useCachedGeoLocation = function useCachedGeoLocation(params) {
24
- var api = params.api || "https://country.proca.foundation";
25
-
26
- var _useRecoilState = useRecoilState(State),
27
- _useRecoilState2 = _slicedToArray(_useRecoilState, 2),
28
- country = _useRecoilState2[0],
29
- setCountry = _useRecoilState2[1];
30
-
31
- var location = useGeoLocation({
32
- api: api,
33
- country: params.country || country.country
34
- });
35
- useEffect(function () {
36
- if (!params.country && location.country && !country.country) {
37
- setCountry({
38
- country: location.country
39
- });
40
- }
41
- }, [country, setCountry, location, params.country]);
42
- return location || country;
43
- };
44
-
45
- export default useCachedGeoLocation;
@@ -1,63 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
9
- import { atom, useSetRecoilState, useRecoilValue } from 'recoil';
10
- var state = null;
11
- export var init = function init(data) {
12
- if (state) return false;
13
-
14
- var d = _objectSpread({
15
- variant: "filled",
16
- // options filled, outlined, standard
17
- margin: "dense",
18
- primaryColor: '#1976d2',
19
- secondaryColor: '#dc004e',
20
- paletteType: 'light',
21
- backgroundColor: 'tranparent'
22
- }, data); // default value (aka initial value)
23
-
24
-
25
- state = atom({
26
- key: "layout",
27
- default: d
28
- });
29
- return true;
30
- };
31
- init();
32
-
33
- var useLayout = function useLayout() {
34
- return useRecoilValue(state);
35
- };
36
-
37
- var useSetLayout = function useSetLayout() {
38
- var _set = useSetRecoilState(state); //const set = useCallback((key, value) => {
39
-
40
-
41
- var set = function set(key, value) {
42
- if (_typeof(key) === 'object') {
43
- _set(function (current) {
44
- return _objectSpread({}, current, {}, key);
45
- });
46
-
47
- return;
48
- }
49
-
50
- _set(function (current) {
51
- var d = _objectSpread({}, current);
52
-
53
- d[key] = value;
54
- return d;
55
- });
56
- }; //,[_set]);
57
-
58
-
59
- return set;
60
- };
61
-
62
- export { useSetLayout, useLayout };
63
- export default useLayout;
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
-
3
- var SvgComponent = function SvgComponent(props) {
4
- return /*#__PURE__*/React.createElement("svg", {
5
- viewBox: "0 0 64 64"
6
- }, /*#__PURE__*/React.createElement("circle", {
7
- cx: "32",
8
- cy: "32",
9
- r: "31",
10
- fill: "#00aced"
11
- }), /*#__PURE__*/React.createElement("path", {
12
- d: "M48,22.1c-1.2,0.5-2.4,0.9-3.8,1c1.4-0.8,2.4-2.1,2.9-3.6c-1.3,0.8-2.7,1.3-4.2,1.6 C41.7,19.8,40,19,38.2,19c-3.6,0-6.6,2.9-6.6,6.6c0,0.5,0.1,1,0.2,1.5c-5.5-0.3-10.3-2.9-13.5-6.9c-0.6,1-0.9,2.1-0.9,3.3 c0,2.3,1.2,4.3,2.9,5.5c-1.1,0-2.1-0.3-3-0.8c0,0,0,0.1,0,0.1c0,3.2,2.3,5.8,5.3,6.4c-0.6,0.1-1.1,0.2-1.7,0.2c-0.4,0-0.8,0-1.2-0.1 c0.8,2.6,3.3,4.5,6.1,4.6c-2.2,1.8-5.1,2.8-8.2,2.8c-0.5,0-1.1,0-1.6-0.1c2.9,1.9,6.4,2.9,10.1,2.9c12.1,0,18.7-10,18.7-18.7 c0-0.3,0-0.6,0-0.8C46,24.5,47.1,23.4,48,22.1z"
13
- }));
14
- };
15
-
16
- export default SvgComponent;
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 64 64" ><circle cx="32" cy="32" r="31" fill="#00aced"></circle><path d="M48,22.1c-1.2,0.5-2.4,0.9-3.8,1c1.4-0.8,2.4-2.1,2.9-3.6c-1.3,0.8-2.7,1.3-4.2,1.6 C41.7,19.8,40,19,38.2,19c-3.6,0-6.6,2.9-6.6,6.6c0,0.5,0.1,1,0.2,1.5c-5.5-0.3-10.3-2.9-13.5-6.9c-0.6,1-0.9,2.1-0.9,3.3 c0,2.3,1.2,4.3,2.9,5.5c-1.1,0-2.1-0.3-3-0.8c0,0,0,0.1,0,0.1c0,3.2,2.3,5.8,5.3,6.4c-0.6,0.1-1.1,0.2-1.7,0.2c-0.4,0-0.8,0-1.2-0.1 c0.8,2.6,3.3,4.5,6.1,4.6c-2.2,1.8-5.1,2.8-8.2,2.8c-0.5,0-1.1,0-1.6-0.1c2.9,1.9,6.4,2.9,10.1,2.9c12.1,0,18.7-10,18.7-18.7 c0-0.3,0-0.6,0-0.8C46,24.5,47.1,23.4,48,22.1z"></path></svg>
package/dist/index.css DELETED
@@ -1,13 +0,0 @@
1
- body {
2
- margin: 0;
3
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4
- "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5
- sans-serif;
6
- -webkit-font-smoothing: antialiased;
7
- -moz-osx-font-smoothing: grayscale;
8
- }
9
-
10
- code {
11
- font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12
- monospace;
13
- }