@bendyline/gilde 0.2.5 → 0.2.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.
Files changed (67) hide show
  1. package/authoring/LICENSE-HankenGrotesk-OFL-1.1.txt +94 -0
  2. package/authoring/LICENSE-PTSerif-OFL-1.1.txt +94 -0
  3. package/authoring/page-demo-bootstrap.js +209 -0
  4. package/authoring/page-demo-injector.mjs +7 -0
  5. package/authoring/page-demo-typography.css +88 -0
  6. package/data/craftbook-templates/ch/character-sheet/versions/1.0.4/craftbook.json +213 -0
  7. package/data/craftbook-templates/ch/character-sheet/versions/1.0.4/test.json +143 -0
  8. package/data/craftbook-templates/ch/character-turnaround/versions/1.0.4/craftbook.json +254 -0
  9. package/data/craftbook-templates/ch/character-turnaround/versions/1.0.4/test.json +189 -0
  10. package/data/craftbook-templates/fa/favicon-set/versions/1.0.5/craftbook.json +282 -0
  11. package/data/craftbook-templates/fa/favicon-set/versions/1.0.5/test.json +94 -0
  12. package/data/craftbook-templates/he/hero-image/versions/1.0.5/craftbook.json +287 -0
  13. package/data/craftbook-templates/he/hero-image/versions/1.0.5/test.json +94 -0
  14. package/data/craftbook-templates/ic/icon-pack/versions/1.0.5/craftbook.json +279 -0
  15. package/data/craftbook-templates/ic/icon-pack/versions/1.0.5/test.json +94 -0
  16. package/data/craftbook-templates/index.json +1 -1
  17. package/data/craftbook-templates/lo/logo-set/versions/1.0.5/craftbook.json +279 -0
  18. package/data/craftbook-templates/lo/logo-set/versions/1.0.5/test.json +94 -0
  19. package/data/craftbook-templates/mo/moodboard/versions/1.0.5/craftbook.json +219 -0
  20. package/data/craftbook-templates/mo/moodboard/versions/1.0.5/test.json +89 -0
  21. package/data/craftbook-templates/pa/page-spread/versions/1.0.4/craftbook.json +214 -0
  22. package/data/craftbook-templates/pa/page-spread/versions/1.0.4/test.json +132 -0
  23. package/data/craftbook-templates/raw-index.json +1 -1
  24. package/data/craftbook-templates/sp/sprite-sheet/versions/1.0.5/craftbook.json +269 -0
  25. package/data/craftbook-templates/sp/sprite-sheet/versions/1.0.5/test.json +94 -0
  26. package/data/craftbook-templates/ti/tileset-batch/versions/1.0.4/craftbook.json +319 -0
  27. package/data/craftbook-templates/ti/tileset-batch/versions/1.0.4/test.json +162 -0
  28. package/data/gezel-templates/il/illustrator/manifest.json +21 -0
  29. package/data/gezel-templates/il/illustrator/versions/1.0.0/about.md +28 -0
  30. package/data/gezel-templates/il/illustrator/versions/1.0.0/manifest.json +9 -0
  31. package/data/gezel-templates/index.json +1 -1
  32. package/data/gezel-templates/raw-index.json +1 -1
  33. package/data/image-models/an/animagine-xl-4/manifest.json +2 -0
  34. package/data/image-models/fl/flux-2-klein-4b-q4/manifest.json +3 -1
  35. package/data/image-models/index.json +1 -1
  36. package/data/image-models/ir/iris-3b-f32/manifest.json +4 -2
  37. package/data/image-models/ir/iris-3b-f32/versions/1.0.2/manifest.json +25 -0
  38. package/data/image-models/kr/krea-2-turbo-q4/manifest.json +2 -0
  39. package/data/image-models/kr/krea-2-turbo-q6/manifest.json +2 -0
  40. package/data/image-models/kr/krea-2-turbo-q8/manifest.json +2 -0
  41. package/data/image-models/mi/ming-image-0.1-design-bf16/manifest.json +2 -0
  42. package/data/image-models/mi/ming-image-0.1-design-bf16/versions/1.0.2/manifest.json +50 -0
  43. package/data/image-models/mo/moss-image-sft-q4/manifest.json +3 -1
  44. package/data/image-models/mo/moss-image-sft-q4/versions/1.0.0/manifest.json +1 -1
  45. package/data/image-models/mo/moss-image-sft-q4/versions/1.0.1/manifest.json +37 -0
  46. package/data/image-models/raw-index.json +1 -1
  47. package/data/image-models/sd/sd-1.5/manifest.json +2 -0
  48. package/data/image-models/sd/sd-turbo/manifest.json +2 -0
  49. package/data/image-models/sd/sdxl-base-1.0/manifest.json +2 -0
  50. package/data/image-models/sd/sdxl-lightning-4step/manifest.json +2 -0
  51. package/data/image-models/sd/sdxl-turbo/manifest.json +2 -0
  52. package/data/project-types/da/data-analysis/versions/1.0.0/about.md +2 -0
  53. package/data/project-types/da/data-analysis/versions/1.0.0/manifest.json +44 -0
  54. package/data/project-types/da/data-analysis/versions/1.0.0/pages/dashboard.css +5 -8
  55. package/data/project-types/da/data-analysis/versions/1.0.0/pages/dashboard.js +11 -31
  56. package/data/project-types/da/data-analysis/versions/1.0.0/pages/demo.js +9 -0
  57. package/data/project-types/da/data-analysis/versions/1.0.0/pages/index.html +3 -91
  58. package/data/project-types/index.json +1 -1
  59. package/data/project-types/me/media-library/versions/1.0.0/about.md +1 -1
  60. package/data/project-types/me/media-library/versions/1.0.0/manifest.json +53 -0
  61. package/data/project-types/me/media-library/versions/1.0.0/pages/gallery.css +3 -14
  62. package/data/project-types/me/media-library/versions/1.0.0/pages/gallery.js +16 -28
  63. package/data/project-types/me/media-library/versions/1.0.0/pages/index.html +3 -90
  64. package/data/project-types/raw-index.json +1 -1
  65. package/package.json +3 -2
  66. package/schemas/image-model-identity.schema.json +10 -0
  67. package/schemas/project-type-version.schema.json +40 -0
@@ -0,0 +1,94 @@
1
+ Copyright (c) 2020, Alfredo Marco Pradil (https://hanken.co),
2
+ with Reserved Font Name "Hanken Grotesk".
3
+
4
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
5
+ This license is copied below, and is also available with a FAQ at:
6
+ https://openfontlicense.org
7
+
8
+
9
+ -----------------------------------------------------------
10
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
+ -----------------------------------------------------------
12
+
13
+ PREAMBLE
14
+ The goals of the Open Font License (OFL) are to stimulate worldwide
15
+ development of collaborative font projects, to support the font creation
16
+ efforts of academic and linguistic communities, and to provide a free and
17
+ open framework in which fonts may be shared and improved in partnership
18
+ with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves. The
22
+ fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply
27
+ to any document created using the fonts or their derivatives.
28
+
29
+ DEFINITIONS
30
+ "Font Software" refers to the set of files released by the Copyright
31
+ Holder(s) under this license and clearly marked as such. This may
32
+ include source files, build scripts and documentation.
33
+
34
+ "Reserved Font Name" refers to any names specified as such after the
35
+ copyright statement(s).
36
+
37
+ "Original Version" refers to the collection of Font Software components as
38
+ distributed by the Copyright Holder(s).
39
+
40
+ "Modified Version" refers to any derivative made by adding to, deleting,
41
+ or substituting -- in part or in whole -- any of the components of the
42
+ Original Version, by changing formats or by porting the Font Software to a
43
+ new environment.
44
+
45
+ "Author" refers to any designer, engineer, programmer, technical writer
46
+ or other person who contributed to the Font Software.
47
+
48
+ PERMISSION & CONDITIONS
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
51
+ redistribute, and sell modified and unmodified copies of the Font
52
+ Software, subject to the following conditions:
53
+
54
+ 1) Neither the Font Software nor any of its individual components,
55
+ in Original or Modified Versions, may be sold by itself.
56
+
57
+ 2) Original or Modified Versions of the Font Software may be bundled,
58
+ redistributed and/or sold with any software, provided that each copy
59
+ contains the above copyright notice and this license. These can be
60
+ included either as stand-alone text files, human-readable headers or
61
+ in the appropriate machine-readable metadata fields within text or
62
+ binary files as long as those fields can be easily viewed by the user.
63
+
64
+ 3) No Modified Version of the Font Software may use the Reserved Font
65
+ Name(s) unless explicit written permission is granted by the corresponding
66
+ Copyright Holder. This restriction only applies to the primary font name as
67
+ presented to the users.
68
+
69
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
+ Software shall not be used to promote, endorse or advertise any
71
+ Modified Version, except to acknowledge the contribution(s) of the
72
+ Copyright Holder(s) and the Author(s) or with their explicit written
73
+ permission.
74
+
75
+ 5) The Font Software, modified or unmodified, in part or in whole,
76
+ must be distributed entirely under this license, and must not be
77
+ distributed under any other license. The requirement for fonts to
78
+ remain under this license does not apply to any document created
79
+ using the Font Software.
80
+
81
+ TERMINATION
82
+ This license becomes null and void if any of the above conditions are
83
+ not met.
84
+
85
+ DISCLAIMER
86
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,94 @@
1
+ Copyright (c) 2010, ParaType Ltd. (http://www.paratype.com/public),
2
+ with Reserved Font Names "PT Sans", "PT Serif" and "ParaType".
3
+
4
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
5
+ This license is copied below, and is also available with a FAQ at:
6
+ https://openfontlicense.org
7
+
8
+
9
+ -----------------------------------------------------------
10
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
+ -----------------------------------------------------------
12
+
13
+ PREAMBLE
14
+ The goals of the Open Font License (OFL) are to stimulate worldwide
15
+ development of collaborative font projects, to support the font creation
16
+ efforts of academic and linguistic communities, and to provide a free and
17
+ open framework in which fonts may be shared and improved in partnership
18
+ with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves. The
22
+ fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply
27
+ to any document created using the fonts or their derivatives.
28
+
29
+ DEFINITIONS
30
+ "Font Software" refers to the set of files released by the Copyright
31
+ Holder(s) under this license and clearly marked as such. This may
32
+ include source files, build scripts and documentation.
33
+
34
+ "Reserved Font Name" refers to any names specified as such after the
35
+ copyright statement(s).
36
+
37
+ "Original Version" refers to the collection of Font Software components as
38
+ distributed by the Copyright Holder(s).
39
+
40
+ "Modified Version" refers to any derivative made by adding to, deleting,
41
+ or substituting -- in part or in whole -- any of the components of the
42
+ Original Version, by changing formats or by porting the Font Software to a
43
+ new environment.
44
+
45
+ "Author" refers to any designer, engineer, programmer, technical writer
46
+ or other person who contributed to the Font Software.
47
+
48
+ PERMISSION & CONDITIONS
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
51
+ redistribute, and sell modified and unmodified copies of the Font
52
+ Software, subject to the following conditions:
53
+
54
+ 1) Neither the Font Software nor any of its individual components,
55
+ in Original or Modified Versions, may be sold by itself.
56
+
57
+ 2) Original or Modified Versions of the Font Software may be bundled,
58
+ redistributed and/or sold with any software, provided that each copy
59
+ contains the above copyright notice and this license. These can be
60
+ included either as stand-alone text files, human-readable headers or
61
+ in the appropriate machine-readable metadata fields within text or
62
+ binary files as long as those fields can be easily viewed by the user.
63
+
64
+ 3) No Modified Version of the Font Software may use the Reserved Font
65
+ Name(s) unless explicit written permission is granted by the corresponding
66
+ Copyright Holder. This restriction only applies to the primary font name as
67
+ presented to the users.
68
+
69
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
+ Software shall not be used to promote, endorse or advertise any
71
+ Modified Version, except to acknowledge the contribution(s) of the
72
+ Copyright Holder(s) and the Author(s) or with their explicit written
73
+ permission.
74
+
75
+ 5) The Font Software, modified or unmodified, in part or in whole,
76
+ must be distributed entirely under this license, and must not be
77
+ distributed under any other license. The requirement for fonts to
78
+ remain under this license does not apply to any document created
79
+ using the Font Software.
80
+
81
+ TERMINATION
82
+ This license becomes null and void if any of the above conditions are
83
+ not met.
84
+
85
+ DISCLAIMER
86
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,209 @@
1
+ (function(){
2
+ if(window.gezel || window.__gezelDemoBootstrap)return;
3
+ window.__gezelDemoBootstrap=1;
4
+ /* gezel-page-demo-stub v1 */
5
+ /*
6
+ * The canonical demo stub for Gezel type pages. MIT License.
7
+ *
8
+ * Paste this file's bytes verbatim into a <script> block ahead of the
9
+ * page's own code, then call makeDemoGezel({ page, tools, data }) with the
10
+ * page's demo handlers. Served by Gezel, the real window.gezel is already
11
+ * injected and the stub steps aside; opened as a raw file (the live demos
12
+ * on gezelgilde.com), it installs a window.gezel whose tools and data are
13
+ * the page-supplied handler maps — one code path in every mode. `tools`
14
+ * and `data` map a tool name / declared read path to a function; data
15
+ * handlers back read() and list(), and url() returns the handler's value
16
+ * or passes a data: URI through. See docs/page-authoring.md.
17
+ */
18
+ (function () {
19
+ 'use strict';
20
+ window.makeDemoGezel = function (opts) {
21
+ if (window.gezel) return window.gezel;
22
+ var page = (opts && opts.page) || {};
23
+ var tools = (opts && opts.tools) || {};
24
+ var data = (opts && opts.data) || {};
25
+ var themeListeners = [];
26
+ var media = window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;
27
+ var ui = {
28
+ theme: { mode: media && media.matches ? 'dark' : 'light' },
29
+ onTheme: function (cb) {
30
+ themeListeners.push(cb);
31
+ return function () {
32
+ var at = themeListeners.indexOf(cb);
33
+ if (at >= 0) themeListeners.splice(at, 1);
34
+ };
35
+ },
36
+ };
37
+ if (media && media.addEventListener) {
38
+ media.addEventListener('change', function (ev) {
39
+ ui.theme = { mode: ev.matches ? 'dark' : 'light' };
40
+ themeListeners.slice().forEach(function (cb) { cb(ui.theme); });
41
+ });
42
+ }
43
+ function fail(code, message) {
44
+ var err = new Error(message);
45
+ err.code = code;
46
+ return Promise.reject(err);
47
+ }
48
+ function run(map, key, arg) {
49
+ if (!Object.prototype.hasOwnProperty.call(map, key)) return null;
50
+ return Promise.resolve().then(function () { return map[key](arg); });
51
+ }
52
+ window.gezel = {
53
+ page: {
54
+ api: 1,
55
+ projectId: 'demo',
56
+ source: 'type',
57
+ entry: page.entry || 'index.html',
58
+ typeName: page.typeName || 'demo',
59
+ params: page.params || {},
60
+ mode: 'demo',
61
+ },
62
+ tools: {
63
+ list: function () { return Promise.resolve(Object.keys(tools)); },
64
+ invoke: function (name, input) {
65
+ var call = run(tools, name, input || {});
66
+ if (!call) return fail('not-allowed', "The demo does not handle the tool '" + name + "'.");
67
+ return call.then(function (output) { return { output: output }; });
68
+ },
69
+ },
70
+ data: {
71
+ read: function (path, o) {
72
+ return run(data, path, o || {}) || fail('not-allowed', "The demo has no data for '" + path + "'.");
73
+ },
74
+ list: function (path, o) {
75
+ return run(data, path, o || {}) || Promise.resolve([]);
76
+ },
77
+ watch: function () { return function () {}; },
78
+ url: function (path) {
79
+ if (Object.prototype.hasOwnProperty.call(data, path)) return String(data[path]({}));
80
+ return typeof path === 'string' && path.indexOf('data:') === 0 ? path : '';
81
+ },
82
+ },
83
+ ui: ui,
84
+ refresh: function () {},
85
+ };
86
+ return window.gezel;
87
+ };
88
+ })();
89
+
90
+ (function(){
91
+ if(window.installGezelComponents)return;
92
+ window.installGezelComponents=function(api,transport){
93
+ if(api.ui.components)return api.ui.components;
94
+ transport=transport||{};
95
+ var demo=api.page.mode==='demo', demoFiles=[], urls=new Map();
96
+ var demoTargets=transport.demoTargets||[];
97
+ var originalUrl=api.data.url.bind(api.data);
98
+ if(demo)api.data.url=function(path,opts){return urls.get(path)||originalUrl(path,opts);};
99
+ api.data.importTargets=demo?async function(){return demoTargets.map(function(t){return Object.assign({},t,{writable:true});});}:(transport.targets||async function(){throw new Error('Add files requires a newer Gezel desktop app.');});
100
+ api.data.importFiles=async function(files,opts){
101
+ opts=opts||{}; files=Array.from(files);
102
+ if(files.length>100)throw new Error('Choose at most 100 files at a time.');
103
+ var targets=await api.data.importTargets(), target=targets.find(function(t){return t.id===opts.target;});
104
+ if(!target||!target.writable)throw new Error(target&&target.reason||'This import destination is unavailable.');
105
+ var results=[];
106
+ for(var i=0;i<files.length;i++){
107
+ var file=files[i], result;
108
+ try{
109
+ if(opts.signal&&opts.signal.aborted)throw new Error('Import cancelled.');
110
+ if(!(file instanceof Blob)||typeof file.name!=='string')throw new Error('Choose a file.');
111
+ if(!/^(?!\.)(?!.*[. ]$)(?!(?:con|prn|aux|nul|com[0-9]|lpt[0-9])(?:\.|$))[^<>:"/\\|?*\x00-\x1f]{1,180}$/i.test(file.name))throw new Error('Unsupported filename.');
112
+ var ext=(file.name.match(/\.[^.]+$/)||[''])[0].toLowerCase();
113
+ if(target.accept&&!target.accept.includes(ext))throw new Error('This file type is not accepted here.');
114
+ if(file.size>Math.min(target.maxFileBytes||268435456,268435456))throw new Error('File exceeds the import size limit.');
115
+ if(opts.onProgress)opts.onProgress({completed:i,total:files.length,name:file.name});
116
+ var saved;
117
+ if(demo){
118
+ var name=file.name, base=target.path==='.'?'':target.path.replace(/\/$/,'')+'/';
119
+ var occupied=(transport.existingPaths||[]).concat(demoFiles.map(function(f){return f.path;}));
120
+ for(var n=1;occupied.includes(base+name);n++)name=file.name.slice(0,file.name.length-ext.length)+' ('+n+')'+ext;
121
+ saved={source:'workspace',path:base+name,name:name,size:file.size,mtime:1700000000000};
122
+ demoFiles.push(saved);urls.set(saved.path,URL.createObjectURL(file));
123
+ }else saved=await transport.file(file,target.id,opts.signal);
124
+ result={ok:true,name:file.name,file:saved};
125
+ }catch(error){result={ok:false,name:file.name||'File',error:error.message||String(error)};}
126
+ results.push(result);
127
+ if(opts.onProgress)opts.onProgress({completed:i+1,total:files.length,name:file.name});
128
+ }
129
+ return results;
130
+ };
131
+ var css=" :host{display:block;color:var(--gezel-component-text,#302b25);font:400 15px/1.45 var(--font-ui,system-ui,sans-serif);--surface:var(--gezel-component-surface,#fffcf6);--line:var(--gezel-component-border,#cfc7bc);--muted:var(--gezel-component-muted,#655d53);--accent:var(--gezel-component-accent,#805128)}\n :host([data-theme=\"dark\"]){--surface:var(--gezel-component-surface,#26292b);--line:var(--gezel-component-border,#555b5d);--muted:var(--gezel-component-muted,#b7b5af);--accent:var(--gezel-component-accent,#e0b78b);color:var(--gezel-component-text,#f0ece5)}\n *{box-sizing:border-box}button,input{font:inherit;color:inherit}button{cursor:pointer}button:disabled{cursor:default;opacity:.6}button:focus-visible{outline:3px solid var(--accent);outline-offset:3px}button{border:1px solid var(--line);border-radius:6px;background:var(--surface);padding:9px 14px}p{margin:6px 0}small{color:var(--muted)}[hidden]{display:none!important}.error{color:inherit;font-weight:600}\n .card{width:100%;padding:0;display:flex;flex-direction:column;text-align:left;overflow:hidden;min-width:0}.preview{background:color-mix(in srgb,var(--line) 30%,transparent);height:150px;display:grid;place-items:center;font-size:20px;color:var(--muted);flex-shrink:0}.preview img{width:100%;height:100%;object-fit:cover;min-height:0}.info{padding:12px;min-width:0}.name{font-weight:600;overflow-wrap:anywhere}.meta{color:var(--muted);font-size:13px;overflow-wrap:anywhere}.row{flex-direction:row;align-items:center}.row .preview{width:64px;height:64px;font-size:14px}.row .info{padding:8px 12px}.adder{border:1px dashed var(--line);border-radius:6px;padding:16px;background:var(--surface)}.adder.drag{outline:3px solid var(--accent);outline-offset:2px}.actions{display:flex;gap:8px;flex-wrap:wrap}.results{padding-left:20px;max-height:160px;overflow:auto;font-size:13px}progress{width:100%;accent-color:var(--accent)}";
132
+ function el(tag,text){var e=document.createElement(tag);if(text!==undefined)e.textContent=text;return e;}
133
+ function setup(target,tag){
134
+ var mount=typeof target==='string'?document.querySelector(target):target;
135
+ if(!mount)throw new Error('Component mount element not found.');
136
+ if(!customElements.get(tag))customElements.define(tag,class extends HTMLElement{
137
+ connectedCallback(){if(this.connect)this.connect();}
138
+ disconnectedCallback(){if(this.disconnect)this.disconnect();}
139
+ });
140
+ var host=el(tag),root=host.attachShadow({mode:'open'}),style=el('style',css),unsubscribe;
141
+ root.append(style);
142
+ host.connect=function(){host.setAttribute('data-theme',api.ui.theme.mode);unsubscribe=api.ui.onTheme(function(t){host.setAttribute('data-theme',t.mode);});};
143
+ host.disconnect=function(){if(unsubscribe)unsubscribe();unsubscribe=null;};
144
+ mount.append(host);
145
+ return {host:host,root:root};
146
+ }
147
+ function size(bytes){return bytes===undefined?'':bytes<1024?bytes+' B':bytes<1048576?(bytes/1024).toFixed(1)+' KB':(bytes/1048576).toFixed(1)+' MB';}
148
+ function fileCard(target,options){
149
+ var s=setup(target,'gezel-file-card'),opts=options,button=el('button'),preview=el('span'),info=el('span'),name=el('span'),meta=el('span'),status=el('p');
150
+ button.type='button';preview.className='preview';info.className='info';name.className='name';meta.className='meta';name.style.display=meta.style.display='block';status.setAttribute('role','status');status.hidden=true;
151
+ info.append(name,meta);button.append(preview,info);s.root.append(button,status);
152
+ function render(){
153
+ var f=opts.file,filename=f.name||f.path.split('/').pop(),ext=(filename.split('.').pop()||'file').toUpperCase();
154
+ button.className='card'+(opts.variant==='row'?' row':'');name.textContent=filename;button.setAttribute('aria-label','Open '+filename);
155
+ meta.textContent=[f.path.includes('/')?f.path.slice(0,f.path.lastIndexOf('/')):'',size(f.size),f.mtime?new Date(f.mtime).toLocaleDateString(): ''].filter(Boolean).join(' · ');
156
+ preview.replaceChildren(el('span',ext));status.hidden=true;
157
+ if(opts.thumbnail!==false&&/\.(png|jpe?g|gif|webp|avif|bmp|svg|ico)$/i.test(f.path)){
158
+ try{var img=el('img');img.alt='';img.loading='lazy';img.src=typeof opts.thumbnail==='string'?opts.thumbnail:api.data.url(f.path,{source:f.source||'workspace'});img.onerror=function(){preview.replaceChildren(el('span',ext));};preview.replaceChildren(img);}catch(_){}
159
+ }
160
+ }
161
+ button.onclick=async function(){try{if(opts.onActivate)await opts.onActivate(opts.file);else{if(typeof api.data.open!=='function')throw new Error('Open this file in Gezel to use its viewer.');await api.data.open(opts.file.path,{source:opts.file.source||'workspace'});}}catch(e){status.textContent=e.message||String(e);status.hidden=false;}};
162
+ render();
163
+ return {element:s.host,update:function(next){opts=Object.assign({},opts,next);render();},destroy:function(){s.host.remove();s.host.disconnect();}};
164
+ }
165
+ function fileAdder(target,options){
166
+ var s=setup(target,'gezel-file-adder'),opts=options,box=el('div'),actions=el('div'),pick=el('button','Add files'),cancel=el('button','Cancel'),input=el('input'),description=el('p'),status=el('p'),progress=el('progress'),results=el('ul'),controller=null,destroyed=false,writable=false;
167
+ box.className='adder';actions.className='actions';results.className='results';pick.type=cancel.type='button';input.type='file';input.multiple=true;input.hidden=true;pick.disabled=true;cancel.hidden=progress.hidden=results.hidden=true;status.setAttribute('role','status');status.setAttribute('aria-live','polite');
168
+ actions.append(pick,cancel,input);box.append(actions,description,status,progress,results);s.root.append(box);
169
+ async function refresh(){
170
+ try{var targets=await api.data.importTargets(),t=targets.find(function(t){return t.id===opts.target;});if(destroyed)return;writable=!!(t&&t.writable);pick.disabled=!writable||!!controller;input.accept=t&&t.accept?t.accept.join(','):'';description.textContent=t?'Drop files here or use Add files. Destination: '+(t.path==='.'?'workspace folder':t.path)+(demo?' · Demo only — files stay in this tab.':' · Originals are kept; duplicate names get a number.'):'No import destination is configured.';status.textContent=writable?'':t&&t.reason||'This import destination is unavailable.';}catch(e){if(!destroyed){writable=false;pick.disabled=true;description.textContent='Add files';status.textContent=e.message||String(e);}}
171
+ }
172
+ async function add(files){
173
+ if(!writable||controller||!files.length)return;
174
+ controller=new AbortController();var own=controller;pick.disabled=true;cancel.hidden=false;cancel.disabled=false;progress.hidden=false;progress.value=0;progress.max=files.length;results.replaceChildren();results.hidden=true;box.setAttribute('aria-busy','true');
175
+ try{
176
+ var outcome=await api.data.importFiles(files,{target:opts.target,signal:own.signal,onProgress:function(p){if(!destroyed){progress.value=p.completed;status.textContent='Adding '+p.name+' ('+p.completed+'/'+p.total+')';}}});
177
+ if(destroyed)return;
178
+ outcome.forEach(function(r){results.append(el('li',r.ok?'Added '+r.file.path:r.name+': '+r.error));});results.hidden=false;
179
+ var added=outcome.filter(function(r){return r.ok;}).map(function(r){return r.file;});
180
+ status.textContent=added.length+' of '+outcome.length+' files added'+(demo?' to this demo.':'.');
181
+ if(added.length&&opts.onAdded)await opts.onAdded(added);
182
+ }catch(e){if(!destroyed)status.textContent=e.message||String(e);}
183
+ finally{controller=null;if(!destroyed){cancel.hidden=progress.hidden=true;pick.disabled=!writable;box.removeAttribute('aria-busy');}}
184
+ }
185
+ pick.onclick=function(){input.click();};input.onchange=function(){var files=Array.from(input.files||[]);input.value='';void add(files);};
186
+ cancel.onclick=function(){if(controller)controller.abort();cancel.disabled=true;};
187
+ box.ondragover=function(e){e.preventDefault();if(writable&&!controller){e.dataTransfer.dropEffect='copy';box.classList.add('drag');}};
188
+ box.ondragleave=function(){box.classList.remove('drag');};
189
+ box.ondrop=function(e){e.preventDefault();box.classList.remove('drag');void add(Array.from(e.dataTransfer.files||[]));};
190
+ var disconnect=s.host.disconnect;s.host.disconnect=function(){disconnect();if(controller)controller.abort();};
191
+ void refresh();
192
+ return {element:s.host,refresh:refresh,update:function(next){opts=Object.assign({},opts,next);void refresh();},destroy:function(){destroyed=true;s.host.remove();s.host.disconnect();}};
193
+ }
194
+ var components={version:1,fileCard:fileCard,fileAdder:fileAdder};
195
+ if(demo)components.demo={files:function(){return demoFiles.slice();},reset:function(){urls.forEach(function(url){URL.revokeObjectURL(url);});urls.clear();demoFiles=[];}};
196
+ api.ui.components=components;
197
+ return components;
198
+ };
199
+ })();
200
+ var make=window.makeDemoGezel;
201
+ window.makeDemoGezel=function(opts){
202
+ if(window.gezel)return window.gezel;
203
+ var node=document.getElementById('gezel-demo-config');
204
+ var config=node?JSON.parse(node.textContent):{};
205
+ var api=make(opts);
206
+ window.installGezelComponents(api,{demoTargets:config.imports||[],existingPaths:opts&&opts.existingPaths||[]});
207
+ return api;
208
+ };
209
+ })();
@@ -0,0 +1,7 @@
1
+ // Generated by Gezel's pages:sync-components.
2
+ export function injectPageDemo(html,config,assets){const[scriptUrl,styleUrl]=[assets.scriptUrl,assets.styleUrl].map(value=>value.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;"));if(html.includes('id="gezel-demo-config"'))throw new Error("Demo already bootstrapped.");const source=html.replace(/<script\b[^>]*>\s*\/\* gezel-page-demo-stub v1 \*\/[\s\S]*?<\/script\s*>/gi,"");const tags=`<link rel="stylesheet" data-gezel-typography href="${styleUrl}">
3
+ <script type="application/json" id="gezel-demo-config">${JSON.stringify(config).replace(/</g,"\\u003c")}<\/script>
4
+ <script src="${scriptUrl}"><\/script>
5
+ `;const head=/<head\b[^>]*>\s*(?:<meta\s+charset\s*=\s*["'][^"']+["']\s*\/?>)?/i;if(head.test(source))return source.replace(head,opening=>`${opening}
6
+ ${tags}`);const doctype=/^\s*<!doctype[^>]*>/i;return doctype.test(source)?source.replace(doctype,opening=>`${opening}
7
+ ${tags}`):tags+source}