@cocreate/fullscreen 1.5.22 → 1.6.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.6.0](https://github.com/CoCreate-app/CoCreate-fullscreen/compare/v1.5.23...v1.6.0) (2023-08-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * crud attributes renamed ([01d9fc0](https://github.com/CoCreate-app/CoCreate-fullscreen/commit/01d9fc0a8de86b4472acc13af72316e37df07005))
7
+ * replace -target -selector ([f9233cc](https://github.com/CoCreate-app/CoCreate-fullscreen/commit/f9233ccb149af46dc93445e57d1d7c7995f084fb))
8
+ * webpack.config and package.json make use of mode=production instead of process.env ([32ba4ba](https://github.com/CoCreate-app/CoCreate-fullscreen/commit/32ba4bafd5d36fd26e71178b90149cd65e07993c))
9
+
10
+
11
+ ### Features
12
+
13
+ * Add support for querying elements in fullscreen toggle ([a0eec19](https://github.com/CoCreate-app/CoCreate-fullscreen/commit/a0eec197fd2b4bd99b44df422628791c1e429f81))
14
+ * name attribute and variable renamed to key ([820630c](https://github.com/CoCreate-app/CoCreate-fullscreen/commit/820630c525c3021dbc7d3796621d8dfb58aac9be))
15
+
16
+ ## [1.5.23](https://github.com/CoCreate-app/CoCreate-fullscreen/compare/v1.5.22...v1.5.23) (2023-06-14)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([71d6731](https://github.com/CoCreate-app/CoCreate-fullscreen/commit/71d673149554e9eb7e92787d29e1946c273b6bcd))
22
+
1
23
  ## [1.5.22](https://github.com/CoCreate-app/CoCreate-fullscreen/compare/v1.5.21...v1.5.22) (2023-06-11)
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": "601f49be6b402c72efc07e09",
10
10
  "name": "index.html",
11
11
  "path": "/docs/fullscreen/index.html",
package/demo/index.html CHANGED
@@ -19,7 +19,7 @@
19
19
  <section>
20
20
  <h2>Only Target</h2>
21
21
  <button fullscreen>self</button>
22
- <button fullscreen fullscreen-target="#example2">
22
+ <button fullscreen fullscreen-selector="#example2">
23
23
  Target #example2
24
24
  </button>
25
25
  <button fullscreen fullscreen-closest="section">
@@ -149,6 +149,7 @@
149
149
  </div>
150
150
 
151
151
  <!--<script src="../dist/CoCreate-fullscreen.js"></script>-->
152
+ <!-- <script src="../../../CoCreateJS/dist/CoCreate.js"></script> -->
152
153
  <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
153
154
  </body>
154
155
  </html>
package/docs/index.html CHANGED
@@ -6,10 +6,10 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
 
8
8
  <meta
9
- name="description"
9
+ key="description"
10
10
  content="A simple HTML5 and pure javascript component. Easy configuration using HTML5 attributes or Javscript api and highly styleable." />
11
11
  <meta
12
- name="keywords"
12
+ key="keywords"
13
13
  content="helper classes, utility classes, css framework, css library, inline style classes" />
14
14
  <meta name="robots" content="index,follow" />
15
15
  <meta
@@ -27,9 +27,9 @@
27
27
  <link
28
28
  rel="stylesheet"
29
29
  href="/docs/index.css"
30
- collection="files"
31
- document_id="60888216117c640e7596303f"
32
- name="src"
30
+ array="files"
31
+ object="60888216117c640e7596303f"
32
+ key="src"
33
33
  type="text/css"
34
34
  save="true" />
35
35
  <link rel="manifest" href="/manifest.webmanifest" />
@@ -42,20 +42,20 @@
42
42
  scroll="sticky-nav,hide-nav"
43
43
  scroll-up="10"
44
44
  scroll-down="10"
45
- collection="files"
46
- document_id="60395ef42b3ac232657040fd"
47
- name="src"></nav>
45
+ array="files"
46
+ object="60395ef42b3ac232657040fd"
47
+ key="src"></nav>
48
48
  <sidenav
49
49
  id="menuL"
50
50
  class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
51
51
  resizable
52
- resize-target="[content_id='content']"
52
+ resize-selector="[content_id='content']"
53
53
  resize-property="margin-left"
54
54
  resize-value="width">
55
55
  <menu
56
- collection="files"
57
- document_id="603717b07de7fb350ae9fec8"
58
- name="src"></menu>
56
+ array="files"
57
+ object="603717b07de7fb350ae9fec8"
58
+ key="src"></menu>
59
59
  <div resize="right"></div>
60
60
  </sidenav>
61
61
  <main
@@ -78,7 +78,7 @@
78
78
  share-width="700"
79
79
  share-media="https://cdn.cocreate.app/docs/fullscreen.png"
80
80
  hover="display:block!important"
81
- hover-target=".social-networks">
81
+ hover-selector=".social-networks">
82
82
  <div class="display:none social-networks">
83
83
  <a
84
84
  class="margin-right:15px"
@@ -147,11 +147,11 @@
147
147
  class="border-bottom:1px_solid_lightgrey"
148
148
  scroll
149
149
  scroll-intersect="color:dodgerblue"
150
- scroll-target="#fullscreen-install-section">
150
+ scroll-selector="#fullscreen-install-section">
151
151
  <span
152
152
  class="display:flex align-items:center width:fit-content"
153
153
  hover="display:block!important"
154
- hover-target="[href='#fullscreen-install']">
154
+ hover-selector="[href='#fullscreen-install']">
155
155
  <h2 class="padding:5px_0px">Install</h2>
156
156
  <a
157
157
  class="margin-left:10px display:none"
@@ -173,11 +173,11 @@
173
173
  class="margin-top:80px border-bottom:1px_solid_lightgrey"
174
174
  scroll
175
175
  scroll-intersect="color:dodgerblue"
176
- scroll-target="#fullscreen-usage-section">
176
+ scroll-selector="#fullscreen-usage-section">
177
177
  <span
178
178
  class="display:flex align-items:center width:fit-content"
179
179
  hover="display:block!important"
180
- hover-target="[href='#fullscreen-usage']">
180
+ hover-selector="[href='#fullscreen-usage']">
181
181
  <h2 class="padding:5px_0px">Usage</h2>
182
182
  <a
183
183
  class="margin-left:10px display:none"
@@ -203,7 +203,7 @@
203
203
  &lt;/style&gt;
204
204
  &lt;section&gt;
205
205
  &lt;h2&gt;Only Target&lt;/h2&gt;
206
- &lt;button fullscreen fullscreen-target=&quot;#example2&quot;&gt;With Attr Target&lt;/button&gt;
206
+ &lt;button fullscreen fullscreen-selector=&quot;#example2&quot;&gt;With Attr Target&lt;/button&gt;
207
207
  &lt;button fullscreen &gt;WithOut Target&lt;/button&gt;
208
208
  &lt;/section&gt;
209
209
  &lt;section&gt;
@@ -226,11 +226,11 @@
226
226
  class="margin-top:80px border-bottom:1px_solid_lightgrey"
227
227
  scroll
228
228
  scroll-intersect="color:dodgerblue"
229
- scroll-target="#fullscreen-attributes-section">
229
+ scroll-selector="#fullscreen-attributes-section">
230
230
  <span
231
231
  class="display:flex align-items:center width:fit-content"
232
232
  hover="display:block!important"
233
- hover-target="[href='#fullscreen-attributes']">
233
+ hover-selector="[href='#fullscreen-attributes']">
234
234
  <h2 class="padding:5px_0px">Attributes</h2>
235
235
  <a
236
236
  class="margin-left:10px display:none"
@@ -266,11 +266,11 @@
266
266
  class="border-bottom:1px_solid_lightgrey"
267
267
  scroll
268
268
  scroll-intersect="color:dodgerblue"
269
- scroll-target="#fullscreen-demo-section">
269
+ scroll-selector="#fullscreen-demo-section">
270
270
  <span
271
271
  class="display:flex align-items:center width:fit-content"
272
272
  hover="display:block!important"
273
- hover-target="[href='#fullscreen-demo']">
273
+ hover-selector="[href='#fullscreen-demo']">
274
274
  <h2 class="padding:5px_0px">Demo</h2>
275
275
  <a
276
276
  class="margin-left:10px display:none"
@@ -294,9 +294,9 @@
294
294
  <textarea
295
295
  type="code"
296
296
  lang="html"
297
- collection="demos"
298
- document_id=""
299
- name="demo"
297
+ array="demos"
298
+ object=""
299
+ key="demo"
300
300
  save="false"
301
301
  id="demo"
302
302
  class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
@@ -319,7 +319,7 @@
319
319
  show="#eye-slash"
320
320
  hide="#eye, #demo-preview"
321
321
  toggle="code-height"
322
- toggle-target="#demo-code"
322
+ toggle-selector="#demo-code"
323
323
  ><i
324
324
  class="height:18px fill:#505050"
325
325
  src="/assets/svg/eye.svg"></i
@@ -331,7 +331,7 @@
331
331
  show="#eye, #demo-preview"
332
332
  hide="#eye-slash"
333
333
  toggle="code-height"
334
- toggle-target="#demo-code"
334
+ toggle-selector="#demo-code"
335
335
  ><i
336
336
  class="height:20px fill:#505050"
337
337
  src="/assets/svg/eye-slash.svg"></i
@@ -358,7 +358,7 @@
358
358
  <a
359
359
  class="margin-right:5px"
360
360
  fullscreen
361
- fullscreen-target="#playground"></a>
361
+ fullscreen-selector="#playground"></a>
362
362
  </div>
363
363
  </div>
364
364
  <!-- End SandBox -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/fullscreen",
3
- "version": "1.5.22",
3
+ "version": "1.6.0",
4
4
  "description": "Toggle any html element to view in fullscreen mode. Easy configuration and targeting using the fullscreen and target attribute.",
5
5
  "keywords": [
6
6
  "fullscreen",
@@ -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/cli": "^1.33.8",
62
- "@cocreate/observer": "^1.8.17"
61
+ "@cocreate/observer": "^1.8.19",
62
+ "@cocreate/utils": "^1.21.16"
63
63
  }
64
64
  }
package/src/index.js CHANGED
@@ -5,6 +5,7 @@
5
5
  * https://github.com/CoCreate-app/Fullscreen_Toggle/blob/master/LICENSE
6
6
  */
7
7
  import observer from '@cocreate/observer';
8
+ import { queryElements } from '@cocreate/utils';
8
9
  import './index.css';
9
10
 
10
11
  function init() {
@@ -17,29 +18,20 @@ function initElements(elements) {
17
18
  element.addEventListener("click", function (event) {
18
19
  let isFullscreen = element.getAttribute('fullscreen')
19
20
  if (!isFullscreen || isFullscreen === 'false') {
20
- const fullscreenTarget = element.getAttribute('fullscreen-target');
21
- const fullscreenClosest = element.getAttribute('fullscreen-closest');
22
- const fullscreenParent = element.getAttribute('fullscreen-parent');
23
- const fullscreenNext = element.getAttribute('fullscreen-next');
24
- const fullscreenPrevious = element.getAttribute('fullscreen-previous');
25
-
26
- let target = document.body;
27
- if (fullscreenTarget)
28
- target = document.querySelector(fullscreenTarget)
29
- else if (fullscreenClosest)
30
- target = element.closest(fullscreenClosest)
31
- else if (fullscreenParent)
32
- target = element.parentElement.querySelector(fullscreenParent)
33
- else if (fullscreenNext)
34
- target = element.nextElementSibling.querySelector(fullscreenNext)
35
- else if (fullscreenPrevious)
36
- target = element.previousElementSibling.querySelector(fullscreenPrevious)
21
+ let target = queryElements({ element, prefix: 'fullscreen' })
22
+
23
+ // TODO: support array?
24
+ if (target === false)
25
+ target = document.body
26
+ else
27
+ target = target[0]
28
+
37
29
  if (target) {
38
30
  element.setAttribute('fullscreen', true)
39
31
  requestFullscreen(target);
40
32
  }
41
33
  } else {
42
- element.setAttribute('fullscreen', false)
34
+ element.setAttribute('fullscreen', false)
43
35
  exitFullscreen();
44
36
  }
45
37
  });
@@ -93,16 +85,16 @@ observer.init({
93
85
  name: 'CoCreateFullscreen',
94
86
  observe: ['addedNodes'],
95
87
  target: '[fullscreen]',
96
- callback: mutation =>
88
+ callback: mutation =>
97
89
  initElements([mutation.target])
98
90
  });
99
91
 
100
92
  observer.init({
101
- name: 'CoCreateFullscreen',
102
- observe: ['attributes'],
103
- attributeName: ['fullscreen'],
104
- target: '[fullscreen]',
105
- callback: mutation => {
93
+ name: 'CoCreateFullscreen',
94
+ observe: ['attributes'],
95
+ attributeName: ['fullscreen'],
96
+ target: '[fullscreen]',
97
+ callback: mutation => {
106
98
  if (mutation.oldValue === null)
107
99
  initElements([mutation.target])
108
100
  }
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-fullscreen": "./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", "fullscreen"],
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-fullscreen": "./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", "fullscreen"],
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
+ }