cloudcannon-jekyll-bookshop 2.0.0.pre.beta.5 → 2.0.0.pre.beta.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2452e24643a367dd3ad52d0c40c50f4c9151278beed94ffe38cb824bfd0dc86b
4
- data.tar.gz: 2f12fcbadd7593b11c35deaa532bb43f9df30defcecf7f20f60f9ec36199ba32
3
+ metadata.gz: 458817d5d30e213affa17fc2ea232b025e0ed654289cc7194a43e6efcb5a7b57
4
+ data.tar.gz: 230c099e74778eabcdfe8a9e6afb8fc7266abeed0c9f5b1584e95d62e01cbefb
5
5
  SHA512:
6
- metadata.gz: 8f18a82009a302d78a867b9291d49aef6bdeb602bcc2ece498bad2f82925f1d683b9c492a8d4b099a52da069379a410f23ab8851bf946053278bdd1969d96a2b
7
- data.tar.gz: e40786e63f82f034ef27faffc83500df8c4e4f3ab0ff413877fce704f4cbaa520ab5e67b7ad1fd3ed35fe2f88015a9935bc13535022e37032367c1a6706df28a
6
+ metadata.gz: 1d8e756567dfe7c750a2dff25c917dd432f7b964c03daa7d10d2eaef4878853ad90ca4c34a699c538387a763eaca85ed6599d11c82487ba7bad25d39e1fd4fb8
7
+ data.tar.gz: '008884d4e82852c006718fc8121c7cd34ee244bf8172317793e95f1aa2b4daf5bfb8a1233183e91a20500bcc68d549972083bbdb14de02776ba00c3bda1468e0'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudcannon-jekyll-bookshop (2.0.0.pre.beta.5)
4
+ cloudcannon-jekyll-bookshop (2.0.0.pre.beta.6)
5
5
  dry-inflector (>= 0.1, < 1.0)
6
6
  jekyll (>= 3.7, < 5.0)
7
7
  node-runner (>= 1.0, < 2.0)
@@ -3,6 +3,9 @@
3
3
  require "jekyll"
4
4
  require_relative "./cloudcannon-jekyll-bookshop/output-site-data"
5
5
  require_relative "./cloudcannon-jekyll-bookshop/structures"
6
+ require_relative "./cloudcannon-jekyll-bookshop/tags/live-tag"
7
+
8
+ Liquid::Template.register_tag("bookshop_live", CloudCannonJekyllBookshop::LiveTag)
6
9
 
7
10
  Jekyll::Hooks.register :site, :after_init do |site|
8
11
  CloudCannonJekyllBookshop::Structures.build_structures(site)
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CloudCannonJekyllBookshop
4
+ class LiveTag < Liquid::Tag
5
+ def initialize(tag_name, markup, tokens)
6
+ super
7
+ @script = markup.strip
8
+ end
9
+
10
+ def render(context)
11
+ site = context.registers[:site]
12
+
13
+ "<script>
14
+ window.addEventListener('load', function() {
15
+ if (window.inEditorMode) {
16
+ const head = document.querySelector('head');
17
+ const script = document.createElement('script');
18
+ script.src = `/#{@script}`;
19
+ script.onload = function() {
20
+ window.bookshopLive = new window.BookshopLive();
21
+ window.CloudCannon = {
22
+ trigger: function (eventName, frontMatter) {
23
+ if (typeof frontMatter === 'string') frontMatter = JSON.parse(frontMatter);
24
+ window.bookshopLive.update({page: frontMatter});
25
+ }
26
+ }
27
+ }
28
+ head.appendChild(script);
29
+ }
30
+ });
31
+ </script>"
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudCannonJekyllBookshop
4
- VERSION = "2.0.0.pre.beta.5"
4
+ VERSION = "2.0.0.pre.beta.6"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bookshop/cloudcannon-structures",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "Convert a Bookshop object into a CloudCannon structure",
5
5
  "main": "main.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "devDependencies": {
19
- "@bookshop/toml-narrator": "2.0.0-beta.5",
19
+ "@bookshop/toml-narrator": "2.0.0-beta.6",
20
20
  "@ltd/j-toml": "^1.12.2",
21
21
  "ava": "^3.15.0",
22
22
  "nyc": "^15.1.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bookshop/toml-narrator",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "Rewrite Bookshop TOML files to preserve comments",
5
5
  "main": "main.js",
6
6
  "scripts": {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudcannon-jekyll-bookshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.beta.5
4
+ version: 2.0.0.pre.beta.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam Bigelow
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-02 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -153,6 +153,7 @@ files:
153
153
  - lib/cloudcannon-jekyll-bookshop/output-site-data.rb
154
154
  - lib/cloudcannon-jekyll-bookshop/page-without-a-file.rb
155
155
  - lib/cloudcannon-jekyll-bookshop/structures.rb
156
+ - lib/cloudcannon-jekyll-bookshop/tags/live-tag.rb
156
157
  - lib/cloudcannon-jekyll-bookshop/version.rb
157
158
  - node_modules/@bookshop/cloudcannon-structures/main.js
158
159
  - node_modules/@bookshop/cloudcannon-structures/package.json