lookbook 3.0.0.alpha.1 → 3.0.0.alpha.2
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/README.md +8 -261
- data/app/components/lookbook/ui/app/router/router.html.erb +1 -0
- data/app/components/lookbook/ui/app/router/router.js +29 -3
- data/app/components/lookbook/ui/elements/nav/nav_item/nav_item.js +2 -4
- data/app/components/lookbook/ui/elements/viewport/viewport.css +1 -0
- data/app/components/lookbook/ui/elements/viewport/viewport.html.erb +0 -1
- data/app/components/lookbook/ui/elements/viewport/viewport.rb +1 -6
- data/app/components/lookbook/ui/previews/preview_embed/preview_embed.html.erb +1 -2
- data/app/components/lookbook/ui/previews/preview_embed/preview_embed.rb +5 -4
- data/app/components/lookbook/ui/previews/preview_inspector/preview_inspector.html.erb +2 -2
- data/app/components/lookbook/ui/previews/preview_inspector/preview_inspector.rb +3 -2
- data/app/controllers/lookbook/events_controller.rb +4 -0
- data/app/controllers/lookbook/previews_controller.rb +1 -1
- data/app/views/layouts/lookbook/embed.html.erb +1 -1
- data/app/views/lookbook/inspector/panels/_preview.html.erb +1 -2
- data/app/views/lookbook/previews/embed.html.erb +1 -1
- data/app/views/lookbook/previews/inspect.html.erb +1 -0
- data/app/views/lookbook/previews/scenario.html.erb +5 -1
- data/config/initializers/05_autoload_previews.rb +2 -2
- data/config/routes.rb +2 -1
- data/lib/lookbook/concerns/feature_checks.rb +17 -0
- data/lib/lookbook/config.rb +2 -3
- data/lib/lookbook/directory_entity.rb +72 -0
- data/lib/lookbook/engine.rb +1 -1
- data/lib/lookbook/entity.rb +4 -2
- data/lib/lookbook/entity_tree.rb +17 -2
- data/lib/lookbook/pages/page_directories.rb +20 -0
- data/lib/lookbook/pages/page_directory_entity.rb +9 -40
- data/lib/lookbook/pages/page_entity.rb +4 -2
- data/lib/lookbook/pages/pages.rb +5 -14
- data/lib/lookbook/previews/preview_directories.rb +20 -0
- data/lib/lookbook/previews/preview_directory_entity.rb +8 -35
- data/lib/lookbook/previews/preview_entity.rb +7 -8
- data/lib/lookbook/previews/previews.rb +14 -15
- data/lib/lookbook/previews/scenario_entity.rb +1 -1
- data/lib/lookbook/reloader.rb +3 -6
- data/lib/lookbook/services/list_resolver.rb +13 -2
- data/lib/lookbook/services/styles_extractor.rb +1 -1
- data/lib/lookbook/utils.rb +4 -0
- data/lib/lookbook/version.rb +1 -1
- data/lib/lookbook.rb +0 -1
- data/public/lookbook-assets/app.css +2 -0
- data/public/lookbook-assets/app.js +48 -8
- metadata +6 -17
- data/lib/lookbook/previews/tags/priority_tag.rb +0 -11
@@ -7942,16 +7942,19 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
7942
7942
|
constructor(endpoint) {
|
7943
7943
|
this.endpoint = endpoint;
|
7944
7944
|
this.source = null;
|
7945
|
+
this.broadcastChannel = this.initBroadCastChannel();
|
7945
7946
|
this.handlers = [];
|
7946
7947
|
this.$logger = new Logger("EventsListener");
|
7947
7948
|
addEventListener("visibilitychange", () => {
|
7948
|
-
document.hidden
|
7949
|
+
if (!document.hidden)
|
7950
|
+
this.start();
|
7949
7951
|
});
|
7950
7952
|
}
|
7951
7953
|
start() {
|
7952
7954
|
if (!this.source) {
|
7953
7955
|
this.$logger.debug(`Starting`);
|
7954
7956
|
this.source = this.initSource();
|
7957
|
+
this.broadcastStart();
|
7955
7958
|
}
|
7956
7959
|
}
|
7957
7960
|
stop() {
|
@@ -7984,6 +7987,21 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
7984
7987
|
window.onbeforeunload = () => this.stop();
|
7985
7988
|
return source;
|
7986
7989
|
}
|
7990
|
+
initBroadCastChannel() {
|
7991
|
+
const bc = new BroadcastChannel("lookbook_events");
|
7992
|
+
bc.addEventListener("message", (event) => {
|
7993
|
+
const data2 = JSON.parse(event.data);
|
7994
|
+
if (data2.type === "event-source-start") {
|
7995
|
+
this.stop();
|
7996
|
+
}
|
7997
|
+
});
|
7998
|
+
return bc;
|
7999
|
+
}
|
8000
|
+
broadcastStart() {
|
8001
|
+
this.broadcastChannel.postMessage(
|
8002
|
+
JSON.stringify({ type: "event-source-start" })
|
8003
|
+
);
|
8004
|
+
}
|
7987
8005
|
};
|
7988
8006
|
|
7989
8007
|
// assets/js/helpers.js
|
@@ -8017,6 +8035,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
8017
8035
|
return {
|
8018
8036
|
serverEventsListener: null,
|
8019
8037
|
routerLogger: null,
|
8038
|
+
lastUpdate: Date.now(),
|
8039
|
+
morphing: false,
|
8020
8040
|
init() {
|
8021
8041
|
this.routerLogger = new Logger("Router");
|
8022
8042
|
if (sseEndpoint) {
|
@@ -8034,6 +8054,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
8034
8054
|
await this.updateDOM(location, "router", {
|
8035
8055
|
headers: { "X-Lookbook-Frame": "root" }
|
8036
8056
|
});
|
8057
|
+
this.lastUpdate = Date.now();
|
8037
8058
|
this.routerLogger.info(`Page updated`);
|
8038
8059
|
this.$dispatch("page-update:complete");
|
8039
8060
|
},
|
@@ -8045,15 +8066,31 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
8045
8066
|
if (updateHistory) {
|
8046
8067
|
history.pushState({}, "", result.url);
|
8047
8068
|
}
|
8069
|
+
this.lastUpdate = Date.now();
|
8048
8070
|
this.routerLogger.debug(`Page loaded`);
|
8049
8071
|
this.$dispatch("page-load:complete");
|
8050
8072
|
},
|
8073
|
+
async handleError(error2) {
|
8074
|
+
if (this.morphing) {
|
8075
|
+
const { stack } = error2.error;
|
8076
|
+
if (stack.indexOf("Alpine") >= 0) {
|
8077
|
+
window.location.reload();
|
8078
|
+
}
|
8079
|
+
}
|
8080
|
+
},
|
8051
8081
|
async updateDOM(url, selector, options = {}) {
|
8082
|
+
if (this.morphing) {
|
8083
|
+
return;
|
8084
|
+
}
|
8052
8085
|
const result = await fetchHTML(url, selector, options);
|
8053
8086
|
if (result.status < 500) {
|
8087
|
+
this.morphing = true;
|
8054
8088
|
document.dispatchEvent(new CustomEvent("morph:start"));
|
8055
8089
|
Alpine.morph(document.querySelector(selector), result.fragment);
|
8056
|
-
|
8090
|
+
this.$nextTick(() => {
|
8091
|
+
document.dispatchEvent(new CustomEvent("morph:complete"));
|
8092
|
+
this.morphing = false;
|
8093
|
+
});
|
8057
8094
|
} else {
|
8058
8095
|
location.href = url;
|
8059
8096
|
}
|
@@ -8069,9 +8106,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
8069
8106
|
}
|
8070
8107
|
}
|
8071
8108
|
},
|
8072
|
-
handleVisibilityChange() {
|
8073
|
-
if (this.serverEventsListener && !document.hidden)
|
8074
|
-
|
8109
|
+
async handleVisibilityChange() {
|
8110
|
+
if (this.serverEventsListener && !document.hidden) {
|
8111
|
+
const response = await fetch(`${sseEndpoint}/ping`);
|
8112
|
+
const lastServerUpdate = Date.parse(await response.text());
|
8113
|
+
if (lastServerUpdate > this.lastUpdate)
|
8114
|
+
this.updatePage();
|
8115
|
+
}
|
8075
8116
|
},
|
8076
8117
|
destroy() {
|
8077
8118
|
this.routerLogger.error(`Router instance destroyed!`);
|
@@ -17830,11 +17871,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
17830
17871
|
});
|
17831
17872
|
var nav_item_default = AlpineComponent("navItem", ({ keywords, collection }) => {
|
17832
17873
|
return {
|
17874
|
+
key: null,
|
17833
17875
|
keywords: [],
|
17834
17876
|
isCollection: false,
|
17835
17877
|
filteredOut: false,
|
17836
17878
|
selected: false,
|
17837
17879
|
init() {
|
17880
|
+
this.key = this.$el.getAttribute("key");
|
17838
17881
|
this.keywords = keywords || [];
|
17839
17882
|
this.isCollection = collection || false;
|
17840
17883
|
this.setSelectionState();
|
@@ -17872,9 +17915,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
17872
17915
|
get targetUrl() {
|
17873
17916
|
return this.$root.getAttribute("data-url");
|
17874
17917
|
},
|
17875
|
-
get key() {
|
17876
|
-
return this.$root.getAttribute("key");
|
17877
|
-
},
|
17878
17918
|
get expanded() {
|
17879
17919
|
return this.expandedItems && this.key && this.expandedItems.includes(this.key);
|
17880
17920
|
},
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.alpha.
|
4
|
+
version: 3.0.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Perkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: css_parser
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: actionmailer
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: yard
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -281,9 +267,11 @@ files:
|
|
281
267
|
- lib/lookbook/component/compile_cache.rb
|
282
268
|
- lib/lookbook/component/compiler.rb
|
283
269
|
- lib/lookbook/concerns/entity_tree_node.rb
|
270
|
+
- lib/lookbook/concerns/feature_checks.rb
|
284
271
|
- lib/lookbook/concerns/loggable.rb
|
285
272
|
- lib/lookbook/config.rb
|
286
273
|
- lib/lookbook/data_object.rb
|
274
|
+
- lib/lookbook/directory_entity.rb
|
287
275
|
- lib/lookbook/engine.rb
|
288
276
|
- lib/lookbook/entity.rb
|
289
277
|
- lib/lookbook/entity_store.rb
|
@@ -304,6 +292,7 @@ files:
|
|
304
292
|
- lib/lookbook/markdown/markdown.rb
|
305
293
|
- lib/lookbook/markdown/markdown_renderer.rb
|
306
294
|
- lib/lookbook/notifications.rb
|
295
|
+
- lib/lookbook/pages/page_directories.rb
|
307
296
|
- lib/lookbook/pages/page_directory_entity.rb
|
308
297
|
- lib/lookbook/pages/page_entity.rb
|
309
298
|
- lib/lookbook/pages/page_metadata.rb
|
@@ -313,6 +302,7 @@ files:
|
|
313
302
|
- lib/lookbook/previews/inspector.rb
|
314
303
|
- lib/lookbook/previews/inspector_target_entity.rb
|
315
304
|
- lib/lookbook/previews/preview.rb
|
305
|
+
- lib/lookbook/previews/preview_directories.rb
|
316
306
|
- lib/lookbook/previews/preview_directory_entity.rb
|
317
307
|
- lib/lookbook/previews/preview_entity.rb
|
318
308
|
- lib/lookbook/previews/preview_metadata.rb
|
@@ -327,7 +317,6 @@ files:
|
|
327
317
|
- lib/lookbook/previews/tags/label_tag.rb
|
328
318
|
- lib/lookbook/previews/tags/location_tag.rb
|
329
319
|
- lib/lookbook/previews/tags/param_tag.rb
|
330
|
-
- lib/lookbook/previews/tags/priority_tag.rb
|
331
320
|
- lib/lookbook/previews/tags/status_tag.rb
|
332
321
|
- lib/lookbook/previews/tags/yard_tag.rb
|
333
322
|
- lib/lookbook/project.rb
|