pinstripe 0.32.0 → 0.34.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/README.md +1 -1
- package/lib/class.js +1 -63
- package/lib/component.js +123 -99
- package/lib/components/helpers.js +6 -5
- package/lib/components/index.js +12 -0
- package/lib/components/pinstripe_anchor.js +5 -4
- package/lib/components/pinstripe_body.js +13 -4
- package/lib/components/pinstripe_document.js +14 -2
- package/lib/components/pinstripe_form.js +36 -5
- package/lib/components/pinstripe_frame.js +30 -19
- package/lib/components/pinstripe_menu.js +33 -0
- package/lib/components/pinstripe_modal.js +94 -30
- package/lib/components/pinstripe_overlay.js +5 -7
- package/lib/components/pinstripe_popover.js +86 -0
- package/lib/components/pinstripe_progress_bar.js +6 -4
- package/lib/components/pinstripe_script.js +6 -3
- package/lib/components/pinstripe_skeleton.js +4 -2
- package/lib/constants.js +1 -26
- package/lib/index.js +0 -12
- package/lib/inflector.js +1 -187
- package/lib/initialize.js +1 -3
- package/lib/lru_cache.js +1 -52
- package/lib/proof_of_work.js +1 -83
- package/lib/registry.js +1 -136
- package/lib/trapify.js +1 -31
- package/lib/virtual_node.js +1 -171
- package/package.json +9 -40
- package/babel.config.cjs +0 -18
- package/cli.js +0 -46
- package/jest.config.cjs +0 -6
- package/lib/app.js +0 -37
- package/lib/apps/_file_importer.js +0 -1
- package/lib/apps/docs.js +0 -6
- package/lib/apps/main.js +0 -6
- package/lib/background_job.js +0 -42
- package/lib/background_jobs/_file_importer.js +0 -1
- package/lib/background_jobs/purge_used_hashes.js +0 -12
- package/lib/client.js +0 -20
- package/lib/command.js +0 -31
- package/lib/commands/_file_importer.js +0 -1
- package/lib/commands/drop_database.js +0 -6
- package/lib/commands/generate_app.js +0 -41
- package/lib/commands/generate_background_job.js +0 -47
- package/lib/commands/generate_command.js +0 -39
- package/lib/commands/generate_component.js +0 -51
- package/lib/commands/generate_migration.js +0 -55
- package/lib/commands/generate_model.js +0 -43
- package/lib/commands/generate_project.js +0 -142
- package/lib/commands/generate_service.js +0 -34
- package/lib/commands/generate_static_site.js +0 -94
- package/lib/commands/generate_view.js +0 -80
- package/lib/commands/init_database.js +0 -9
- package/lib/commands/list_apps.js +0 -15
- package/lib/commands/list_background_jobs.js +0 -15
- package/lib/commands/list_commands.js +0 -15
- package/lib/commands/list_components.js +0 -16
- package/lib/commands/list_migrations.js +0 -15
- package/lib/commands/list_models.js +0 -15
- package/lib/commands/list_services.js +0 -15
- package/lib/commands/list_views.js +0 -21
- package/lib/commands/migrate_database.js +0 -6
- package/lib/commands/reset_database.js +0 -9
- package/lib/commands/run_background_job.js +0 -11
- package/lib/commands/seed_database.js +0 -6
- package/lib/commands/show_config.js +0 -6
- package/lib/commands/start_repl.js +0 -6
- package/lib/commands/start_server.js +0 -31
- package/lib/components/_file_importer.js +0 -1
- package/lib/context.js +0 -40
- package/lib/database/client.js +0 -322
- package/lib/database/column_reference.js +0 -13
- package/lib/database/constants.js +0 -99
- package/lib/database/index.js +0 -7
- package/lib/database/migration.js +0 -32
- package/lib/database/migrator.js +0 -28
- package/lib/database/row.js +0 -387
- package/lib/database/singleton.js +0 -12
- package/lib/database/table.js +0 -518
- package/lib/database/table_reference.js +0 -33
- package/lib/database/union.js +0 -130
- package/lib/database.js +0 -147
- package/lib/defer.js +0 -35
- package/lib/defer.test.js +0 -48
- package/lib/escape_html.js +0 -2
- package/lib/extensions/_file_importer.js +0 -1
- package/lib/extensions/multi-tenant/database/row.js +0 -48
- package/lib/extensions/multi-tenant/database/table.js +0 -30
- package/lib/extensions/multi-tenant/database.js +0 -18
- package/lib/extensions/multi-tenant/index.js +0 -4
- package/lib/extensions/multi-tenant/migrations/1627976174_create_tenant_table_and_add_tenant_id_to_existing_tables.js +0 -20
- package/lib/extensions/multi-tenant/migrations/_file_importer.js +0 -2
- package/lib/extensions/multi-tenant/models/_file_importer.js +0 -1
- package/lib/extensions/multi-tenant/models/tenant.js +0 -14
- package/lib/extensions/multi-tenant/services/_file_importer.js +0 -2
- package/lib/extensions/multi-tenant/services/database.js +0 -35
- package/lib/extensions/multi-tenant/services/run_background_job.js +0 -27
- package/lib/html.js +0 -72
- package/lib/import_all.js +0 -94
- package/lib/lru_cache.test.js +0 -45
- package/lib/markdown.js +0 -66
- package/lib/migrations/1708772281_create_used_hash.js +0 -9
- package/lib/migrations/_file_importer.js +0 -2
- package/lib/model.js +0 -110
- package/lib/models/_file_importer.js +0 -2
- package/lib/models/used_hash.js +0 -7
- package/lib/project.js +0 -72
- package/lib/service_consumer.js +0 -16
- package/lib/service_factory.js +0 -22
- package/lib/services/_file_importer.js +0 -1
- package/lib/services/app.js +0 -11
- package/lib/services/args.js +0 -9
- package/lib/services/bot.js +0 -70
- package/lib/services/cli_utils.js +0 -77
- package/lib/services/client_builder.js +0 -70
- package/lib/services/config.js +0 -66
- package/lib/services/cookies.js +0 -19
- package/lib/services/create_model.js +0 -8
- package/lib/services/css_classes_for.js +0 -13
- package/lib/services/database.js +0 -14
- package/lib/services/defer.js +0 -8
- package/lib/services/docs.js +0 -93
- package/lib/services/fetch.js +0 -86
- package/lib/services/format_date.js +0 -8
- package/lib/services/fs_builder.js +0 -132
- package/lib/services/inflector.js +0 -8
- package/lib/services/initial_params.js +0 -13
- package/lib/services/only_once.js +0 -24
- package/lib/services/params.js +0 -13
- package/lib/services/parse_html.js +0 -8
- package/lib/services/project.js +0 -8
- package/lib/services/render_form.js +0 -120
- package/lib/services/render_html.js +0 -8
- package/lib/services/render_markdown.js +0 -9
- package/lib/services/render_table.js +0 -48
- package/lib/services/render_view.js +0 -6
- package/lib/services/repl.js +0 -54
- package/lib/services/run_background_job.js +0 -8
- package/lib/services/run_command.js +0 -8
- package/lib/services/run_in_new_workspace.js +0 -11
- package/lib/services/send_mail.js +0 -47
- package/lib/services/server.js +0 -105
- package/lib/services/trapify.js +0 -8
- package/lib/services/view.js +0 -6
- package/lib/singleton.js +0 -13
- package/lib/string_reader.js +0 -22
- package/lib/unescape_html.js +0 -2
- package/lib/unescape_html.test.js +0 -9
- package/lib/util.js +0 -12
- package/lib/validation_error.js +0 -7
- package/lib/view.js +0 -120
- package/lib/view_file_importers/js.js +0 -38
- package/lib/view_file_importers/md.js +0 -50
- package/lib/views/_file_importer.js +0 -1
- package/lib/views/docs/_404.js +0 -16
- package/lib/views/docs/_footer.js +0 -67
- package/lib/views/docs/_header.js +0 -17
- package/lib/views/docs/_hero.js +0 -59
- package/lib/views/docs/_layout.js +0 -118
- package/lib/views/docs/_navbar.js +0 -99
- package/lib/views/docs/_sidebar.js +0 -31
- package/lib/views/docs/default.js +0 -6
- package/lib/views/docs/docs/default.js +0 -24
- package/lib/views/docs/docs/guides/introduction.md +0 -18
- package/lib/views/docs/images/logo.svg +0 -7
- package/lib/views/docs/index.js +0 -16
- package/lib/views/shared/_button.js +0 -99
- package/lib/views/shared/_content.js +0 -81
- package/lib/views/shared/_danger_area.js +0 -78
- package/lib/views/shared/_editable_area.js +0 -37
- package/lib/views/shared/_form.js +0 -273
- package/lib/views/shared/_navbar.js +0 -110
- package/lib/views/shared/_pagination.js +0 -47
- package/lib/views/shared/_panel.js +0 -69
- package/lib/views/shared/_section.js +0 -45
- package/lib/views/shared/_shell/index.js +0 -26
- package/lib/views/shared/_shell/javascripts/all.js.js +0 -7
- package/lib/views/shared/_shell/javascripts/all.js.map.js +0 -7
- package/lib/views/shared/_shell/stylesheets/all.css +0 -4
- package/lib/views/shared/_shell/stylesheets/global.css +0 -126
- package/lib/views/shared/_shell/stylesheets/reset.css +0 -74
- package/lib/views/shared/_shell/stylesheets/vars.css +0 -25
- package/lib/views/shared/_shell/stylesheets/view.css.js +0 -43
- package/lib/views/shared/_table.js +0 -139
- package/lib/virtual_node.test.js +0 -28
- package/lib/workspace.js +0 -21
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
|
+
import { Component } from "../component.js";
|
|
2
3
|
import { loadCache, normalizeUrl } from "./helpers.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
Component.register('pinstripe-frame', {
|
|
5
6
|
initialize(...args){
|
|
6
7
|
this.constructor.parent.prototype.initialize.call(this, ...args);
|
|
7
8
|
|
|
@@ -34,35 +35,45 @@ export default {
|
|
|
34
35
|
);
|
|
35
36
|
},
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
loadWasBlocked: false,
|
|
38
|
+
status: 'complete',
|
|
40
39
|
|
|
41
40
|
async load(url = this.url, options = {}){
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
this._pendingResponse?.destroy();
|
|
42
|
+
const { progressBar } = this.document;
|
|
43
|
+
progressBar.start();
|
|
44
|
+
await clearEventLoop();
|
|
45
|
+
this.status = 'loading';
|
|
46
46
|
this.url = url;
|
|
47
|
-
this.loading = true;
|
|
48
|
-
this.abort();
|
|
49
47
|
const { method = 'GET', placeholderUrl } = options;
|
|
50
48
|
const cachedHtml = method == 'GET' ? loadCache.get(`${this.document.loadCacheNamespace}:${url}`) : undefined;
|
|
51
|
-
if(cachedHtml)
|
|
49
|
+
if(cachedHtml) {
|
|
50
|
+
this.status = 'using-cached-html';
|
|
51
|
+
this.patch(cachedHtml);
|
|
52
|
+
}
|
|
52
53
|
let minimumDelay = 0;
|
|
53
54
|
if(!cachedHtml && placeholderUrl){
|
|
54
55
|
const placeholderHtml = loadCache.get(`${this.document.loadCacheNamespace}:${placeholderUrl}`);
|
|
55
56
|
if(placeholderHtml) {
|
|
57
|
+
this.status = 'using-placeholder-html';
|
|
56
58
|
this.patch(placeholderHtml);
|
|
57
59
|
minimumDelay = 300;
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
try {
|
|
63
|
+
this._pendingResponse = this.fetch(this.url, { minimumDelay, ...options });
|
|
64
|
+
|
|
65
|
+
const response = await this._pendingResponse;
|
|
66
|
+
|
|
67
|
+
const html = await response.text();
|
|
68
|
+
this.status = 'complete';
|
|
69
|
+
this.patch(html);
|
|
70
|
+
if(html != cachedHtml && method == 'GET') loadCache.put(`${this.document.loadCacheNamespace}:${this.url}`, html);
|
|
71
|
+
} catch(e) {
|
|
72
|
+
if(e != 'Request aborted') console.log(e);
|
|
73
|
+
}
|
|
74
|
+
await clearEventLoop();
|
|
75
|
+
progressBar.stop();
|
|
67
76
|
}
|
|
68
|
-
};
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const clearEventLoop = () => new Promise(resolve => setTimeout(resolve, 0));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { Component } from "../component.js";
|
|
3
|
+
|
|
4
|
+
Component.register('pinstripe-menu', {
|
|
5
|
+
initialize(...args){
|
|
6
|
+
this.constructor.parent.prototype.initialize.call(this, ...args);
|
|
7
|
+
|
|
8
|
+
this.shadow.patch(`
|
|
9
|
+
<style>
|
|
10
|
+
.root {
|
|
11
|
+
background: #fff;
|
|
12
|
+
box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px, rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.1) 0px 4px 6px -4px;
|
|
13
|
+
border-radius: 6px;
|
|
14
|
+
width: 100vw;
|
|
15
|
+
max-width: 250px;
|
|
16
|
+
padding: 6px 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::slotted(a) {
|
|
20
|
+
display: block;
|
|
21
|
+
padding: 6px 12px;
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
color: #000;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
::slotted(a:hover) {
|
|
27
|
+
background: #f7f7f7;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
30
|
+
<div class="root"><slot></div>
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -1,31 +1,53 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { Component } from "../component.js";
|
|
4
|
+
|
|
5
|
+
const MOBILE_HEIGHT_MAP = {
|
|
6
|
+
full: 'calc(100vh - 8.2rem)',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const DESKTOP_WIDTH_MAP = {
|
|
10
|
+
small: '600px',
|
|
11
|
+
medium: '800px',
|
|
12
|
+
large: '1000px',
|
|
13
|
+
auto: '0',
|
|
14
|
+
full: '0'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const DESKTOP_HEIGHT_MAP = {
|
|
18
|
+
full: 'calc(100vh - 4rem)',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Component.register('pinstripe-modal', {
|
|
3
22
|
initialize(...args){
|
|
4
23
|
this.constructor.parent.prototype.initialize.call(this, ...args);
|
|
5
24
|
|
|
25
|
+
if(!this.overlay) return;
|
|
26
|
+
|
|
27
|
+
this.document.body.clip();
|
|
28
|
+
|
|
6
29
|
const { width = 'medium', height = 'auto' } = this.params;
|
|
7
30
|
|
|
31
|
+
const mobileHeight = MOBILE_HEIGHT_MAP[height] || height;
|
|
32
|
+
const desktopWidth = DESKTOP_WIDTH_MAP[width] || width;
|
|
33
|
+
const desktopHeight = DESKTOP_HEIGHT_MAP[height] || height;
|
|
34
|
+
|
|
8
35
|
this.shadow.patch(`
|
|
9
36
|
<style>
|
|
10
37
|
.root {
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
justify-content: center;
|
|
15
38
|
overflow: auto;
|
|
16
39
|
z-index: 40;
|
|
17
40
|
position: absolute;
|
|
18
|
-
bottom: 0;
|
|
19
41
|
left: 0;
|
|
20
|
-
right: 0;
|
|
21
42
|
top: 0;
|
|
43
|
+
width: 100vw;
|
|
44
|
+
height: 100vh;
|
|
22
45
|
background-color: rgba(10, 10, 10, 0.86);
|
|
23
46
|
}
|
|
47
|
+
|
|
24
48
|
.close-button {
|
|
25
49
|
background: none;
|
|
26
|
-
|
|
27
|
-
right: 2.0rem;
|
|
28
|
-
top: 2.0rem;
|
|
50
|
+
display: inline-block;
|
|
29
51
|
height: 3.2rem;
|
|
30
52
|
width: 3.2rem;
|
|
31
53
|
user-select: none;
|
|
@@ -60,29 +82,55 @@ export default {
|
|
|
60
82
|
height: 50%;
|
|
61
83
|
width: 0.2rem;
|
|
62
84
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
|
|
86
|
+
@media (max-width: 766px) {
|
|
87
|
+
.container {
|
|
88
|
+
width: 100vw;
|
|
89
|
+
min-height: 100vh;
|
|
90
|
+
display: grid;
|
|
91
|
+
grid-template-columns: [grid-start] 1rem [full-start] auto [full-end] 1rem [grid-end];
|
|
92
|
+
grid-template-rows: [grid-start] 0 [top-start] 7.2rem [top-end] 0 [full-start] ${mobileHeight} [full-end] 1rem [grid-end];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.close-button {
|
|
96
|
+
grid-area: top / full;
|
|
97
|
+
position: absolute;
|
|
98
|
+
right: 2rem;
|
|
99
|
+
top: 2rem;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.body {
|
|
103
|
+
grid-area: full;
|
|
104
|
+
}
|
|
78
105
|
}
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
|
|
107
|
+
@media (min-width: 767px) {
|
|
108
|
+
.container {
|
|
109
|
+
width: 100vw;
|
|
110
|
+
min-height: 100vh;
|
|
111
|
+
display: grid;
|
|
112
|
+
grid-template-columns: [grid-start] 7.2rem [full-start] auto [fixed-start] minmax(0, ${desktopWidth}) [fixed-end] auto [full-end] 7.2rem [grid-end];
|
|
113
|
+
grid-template-rows: [grid-start] 2rem [full-start] ${desktopHeight} [full-end] 2rem [grid-end];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.close-button {
|
|
117
|
+
position: fixed;
|
|
118
|
+
right: 2.0rem;
|
|
119
|
+
top: 2.0rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.body {
|
|
123
|
+
grid-area: full / ${['auto', 'full'].includes(desktopWidth) ? 'full' : 'fixed'};
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
align-items: stretch;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
}
|
|
81
129
|
}
|
|
82
130
|
</style>
|
|
83
|
-
<div class="root
|
|
84
|
-
<button class="close-button"></button>
|
|
131
|
+
<div class="root">
|
|
85
132
|
<div class="container">
|
|
133
|
+
<button class="close-button"></button>
|
|
86
134
|
<div class="body">
|
|
87
135
|
<slot>
|
|
88
136
|
</div>
|
|
@@ -91,8 +139,24 @@ export default {
|
|
|
91
139
|
`);
|
|
92
140
|
|
|
93
141
|
this.shadow.on('click', '.root, .container, .body, .close-button', () => this.trigger('close'));
|
|
142
|
+
|
|
143
|
+
this.on('clean', () => this.document.body.unclip());
|
|
144
|
+
|
|
145
|
+
const popoverOverlays = [];
|
|
146
|
+
let currentAnchor = this.overlay.parent;
|
|
147
|
+
while(currentAnchor.is('pinstripe-popover *')){
|
|
148
|
+
popoverOverlays.push(currentAnchor.overlay);
|
|
149
|
+
currentAnchor = currentAnchor.overlay.parent;
|
|
150
|
+
}
|
|
151
|
+
delete this.overlay.parent._overlayChild;
|
|
152
|
+
this.overlay._parent = currentAnchor;
|
|
153
|
+
currentAnchor._overlayChild = this.overlay;
|
|
154
|
+
while(popoverOverlays.length){
|
|
155
|
+
popoverOverlays.shift().remove();
|
|
156
|
+
}
|
|
157
|
+
|
|
94
158
|
},
|
|
95
159
|
|
|
96
160
|
isModal: true
|
|
97
|
-
}
|
|
161
|
+
});
|
|
98
162
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
import { Component } from "../component.js";
|
|
3
|
+
|
|
4
|
+
Component.register('pinstripe-overlay', {
|
|
3
5
|
meta(){
|
|
4
6
|
this.include('pinstripe-frame');
|
|
5
7
|
},
|
|
@@ -13,8 +15,8 @@ export default {
|
|
|
13
15
|
position: fixed;
|
|
14
16
|
top: 0;
|
|
15
17
|
left: 0;
|
|
16
|
-
height: 100%;
|
|
17
18
|
width: 100%;
|
|
19
|
+
height: 0;
|
|
18
20
|
z-index: 1000000;
|
|
19
21
|
}
|
|
20
22
|
</style>
|
|
@@ -45,9 +47,5 @@ export default {
|
|
|
45
47
|
this.constructor.parent.prototype.remove.call(this, ...args);
|
|
46
48
|
|
|
47
49
|
delete this.parent._overlayChild;
|
|
48
|
-
|
|
49
|
-
if(!this.document.find('pinstripe-overlay')){
|
|
50
|
-
this.document.body.unclip();
|
|
51
|
-
}
|
|
52
50
|
}
|
|
53
|
-
};
|
|
51
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
import { Component } from "../component.js";
|
|
3
|
+
|
|
4
|
+
Component.register('pinstripe-popover', {
|
|
5
|
+
initialize(...args){
|
|
6
|
+
this.constructor.parent.prototype.initialize.call(this, ...args);
|
|
7
|
+
|
|
8
|
+
if(!this.overlay) return;
|
|
9
|
+
|
|
10
|
+
this.position = this.overlay.parent.params.dropdownPosition || 'bottom-center';
|
|
11
|
+
|
|
12
|
+
this.shadow.patch(`
|
|
13
|
+
<style>
|
|
14
|
+
:host {
|
|
15
|
+
position: absolute;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
<slot>
|
|
19
|
+
`);
|
|
20
|
+
|
|
21
|
+
this.repositionHandler = this.reposition.bind(this);
|
|
22
|
+
this.resizeOberver = new ResizeObserver(this.repositionHandler);
|
|
23
|
+
this.resizeOberver.observe(this.node);
|
|
24
|
+
window.addEventListener('resize', this.repositionHandler);
|
|
25
|
+
window.addEventListener('scroll', this.repositionHandler);
|
|
26
|
+
this.reposition();
|
|
27
|
+
|
|
28
|
+
this.on('click', (event) => {
|
|
29
|
+
event.stopPropagation();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const anchor = this.overlay.parent;
|
|
33
|
+
const { attributes: anchorAttributes } = anchor;
|
|
34
|
+
|
|
35
|
+
anchor.patch({ ...anchorAttributes, 'data-active': 'true' });
|
|
36
|
+
|
|
37
|
+
this.closeHandler = () => this.overlay.remove();
|
|
38
|
+
window.addEventListener('click', this.closeHandler);
|
|
39
|
+
|
|
40
|
+
this.on('clean', () => {
|
|
41
|
+
this.resizeOberver.disconnect();
|
|
42
|
+
window.removeEventListener('resize', this.repositionHandler);
|
|
43
|
+
window.removeEventListener('scroll', this.repositionHandler);
|
|
44
|
+
window.removeEventListener('click', this.closeHandler);
|
|
45
|
+
anchor.patch(anchorAttributes);
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
isPopover: true,
|
|
50
|
+
|
|
51
|
+
reposition(){
|
|
52
|
+
if(!this.overlay.parent) return;
|
|
53
|
+
|
|
54
|
+
const gap = 4;
|
|
55
|
+
|
|
56
|
+
const [ side = 'bottom', align = 'center' ] = this.position.split('-');
|
|
57
|
+
const anchorRect = this.overlay.parent.node.getBoundingClientRect();
|
|
58
|
+
const rect = this.node.getBoundingClientRect();
|
|
59
|
+
|
|
60
|
+
let left = 0;
|
|
61
|
+
let top = 0;
|
|
62
|
+
|
|
63
|
+
if(side == 'top' || side == 'bottom'){
|
|
64
|
+
left = anchorRect.left;
|
|
65
|
+
if(align == 'center') left += anchorRect.width / 2 - rect.width / 2;
|
|
66
|
+
if(align == 'right') left += anchorRect.width - rect.width;
|
|
67
|
+
|
|
68
|
+
if(side == 'top') top = anchorRect.top - rect.height - gap;
|
|
69
|
+
if(side == 'bottom') top = anchorRect.top + anchorRect.height + gap;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if(side == 'left' || side == 'right'){
|
|
73
|
+
left = anchorRect.left;
|
|
74
|
+
if(side == 'left') left -= (rect.width + gap);
|
|
75
|
+
if(side == 'right') left += (anchorRect.width + gap);
|
|
76
|
+
|
|
77
|
+
top = anchorRect.top;
|
|
78
|
+
if(align == 'top') top += anchorRect.height;
|
|
79
|
+
if(align == 'center') top += anchorRect.height / 2 - rect.height / 2;
|
|
80
|
+
if(align == 'bottom') top += anchorRect.height - rect.height;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.node.style.left = `${left}px`;
|
|
84
|
+
this.node.style.top = `${top}px`;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
import { Component } from "../component.js";
|
|
3
|
+
|
|
4
|
+
Component.register('pinstripe-progress-bar', {
|
|
3
5
|
initialize(...args){
|
|
4
6
|
this.constructor.parent.prototype.initialize.call(this, ...args);
|
|
5
7
|
|
|
@@ -63,8 +65,8 @@ export default {
|
|
|
63
65
|
|
|
64
66
|
this.startCount--;
|
|
65
67
|
if(this.startCount == 0){
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
if(this._delayTimeout) this._delayTimeout.destroy();
|
|
69
|
+
if(this._animationInterval) this._animationInterval.destroy();
|
|
68
70
|
this.width = 0;
|
|
69
71
|
const child = progressBar.children.pop();
|
|
70
72
|
if(child){
|
|
@@ -73,4 +75,4 @@ export default {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
};
|
|
78
|
+
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
import { Component } from "../component.js";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
Component.register('pinstripe-script', {
|
|
4
5
|
initialize(...args){
|
|
5
6
|
this.constructor.parent.prototype.initialize.call(this, ...args);
|
|
6
7
|
|
|
7
|
-
this.
|
|
8
|
+
if(this.isFromCachedHtml) return;
|
|
9
|
+
|
|
10
|
+
(new Function(this.text)).call(this);
|
|
8
11
|
}
|
|
9
|
-
};
|
|
12
|
+
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
import { Component } from "../component.js";
|
|
3
|
+
|
|
4
|
+
Component.register('pinstripe-skeleton', {
|
|
3
5
|
initialize(...args){
|
|
4
6
|
this.constructor.parent.prototype.initialize.call(this, ...args);
|
|
5
7
|
|
|
@@ -52,4 +54,4 @@ export default {
|
|
|
52
54
|
<div class="root"><slot></div>
|
|
53
55
|
`);
|
|
54
56
|
}
|
|
55
|
-
};
|
|
57
|
+
});
|
package/lib/constants.js
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export
|
|
3
|
-
'area',
|
|
4
|
-
'base',
|
|
5
|
-
'br',
|
|
6
|
-
'embed',
|
|
7
|
-
'hr',
|
|
8
|
-
'iframe',
|
|
9
|
-
'img',
|
|
10
|
-
'input',
|
|
11
|
-
'link',
|
|
12
|
-
'meta',
|
|
13
|
-
'param',
|
|
14
|
-
'slot',
|
|
15
|
-
'source',
|
|
16
|
-
'track',
|
|
17
|
-
'wbr'
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export const TEXT_ONLY_TAGS = [
|
|
21
|
-
'script',
|
|
22
|
-
'style'
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
export const IS_SERVER = typeof window == 'undefined';
|
|
26
|
-
|
|
27
|
-
export const IS_CLIENT = !IS_SERVER;
|
|
2
|
+
export { SELF_CLOSING_TAGS, TEXT_ONLY_TAGS, IS_SERVER, IS_CLIENT } from '@sintra/utils';
|
package/lib/index.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
|
|
2
2
|
import './initialize.js';
|
|
3
3
|
|
|
4
|
-
export * from './app.js'; // pinstripe-if-client: export const App = undefined;
|
|
5
|
-
export * from './background_job.js'; // pinstripe-if-client: export const BackgroundJob = undefined;
|
|
6
|
-
export * from './command.js'; // pinstripe-if-client: export const Command = undefined;
|
|
7
|
-
export * from './context.js'; // pinstripe-if-client: export const Context = undefined;
|
|
8
4
|
export * from './component.js';
|
|
9
|
-
export * from './database.js'; // pinstripe-if-client: export const Database = undefined;
|
|
10
|
-
export * from './html.js'; // pinstripe-if-client: export const Html = undefined;
|
|
11
|
-
export * from './import_all.js'; // pinstripe-if-client: export const importAll = undefined;
|
|
12
|
-
export * from './markdown.js';
|
|
13
|
-
export * from './project.js'; // pinstripe-if-client: export const project = undefined;
|
|
14
|
-
export * from './service_factory.js'; // pinstripe-if-client: export const ServiceFactory = undefined;
|
|
15
|
-
export * from './view.js';
|
|
16
|
-
export * from './workspace.js'; // pinstripe-if-client: export const Workspace = undefined;
|