@cocreate/local-storage 1.7.21 → 1.9.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # [1.9.0](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.8.0...v1.9.0) (2023-08-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * bump cocreate dependencies for the latest updates and features ([5979961](https://github.com/CoCreate-app/CoCreate-local-storage/commit/5979961eefb889971db1967dabc818a4e7cb0628))
7
+
8
+ # [1.8.0](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.7.21...v1.8.0) (2023-08-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * crud attributes renamed ([64b8fc3](https://github.com/CoCreate-app/CoCreate-local-storage/commit/64b8fc3332b383996aefe024b71cdb7d330f70bf))
14
+ * replace -target -selector ([daffdb9](https://github.com/CoCreate-app/CoCreate-local-storage/commit/daffdb91472ac6db81ca389720d847c79fcaac60))
15
+ * updated actions callback data object ([0652db0](https://github.com/CoCreate-app/CoCreate-local-storage/commit/0652db058a6cb2150ba24aea720943c33769f00c))
16
+ * webpack.config and package.json make use of mode=production instead of process.env ([9fd150b](https://github.com/CoCreate-app/CoCreate-local-storage/commit/9fd150b37e111bb188343e32364ce0d69f8da7b8))
17
+
18
+
19
+ ### Features
20
+
21
+ * name attribute and variable renamed to key ([57985fd](https://github.com/CoCreate-app/CoCreate-local-storage/commit/57985fda237449b308d0c4aea5e6433fff786c4d))
22
+
1
23
  ## [1.7.21](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.7.20...v1.7.21) (2023-06-14)
2
24
 
3
25
 
@@ -4,8 +4,8 @@ module.exports = {
4
4
  "host": "",
5
5
  "sources": [
6
6
  {
7
- "collection": "files",
8
- "document": {
7
+ "array": "files",
8
+ "object": {
9
9
  "_id": "6020679b3c260207bf49cab0",
10
10
  "name": "index.html",
11
11
  "path": "/docs/local-storage/index.html",
package/demo/index.html CHANGED
@@ -16,7 +16,7 @@
16
16
  <input
17
17
  type="text"
18
18
  localstorage-set="test"
19
- name=""
19
+ key=""
20
20
  placeholder="SET" />
21
21
  <!--<button type="submit" value="Submit" actions="localstorage">RUN</button>-->
22
22
  <button
@@ -31,14 +31,14 @@
31
31
  <input
32
32
  type="text"
33
33
  localstorage-get="test"
34
- name=""
34
+ key=""
35
35
  placeholder="get" />
36
36
  <input
37
37
  type="text"
38
38
  localstorage-set="test2"
39
- name=""
39
+ key=""
40
40
  placeholder="SET" />
41
- <!--<input type="text" localstorage-remove="test" name="" placeholder="remove"/>-->
41
+ <!--<input type="text" localstorage-remove="test" key="" placeholder="remove"/>-->
42
42
  <button
43
43
  type="button"
44
44
  class="outline red-white"
@@ -51,12 +51,12 @@
51
51
  <input
52
52
  type="text"
53
53
  localstorage-get="test"
54
- name=""
54
+ key=""
55
55
  placeholder="get" />
56
56
  <input
57
57
  type="text"
58
58
  localstorage-get="test2"
59
- name=""
59
+ key=""
60
60
  placeholder="get" />
61
61
  <button
62
62
  type="button"
@@ -70,12 +70,12 @@
70
70
  <input
71
71
  type="text"
72
72
  localstorage-remove="test"
73
- name=""
73
+ key=""
74
74
  placeholder="remove" />
75
75
  <input
76
76
  type="text"
77
77
  localstorage-remove="test2"
78
- name=""
78
+ key=""
79
79
  placeholder="remove" />
80
80
  <button
81
81
  type="button"
package/docs/index.html CHANGED
@@ -11,10 +11,10 @@
11
11
  sizes="32x32"
12
12
  href="https://cocreate.app/images/favicon.ico" />
13
13
  <meta
14
- name="description"
14
+ key="description"
15
15
  content="Simple component to save and fetch data for inputs, textarea, selects from localstorage. easilly configuable with attributes and/or JavaScript API." />
16
16
  <meta
17
- name="keywords"
17
+ key="keywords"
18
18
  content="helper classes, utility classes, css framework, css library, inline style classes" />
19
19
  <meta name="robots" content="index,follow" />
20
20
  <meta
@@ -29,9 +29,9 @@
29
29
  <link
30
30
  rel="stylesheet"
31
31
  href="https://ws.cocreate.app/docs.css"
32
- collection="apples"
33
- document_id="6069ff5042ef8ff5175a5c8d"
34
- name="css"
32
+ array="apples"
33
+ object="6069ff5042ef8ff5175a5c8d"
34
+ key="css"
35
35
  type="text/css" />
36
36
  <link rel="manifest" href="/manifest.webmanifest" />
37
37
  </head>
@@ -43,20 +43,20 @@
43
43
  scroll="sticky-nav,hide-nav"
44
44
  scroll-up="10"
45
45
  scroll-down="10"
46
- collection="files"
47
- document_id="60395ef42b3ac232657040fd"
48
- name="src"></nav>
46
+ array="files"
47
+ object="60395ef42b3ac232657040fd"
48
+ key="src"></nav>
49
49
  <sidenav
50
50
  id="menuL"
51
51
  class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
52
52
  resizable
53
- resize-target="[content_id='content']"
53
+ resize-selector="[content_id='content']"
54
54
  resize-property="margin-left"
55
55
  resize-value="width">
56
56
  <menu
57
- collection="files"
58
- document_id="603717b07de7fb350ae9fec8"
59
- name="src"></menu>
57
+ array="files"
58
+ object="603717b07de7fb350ae9fec8"
59
+ key="src"></menu>
60
60
  <div resize="right"></div>
61
61
  </sidenav>
62
62
  <main
@@ -79,7 +79,7 @@
79
79
  share-width="700"
80
80
  share-media="https://cdn.cocreate.app/docs/local-storage.png"
81
81
  hover="display:block!important"
82
- hover-target=".social-networks">
82
+ hover-selector=".social-networks">
83
83
  <div class="display:none social-networks">
84
84
  <a
85
85
  class="margin-right:15px"
@@ -140,11 +140,11 @@
140
140
  class="border-bottom:1px_solid_lightgrey"
141
141
  scroll
142
142
  scroll-intersect="color:dodgerblue"
143
- scroll-target="#local-storage-install-section">
143
+ scroll-selector="#local-storage-install-section">
144
144
  <span
145
145
  class="display:flex align-items:center width:fit-content"
146
146
  hover="display:block!important"
147
- hover-target="[href='#local-storage-install']">
147
+ hover-selector="[href='#local-storage-install']">
148
148
  <h2 class="padding:5px_0px">Install</h2>
149
149
  <a
150
150
  class="margin-left:10px display:none"
@@ -166,11 +166,11 @@
166
166
  class="margin-top:80px border-bottom:1px_solid_lightgrey"
167
167
  scroll
168
168
  scroll-intersect="color:dodgerblue"
169
- scroll-target="#local-storage-usage-section">
169
+ scroll-selector="#local-storage-usage-section">
170
170
  <span
171
171
  class="display:flex align-items:center width:fit-content"
172
172
  hover="display:block!important"
173
- hover-target="[href='#local-storage-usage']">
173
+ hover-selector="[href='#local-storage-usage']">
174
174
  <h2 class="padding:5px_0px">Usage</h2>
175
175
  <a
176
176
  class="margin-left:10px display:none"
@@ -201,11 +201,11 @@
201
201
  class="margin-top:80px border-bottom:1px_solid_lightgrey"
202
202
  scroll
203
203
  scroll-intersect="color:dodgerblue"
204
- scroll-target="#local-storage-attributes-section">
204
+ scroll-selector="#local-storage-attributes-section">
205
205
  <span
206
206
  class="display:flex align-items:center width:fit-content"
207
207
  hover="display:block!important"
208
- hover-target="[href='#local-storage-attributes']">
208
+ hover-selector="[href='#local-storage-attributes']">
209
209
  <h2 class="padding:5px_0px">Attributes</h2>
210
210
  <a
211
211
  class="margin-left:10px display:none"
@@ -254,11 +254,11 @@
254
254
  class="border-bottom:1px_solid_lightgrey"
255
255
  scroll
256
256
  scroll-intersect="color:dodgerblue"
257
- scroll-target="#local-storage-demo-section">
257
+ scroll-selector="#local-storage-demo-section">
258
258
  <span
259
259
  class="display:flex align-items:center width:fit-content"
260
260
  hover="display:block!important"
261
- hover-target="[href='#local-storage-demo']">
261
+ hover-selector="[href='#local-storage-demo']">
262
262
  <h2 class="padding:5px_0px">Demo</h2>
263
263
  <a
264
264
  class="margin-left:10px display:none"
@@ -282,9 +282,9 @@
282
282
  <textarea
283
283
  type="code"
284
284
  lang="html"
285
- collection="demos"
286
- document_id=""
287
- name="demo"
285
+ array="demos"
286
+ object=""
287
+ key="demo"
288
288
  save="false"
289
289
  id="demo"
290
290
  class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
@@ -307,7 +307,7 @@
307
307
  show="#eye-slash"
308
308
  hide="#eye, #demo-preview"
309
309
  toggle="code-height"
310
- toggle-target="#demo-code"
310
+ toggle-selector="#demo-code"
311
311
  ><i
312
312
  class="height:18px fill:#505050"
313
313
  src="/assets/svg/eye.svg"></i
@@ -319,7 +319,7 @@
319
319
  show="#eye, #demo-preview"
320
320
  hide="#eye-slash"
321
321
  toggle="code-height"
322
- toggle-target="#demo-code"
322
+ toggle-selector="#demo-code"
323
323
  ><i
324
324
  class="height:20px fill:#505050"
325
325
  src="/assets/svg/eye-slash.svg"></i
@@ -346,7 +346,7 @@
346
346
  <a
347
347
  class="margin-right:5px"
348
348
  fullscreen
349
- fullscreen-target="#playground"></a>
349
+ fullscreen-selector="#playground"></a>
350
350
  </div>
351
351
  </div>
352
352
  <!-- End SandBox -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/local-storage",
3
- "version": "1.7.21",
3
+ "version": "1.9.0",
4
4
  "description": "A Simple component similar to CoCreate-input & CoCreate-fetch which Save and fetch data for inputs, textarea, selects from localstorage. Easily configured using HTML5 attributes and/or JavaScript API",
5
5
  "keywords": [
6
6
  "local-storage",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "scripts": {
27
27
  "start": "npx webpack --config webpack.config.js",
28
- "build": "NODE_ENV=production npx webpack --config webpack.config.js",
28
+ "build": "npx webpack --mode=production --config webpack.config.js",
29
29
  "dev": "npx webpack --config webpack.config.js --watch",
30
30
  "postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
31
31
  },
@@ -58,7 +58,7 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/actions": "^1.8.31",
62
- "@cocreate/observer": "^1.8.18"
61
+ "@cocreate/actions": "^1.9.0",
62
+ "@cocreate/observer": "^1.9.0"
63
63
  }
64
64
  }
package/src/index.js CHANGED
@@ -175,16 +175,16 @@ const CoCreateLocalStorage = {
175
175
  action.init({
176
176
  name: "localStorage",
177
177
  endEvent: "localStorage",
178
- callback: (btn, data) => {
179
- CoCreateLocalStorage.runStorage(btn)
178
+ callback: (data) => {
179
+ CoCreateLocalStorage.runStorage(data.element)
180
180
  },
181
181
  })
182
182
 
183
183
  action.init({
184
184
  name: "localStorageRemove",
185
185
  endEvent: "localStorageRemoved",
186
- callback: (btn, data) => {
187
- CoCreateLocalStorage.runStorage(btn)
186
+ callback: (data) => {
187
+ CoCreateLocalStorage.runStorage(data.element)
188
188
  },
189
189
  })
190
190
 
package/webpack.config.js CHANGED
@@ -1,84 +1,90 @@
1
1
  const path = require("path")
2
2
  const TerserPlugin = require("terser-webpack-plugin")
3
3
  const MiniCssExtractPlugin = require("mini-css-extract-plugin")
4
- let isProduction = process.env.NODE_ENV === "production"
5
4
  const { CleanWebpackPlugin } = require("clean-webpack-plugin")
6
5
 
7
- module.exports = {
8
- entry: {
9
- "CoCreate-local-storage": "./src/index.js",
10
- },
11
- output: {
12
- path: path.resolve(__dirname, "dist"),
13
- filename: isProduction ? "[name].min.js" : "[name].js",
14
- libraryTarget: "umd",
15
- libraryExport: "default",
16
- library: ["CoCreate", "localStorage"],
17
- globalObject: "this",
18
- },
6
+ module.exports = (env, argv) => {
7
+ let isProduction = false
8
+ if (argv.mode === 'production')
9
+ isProduction = true
19
10
 
20
- plugins: [
21
- new CleanWebpackPlugin(),
22
- new MiniCssExtractPlugin({
23
- filename: "[name].css",
24
- }),
25
- ],
26
- // Default mode for Webpack is production.
27
- // Depending on mode Webpack will apply different things
28
- // on final bundle. For now we don't need production's JavaScript
29
- // minifying and other thing so let's set mode to development
30
- mode: isProduction ? "production" : "development",
31
- module: {
32
- rules: [
33
- {
34
- test: /.js$/,
35
- exclude: /(node_modules)/,
36
- use: {
37
- loader: "babel-loader",
38
- options: {
39
- plugins: ["@babel/plugin-transform-modules-commonjs"],
40
- },
11
+ const config = {
12
+ entry: {
13
+ "CoCreate-local-storage": "./src/index.js",
41
14
  },
42
- },
43
- {
44
- test: /.css$/i,
45
- use: [
46
- { loader: "style-loader", options: { injectType: "linkTag" } },
47
- "file-loader",
15
+ output: {
16
+ path: path.resolve(__dirname, "dist"),
17
+ filename: isProduction ? "[name].min.js" : "[name].js",
18
+ libraryTarget: "umd",
19
+ libraryExport: "default",
20
+ library: ["CoCreate", "localStorage"],
21
+ globalObject: "this",
22
+ },
23
+
24
+ plugins: [
25
+ new CleanWebpackPlugin(),
26
+ new MiniCssExtractPlugin({
27
+ filename: "[name].css",
28
+ }),
48
29
  ],
49
- },
50
- ],
51
- },
30
+ // Default mode for Webpack is production.
31
+ // Depending on mode Webpack will apply different things
32
+ // on final bundle. For now we don't need production's JavaScript
33
+ // minifying and other thing so let's set mode to development
34
+ mode: isProduction ? "production" : "development",
35
+ module: {
36
+ rules: [
37
+ {
38
+ test: /.js$/,
39
+ exclude: /(node_modules)/,
40
+ use: {
41
+ loader: "babel-loader",
42
+ options: {
43
+ plugins: ["@babel/plugin-transform-modules-commonjs"],
44
+ },
45
+ },
46
+ },
47
+ {
48
+ test: /.css$/i,
49
+ use: [
50
+ { loader: "style-loader", options: { injectType: "linkTag" } },
51
+ "file-loader",
52
+ ],
53
+ },
54
+ ],
55
+ },
52
56
 
53
- // add source map
54
- ...(isProduction ? {} : { devtool: "eval-source-map" }),
57
+ // add source map
58
+ ...(isProduction ? {} : { devtool: "eval-source-map" }),
55
59
 
56
- optimization: {
57
- minimize: true,
58
- minimizer: [
59
- new TerserPlugin({
60
- extractComments: true,
61
- // cache: true,
62
- parallel: true,
63
- // sourceMap: true, // Must be set to true if using source-maps in production
64
- terserOptions: {
65
- // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
66
- // extractComments: 'all',
67
- compress: {
68
- drop_console: true,
69
- },
70
- },
71
- }),
72
- ],
73
- splitChunks: {
74
- chunks: "all",
75
- minSize: 200,
76
- // maxSize: 99999,
77
- //minChunks: 1,
60
+ optimization: {
61
+ minimize: true,
62
+ minimizer: [
63
+ new TerserPlugin({
64
+ extractComments: true,
65
+ // cache: true,
66
+ parallel: true,
67
+ // sourceMap: true, // Must be set to true if using source-maps in production
68
+ terserOptions: {
69
+ // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
70
+ // extractComments: 'all',
71
+ compress: {
72
+ drop_console: true,
73
+ },
74
+ },
75
+ }),
76
+ ],
77
+ splitChunks: {
78
+ chunks: "all",
79
+ minSize: 200,
80
+ // maxSize: 99999,
81
+ //minChunks: 1,
78
82
 
79
- cacheGroups: {
80
- defaultVendors: false,
81
- },
82
- },
83
- },
84
- }
83
+ cacheGroups: {
84
+ defaultVendors: false,
85
+ },
86
+ },
87
+ },
88
+ }
89
+ return config
90
+ }