lookbook 1.0.3 → 1.0.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.
- checksums.yaml +4 -4
- data/app/components/lookbook/base_component.rb +10 -2
- data/app/components/lookbook/copy_button/component.rb +1 -1
- data/app/components/lookbook/dimensions_display/component.rb +1 -4
- data/app/components/lookbook/embed/component.rb +1 -1
- data/app/components/lookbook/icon/component.rb +1 -5
- data/app/components/lookbook/nav/item/component.rb +2 -2
- data/app/components/lookbook/params_editor/field/component.rb +1 -1
- data/app/helpers/lookbook/component_helper.rb +2 -1
- data/lib/lookbook/engine.rb +1 -1
- data/lib/lookbook/version.rb +1 -1
- data/public/lookbook-assets/js/lookbook.js +112 -112
- data/public/lookbook-assets/js/lookbook.js.map +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd24f301fb1e05131ba58a2d236b15155f38b372c52ada4823ea6f76111dc0b1
|
4
|
+
data.tar.gz: 8675198f147aa93461a89964ad2b28461facdd672088b3edfe0880ea1b293545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a9e80161cf8880083c2138144304dfc5427478c8114073f9409e3fb883eddf9abe7e055aea33b16625316c15be15fd139b8ab3607d808ff90419b5ad95b4eab
|
7
|
+
data.tar.gz: 1e1836fdad458167f63e3736d3d99107b1a0346da530fe57f9be03eb188c029d5891c8534999475673aa78fd02c645c37edb181b5960165316172bcf5cded59b
|
@@ -31,11 +31,19 @@ module Lookbook
|
|
31
31
|
nil
|
32
32
|
end
|
33
33
|
|
34
|
+
def alpine_encode(data)
|
35
|
+
if data.is_a? String
|
36
|
+
"\'#{json_escape data}\'"
|
37
|
+
else
|
38
|
+
json_escape data.to_json.tr("\"", "\'")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
34
42
|
def prepare_alpine_data(x_data = nil)
|
35
43
|
alpine_component_name = x_data || @html_attrs&.dig(:"x-data") || alpine_component
|
36
44
|
if alpine_component_name.present?
|
37
|
-
args = Array.wrap(alpine_data)
|
38
|
-
args.any? ? "#{alpine_component_name}(#{
|
45
|
+
args = Array.wrap(alpine_data).compact
|
46
|
+
args.any? ? "#{alpine_component_name}(#{args.join(",")})" : alpine_component_name
|
39
47
|
end
|
40
48
|
end
|
41
49
|
end
|
@@ -2,15 +2,12 @@ module Lookbook
|
|
2
2
|
class DimensionsDisplay::Component < Lookbook::BaseComponent
|
3
3
|
def initialize(target:, **html_attrs)
|
4
4
|
@target = target
|
5
|
+
@alpine_data = alpine_encode(@target)
|
5
6
|
super(**html_attrs)
|
6
7
|
end
|
7
8
|
|
8
9
|
protected
|
9
10
|
|
10
|
-
def alpine_data
|
11
|
-
@target.to_json
|
12
|
-
end
|
13
|
-
|
14
11
|
def alpine_component
|
15
12
|
"dimensionsDisplayComponent"
|
16
13
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Lookbook
|
2
2
|
class Icon::Component < Lookbook::BaseComponent
|
3
3
|
def initialize(name:, size: 4, **html_attrs)
|
4
|
-
@
|
4
|
+
@alpine_data = name.is_a?(Symbol) ? alpine_encode(name.to_s.tr("_", "-")) : name
|
5
5
|
@size = size || 4
|
6
6
|
super(**html_attrs)
|
7
7
|
end
|
@@ -12,10 +12,6 @@ module Lookbook
|
|
12
12
|
|
13
13
|
protected
|
14
14
|
|
15
|
-
def alpine_data
|
16
|
-
@icon_name
|
17
|
-
end
|
18
|
-
|
19
15
|
def alpine_component
|
20
16
|
"iconComponent"
|
21
17
|
end
|
data/lib/lookbook/engine.rb
CHANGED
@@ -171,7 +171,7 @@ module Lookbook
|
|
171
171
|
def websocket
|
172
172
|
config = Lookbook.config
|
173
173
|
return @websocket unless @websocket.nil?
|
174
|
-
return unless config.auto_refresh == true
|
174
|
+
return unless config.auto_refresh == true && !Rails.env.test?
|
175
175
|
Lookbook.logger.info "Initializing websocket"
|
176
176
|
|
177
177
|
cable = ActionCable::Server::Configuration.new
|
data/lib/lookbook/version.rb
CHANGED
@@ -7701,7 +7701,7 @@ function $5439cede634b2921$var$toCamel(s) {
|
|
7701
7701
|
}
|
7702
7702
|
|
7703
7703
|
|
7704
|
-
var $
|
7704
|
+
var $d865a31e17cd1079$exports = {};
|
7705
7705
|
var $cbd28b10fa9798c7$exports = {};
|
7706
7706
|
|
7707
7707
|
$parcel$defineInteropFlag($cbd28b10fa9798c7$exports);
|
@@ -11364,57 +11364,34 @@ function $99486586f6691564$export$2e2bcd8739ae039() {
|
|
11364
11364
|
}
|
11365
11365
|
|
11366
11366
|
|
11367
|
-
var $
|
11368
|
-
|
11369
|
-
$parcel$defineInteropFlag($47a1c62621be0c54$exports);
|
11370
|
-
|
11371
|
-
$parcel$export($47a1c62621be0c54$exports, "default", () => $47a1c62621be0c54$export$2e2bcd8739ae039);
|
11372
|
-
var $122263eab94cad08$exports = {};
|
11373
|
-
|
11374
|
-
$parcel$defineInteropFlag($122263eab94cad08$exports);
|
11375
|
-
|
11376
|
-
$parcel$export($122263eab94cad08$exports, "initClipboard", () => $122263eab94cad08$export$c6684e6159b21de3);
|
11377
|
-
$parcel$export($122263eab94cad08$exports, "default", () => $122263eab94cad08$export$2e2bcd8739ae039);
|
11378
|
-
|
11379
|
-
function $122263eab94cad08$export$c6684e6159b21de3(context = {}) {
|
11380
|
-
let copyTimeout = null;
|
11381
|
-
return Object.assign(context, {
|
11382
|
-
copied: false,
|
11383
|
-
async copyToClipboard (target = null) {
|
11384
|
-
let targetEl;
|
11385
|
-
if (this.$refs.copyTarget) targetEl = this.$refs.copyTarget;
|
11386
|
-
else if (typeof target === "string") targetEl = document.querySelector(target);
|
11387
|
-
if (!targetEl) {
|
11388
|
-
this.warn("Could not find copy target");
|
11389
|
-
return false;
|
11390
|
-
}
|
11391
|
-
const content = (0, $7ae6ae39c2ec9059$export$6cb344a21ca18aec)(targetEl.innerHTML.trim());
|
11392
|
-
await window.navigator.clipboard.writeText(content);
|
11393
|
-
this.copied = true;
|
11394
|
-
if (copyTimeout) clearTimeout(copyTimeout);
|
11395
|
-
copyTimeout = setTimeout(()=>{
|
11396
|
-
this.copied = false;
|
11397
|
-
this.onCopyComplete();
|
11398
|
-
}, 1000);
|
11399
|
-
return content;
|
11400
|
-
},
|
11401
|
-
onCopyComplete () {}
|
11402
|
-
});
|
11403
|
-
}
|
11404
|
-
function $122263eab94cad08$export$2e2bcd8739ae039() {
|
11405
|
-
return $122263eab94cad08$export$c6684e6159b21de3({});
|
11406
|
-
}
|
11367
|
+
var $e398acaded942bbe$exports = {};
|
11407
11368
|
|
11369
|
+
$parcel$defineInteropFlag($e398acaded942bbe$exports);
|
11408
11370
|
|
11371
|
+
$parcel$export($e398acaded942bbe$exports, "default", () => $e398acaded942bbe$export$2e2bcd8739ae039);
|
11409
11372
|
|
11410
|
-
function $
|
11411
|
-
const button = (0, $cbd28b10fa9798c7$export$2e2bcd8739ae039)();
|
11373
|
+
function $e398acaded942bbe$export$2e2bcd8739ae039(targetSelector) {
|
11412
11374
|
return {
|
11413
|
-
|
11414
|
-
|
11375
|
+
width: 0,
|
11376
|
+
height: 0,
|
11377
|
+
resizing: false,
|
11378
|
+
target: null,
|
11415
11379
|
init () {
|
11416
|
-
|
11417
|
-
|
11380
|
+
this.target = document.querySelector(targetSelector);
|
11381
|
+
if (this.target) {
|
11382
|
+
this.width = Math.round(this.target.clientWidth);
|
11383
|
+
this.height = Math.round(this.target.clientHeight);
|
11384
|
+
this.createObserver();
|
11385
|
+
}
|
11386
|
+
},
|
11387
|
+
createObserver () {
|
11388
|
+
if (this.target) this.observer = (0, $9930d46698775b42$export$a2214cc2adb2dc44)(document.querySelector(targetSelector), ({ width: width , height: height })=>{
|
11389
|
+
this.width = width;
|
11390
|
+
this.height = height;
|
11391
|
+
});
|
11392
|
+
},
|
11393
|
+
tearDown () {
|
11394
|
+
if (this.observer) this.observer.disconnect();
|
11418
11395
|
}
|
11419
11396
|
};
|
11420
11397
|
}
|
@@ -12285,39 +12262,6 @@ function $e1f51f020443edd4$export$2e2bcd8739ae039(id, embedStore) {
|
|
12285
12262
|
}
|
12286
12263
|
|
12287
12264
|
|
12288
|
-
var $e398acaded942bbe$exports = {};
|
12289
|
-
|
12290
|
-
$parcel$defineInteropFlag($e398acaded942bbe$exports);
|
12291
|
-
|
12292
|
-
$parcel$export($e398acaded942bbe$exports, "default", () => $e398acaded942bbe$export$2e2bcd8739ae039);
|
12293
|
-
|
12294
|
-
function $e398acaded942bbe$export$2e2bcd8739ae039(targetSelector) {
|
12295
|
-
return {
|
12296
|
-
width: 0,
|
12297
|
-
height: 0,
|
12298
|
-
resizing: false,
|
12299
|
-
target: null,
|
12300
|
-
init () {
|
12301
|
-
this.target = document.querySelector(targetSelector);
|
12302
|
-
if (this.target) {
|
12303
|
-
this.width = Math.round(this.target.clientWidth);
|
12304
|
-
this.height = Math.round(this.target.clientHeight);
|
12305
|
-
this.createObserver();
|
12306
|
-
}
|
12307
|
-
},
|
12308
|
-
createObserver () {
|
12309
|
-
if (this.target) this.observer = (0, $9930d46698775b42$export$a2214cc2adb2dc44)(document.querySelector(targetSelector), ({ width: width , height: height })=>{
|
12310
|
-
this.width = width;
|
12311
|
-
this.height = height;
|
12312
|
-
});
|
12313
|
-
},
|
12314
|
-
tearDown () {
|
12315
|
-
if (this.observer) this.observer.disconnect();
|
12316
|
-
}
|
12317
|
-
};
|
12318
|
-
}
|
12319
|
-
|
12320
|
-
|
12321
12265
|
var $e9904a14dabf652d$exports = {};
|
12322
12266
|
|
12323
12267
|
$parcel$defineInteropFlag($e9904a14dabf652d$exports);
|
@@ -12343,6 +12287,62 @@ function $e9904a14dabf652d$export$2e2bcd8739ae039(store) {
|
|
12343
12287
|
}
|
12344
12288
|
|
12345
12289
|
|
12290
|
+
var $47a1c62621be0c54$exports = {};
|
12291
|
+
|
12292
|
+
$parcel$defineInteropFlag($47a1c62621be0c54$exports);
|
12293
|
+
|
12294
|
+
$parcel$export($47a1c62621be0c54$exports, "default", () => $47a1c62621be0c54$export$2e2bcd8739ae039);
|
12295
|
+
var $122263eab94cad08$exports = {};
|
12296
|
+
|
12297
|
+
$parcel$defineInteropFlag($122263eab94cad08$exports);
|
12298
|
+
|
12299
|
+
$parcel$export($122263eab94cad08$exports, "initClipboard", () => $122263eab94cad08$export$c6684e6159b21de3);
|
12300
|
+
$parcel$export($122263eab94cad08$exports, "default", () => $122263eab94cad08$export$2e2bcd8739ae039);
|
12301
|
+
|
12302
|
+
function $122263eab94cad08$export$c6684e6159b21de3(context = {}) {
|
12303
|
+
let copyTimeout = null;
|
12304
|
+
return Object.assign(context, {
|
12305
|
+
copied: false,
|
12306
|
+
async copyToClipboard (target = null) {
|
12307
|
+
let targetEl;
|
12308
|
+
if (this.$refs.copyTarget) targetEl = this.$refs.copyTarget;
|
12309
|
+
else if (typeof target === "string") targetEl = document.querySelector(target);
|
12310
|
+
if (!targetEl) {
|
12311
|
+
this.warn("Could not find copy target");
|
12312
|
+
return false;
|
12313
|
+
}
|
12314
|
+
const content = (0, $7ae6ae39c2ec9059$export$6cb344a21ca18aec)(targetEl.innerHTML.trim());
|
12315
|
+
await window.navigator.clipboard.writeText(content);
|
12316
|
+
this.copied = true;
|
12317
|
+
if (copyTimeout) clearTimeout(copyTimeout);
|
12318
|
+
copyTimeout = setTimeout(()=>{
|
12319
|
+
this.copied = false;
|
12320
|
+
this.onCopyComplete();
|
12321
|
+
}, 1000);
|
12322
|
+
return content;
|
12323
|
+
},
|
12324
|
+
onCopyComplete () {}
|
12325
|
+
});
|
12326
|
+
}
|
12327
|
+
function $122263eab94cad08$export$2e2bcd8739ae039() {
|
12328
|
+
return $122263eab94cad08$export$c6684e6159b21de3({});
|
12329
|
+
}
|
12330
|
+
|
12331
|
+
|
12332
|
+
|
12333
|
+
function $47a1c62621be0c54$export$2e2bcd8739ae039() {
|
12334
|
+
const button = (0, $cbd28b10fa9798c7$export$2e2bcd8739ae039)();
|
12335
|
+
return {
|
12336
|
+
...button,
|
12337
|
+
copied: false,
|
12338
|
+
init () {
|
12339
|
+
button.init.bind(this)();
|
12340
|
+
(0, $122263eab94cad08$export$c6684e6159b21de3)(this);
|
12341
|
+
}
|
12342
|
+
};
|
12343
|
+
}
|
12344
|
+
|
12345
|
+
|
12346
12346
|
var $36506012e0c6e9e3$exports = {};
|
12347
12347
|
|
12348
12348
|
$parcel$defineInteropFlag($36506012e0c6e9e3$exports);
|
@@ -12964,33 +12964,6 @@ function $506dabb2bf255b38$var$sizeSplits(sizes) {
|
|
12964
12964
|
}
|
12965
12965
|
|
12966
12966
|
|
12967
|
-
var $a87dacf5139b5e2f$exports = {};
|
12968
|
-
|
12969
|
-
$parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
|
12970
|
-
|
12971
|
-
$parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
|
12972
|
-
function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
|
12973
|
-
return {
|
12974
|
-
get store () {
|
12975
|
-
return store || this;
|
12976
|
-
},
|
12977
|
-
get id () {
|
12978
|
-
return this.$root.id;
|
12979
|
-
},
|
12980
|
-
get panels () {
|
12981
|
-
return Array.from(this.$refs.panels.children);
|
12982
|
-
},
|
12983
|
-
isActive (el) {
|
12984
|
-
return this.store.activeTab === this._getRef(el);
|
12985
|
-
},
|
12986
|
-
// protected
|
12987
|
-
_getRef (el) {
|
12988
|
-
return el.getAttribute("x-ref");
|
12989
|
-
}
|
12990
|
-
};
|
12991
|
-
}
|
12992
|
-
|
12993
|
-
|
12994
12967
|
var $0db07828cadc68e0$exports = {};
|
12995
12968
|
|
12996
12969
|
$parcel$defineInteropFlag($0db07828cadc68e0$exports);
|
@@ -13083,6 +13056,33 @@ function $0db07828cadc68e0$export$2e2bcd8739ae039(store) {
|
|
13083
13056
|
}
|
13084
13057
|
|
13085
13058
|
|
13059
|
+
var $a87dacf5139b5e2f$exports = {};
|
13060
|
+
|
13061
|
+
$parcel$defineInteropFlag($a87dacf5139b5e2f$exports);
|
13062
|
+
|
13063
|
+
$parcel$export($a87dacf5139b5e2f$exports, "default", () => $a87dacf5139b5e2f$export$2e2bcd8739ae039);
|
13064
|
+
function $a87dacf5139b5e2f$export$2e2bcd8739ae039(store) {
|
13065
|
+
return {
|
13066
|
+
get store () {
|
13067
|
+
return store || this;
|
13068
|
+
},
|
13069
|
+
get id () {
|
13070
|
+
return this.$root.id;
|
13071
|
+
},
|
13072
|
+
get panels () {
|
13073
|
+
return Array.from(this.$refs.panels.children);
|
13074
|
+
},
|
13075
|
+
isActive (el) {
|
13076
|
+
return this.store.activeTab === this._getRef(el);
|
13077
|
+
},
|
13078
|
+
// protected
|
13079
|
+
_getRef (el) {
|
13080
|
+
return el.getAttribute("x-ref");
|
13081
|
+
}
|
13082
|
+
};
|
13083
|
+
}
|
13084
|
+
|
13085
|
+
|
13086
13086
|
var $6d64716f0b34fdf4$exports = {};
|
13087
13087
|
|
13088
13088
|
$parcel$defineInteropFlag($6d64716f0b34fdf4$exports);
|
@@ -13210,19 +13210,19 @@ function $6d64716f0b34fdf4$export$2e2bcd8739ae039(store) {
|
|
13210
13210
|
}
|
13211
13211
|
|
13212
13212
|
|
13213
|
-
$
|
13213
|
+
$d865a31e17cd1079$exports = {
|
13214
13214
|
"button": $cbd28b10fa9798c7$exports,
|
13215
13215
|
"code": $99486586f6691564$exports,
|
13216
|
-
"copy_button": $47a1c62621be0c54$exports,
|
13217
|
-
"embed": $e1f51f020443edd4$exports,
|
13218
13216
|
"dimensions_display": $e398acaded942bbe$exports,
|
13217
|
+
"embed": $e1f51f020443edd4$exports,
|
13219
13218
|
"filter": $e9904a14dabf652d$exports,
|
13219
|
+
"copy_button": $47a1c62621be0c54$exports,
|
13220
13220
|
"icon": $36506012e0c6e9e3$exports,
|
13221
13221
|
"nav": $d92d9d5253f84566$exports,
|
13222
13222
|
"params_editor": $b63b9c6d236b3f65$exports,
|
13223
13223
|
"split_layout": $506dabb2bf255b38$exports,
|
13224
|
-
"tab_panels": $a87dacf5139b5e2f$exports,
|
13225
13224
|
"tabs": $0db07828cadc68e0$exports,
|
13225
|
+
"tab_panels": $a87dacf5139b5e2f$exports,
|
13226
13226
|
"viewport": $6d64716f0b34fdf4$exports
|
13227
13227
|
};
|
13228
13228
|
|
@@ -13367,7 +13367,7 @@ const $d73574cc5e9b9e72$var$prefix = window.APP_NAME;
|
|
13367
13367
|
// Components
|
13368
13368
|
(0, $caa9439642c6336c$export$2e2bcd8739ae039).data("app", (0, $d709d0f4027033b2$export$2e2bcd8739ae039));
|
13369
13369
|
[
|
13370
|
-
$
|
13370
|
+
$d865a31e17cd1079$exports,
|
13371
13371
|
$e4eab7529959b73b$exports,
|
13372
13372
|
$4979d2d897a1c01f$exports
|
13373
13373
|
].forEach((scripts)=>{
|