@gramlot/gramlot 0.3.24 → 0.3.27

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 (144) hide show
  1. package/dist/components/chat/__init__.py +1 -1
  2. package/dist/components/chat/assets/collection.js +3 -3
  3. package/dist/components/chat/assets/index.js +1 -1
  4. package/dist/components/editors/__init__.py +2 -2
  5. package/dist/components/editors/assets/collection.js +21 -20
  6. package/dist/components/editors/assets/index.js +1 -1
  7. package/dist/components/editors/assets/modules/chunk-74O4WKIV.js +1 -0
  8. package/dist/components/editors/assets/modules/{code-mirror-engine-QX4A5FVO.js → code-mirror-engine-RWQTR5G5.js} +29 -29
  9. package/dist/components/editors/assets/modules/{jodit-engine-MMSPIWM7.js → jodit-engine-MTSA4GZ3.js} +292 -292
  10. package/dist/components/editors/assets/modules/markdown-document-VFC23FAY.js +1 -0
  11. package/dist/components/editors/assets/modules/{prose-mirror-engine-IXTRTG6B.js → prose-mirror-engine-GMZPJPNN.js} +13 -13
  12. package/dist/components/grid/__init__.py +3 -2
  13. package/dist/components/grid/assets/collection.js +77 -17
  14. package/dist/components/grid/assets/index.js +1 -1
  15. package/dist/components/grid/grammar.json +78 -1
  16. package/dist/components/grouplets/__init__.py +2 -2
  17. package/dist/components/grouplets/assets/collection.js +3 -20
  18. package/dist/components/grouplets/assets/index.js +1 -1
  19. package/dist/components/grouplets/assets/modules/chunk-BLMUM44K.js +1 -0
  20. package/dist/components/grouplets/assets/modules/markdown-document-YWNZTOKK.js +1 -0
  21. package/dist/components/inputs/__init__.py +1 -1
  22. package/dist/components/inputs/assets/collection.js +59 -34
  23. package/dist/components/inputs/assets/index.js +1 -1
  24. package/dist/components/inputs/grammar.json +64 -0
  25. package/dist/components/layout/__init__.py +1 -1
  26. package/dist/components/layout/assets/collection.js +67 -57
  27. package/dist/components/layout/assets/index.js +1 -1
  28. package/dist/components/layout/grammar.json +35 -0
  29. package/dist/components/selection_trial/__init__.py +1 -1
  30. package/dist/components/selection_trial/assets/collection.js +3 -3
  31. package/dist/components/selection_trial/assets/index.js +1 -1
  32. package/dist/components/selection_trial/grammar.json +35 -0
  33. package/dist/components/tree/__init__.py +1 -1
  34. package/dist/components/tree/assets/collection.js +26 -23
  35. package/dist/components/tree/assets/index.js +1 -1
  36. package/dist/components/tree/grammar.json +341 -1
  37. package/dist/components/typst/__init__.py +1 -1
  38. package/dist/components/typst/assets/collection.js +3 -3
  39. package/dist/components/typst/assets/index.js +1 -1
  40. package/dist/components/uploads/__init__.py +13 -0
  41. package/dist/components/uploads/assets/collection.js +67 -0
  42. package/dist/components/uploads/assets/index.js +3 -0
  43. package/dist/components/uploads/commands.json +7 -0
  44. package/dist/components/uploads/grammar.json +789 -0
  45. package/dist/{components/editors/assets/modules/chunk-OCFLP2K4.js → gramlot-markdown.js} +12 -12
  46. package/dist/gramlot.js +5455 -573
  47. package/dist/gramlot.min.js +1588 -43
  48. package/dist/runtime-notices.json +28 -0
  49. package/package.json +4 -2
  50. package/src/binding/grid-struct.js +1 -1
  51. package/src/binding/providers.js +4 -1
  52. package/src/binding/remote-resolver.js +1 -8
  53. package/src/binding/runtime.js +40 -1
  54. package/src/binding/validation-context.js +41 -0
  55. package/src/browser-camera-provider.d.ts +8 -0
  56. package/src/browser-camera-provider.js +104 -0
  57. package/src/builder/source.js +13 -2
  58. package/src/components/attachment-manager.js +160 -0
  59. package/src/components/bases.js +19 -6
  60. package/src/components/border-container.js +86 -8
  61. package/src/components/buttons.js +11 -1
  62. package/src/components/choice-editor.js +44 -16
  63. package/src/components/database-choices.js +13 -8
  64. package/src/components/editing-status-styles.js +26 -0
  65. package/src/components/editing-status.js +115 -0
  66. package/src/components/field-state.js +44 -58
  67. package/src/components/grid-cell-editor.js +245 -0
  68. package/src/components/grid-grammar.json +42 -0
  69. package/src/components/grid-structure.js +5 -1
  70. package/src/components/grid-styles.js +60 -1
  71. package/src/components/grid.js +103 -11
  72. package/src/components/grouplet-card.js +11 -3
  73. package/src/components/html-preview.js +17 -4
  74. package/src/components/image-crop-dialog.js +272 -0
  75. package/src/components/image-crop.js +79 -0
  76. package/src/components/image-uploader.js +252 -0
  77. package/src/components/inputs.js +4 -3
  78. package/src/components/jodit-engine.js +1 -1
  79. package/src/components/markdown-document.js +2 -2
  80. package/src/components/parameters.js +6 -2
  81. package/src/components/screen-capture.js +43 -0
  82. package/src/components/selected-container.js +6 -2
  83. package/src/components/tree.js +417 -17
  84. package/src/components/typed-editor.js +19 -9
  85. package/src/components/upload-engine.js +156 -0
  86. package/src/components/uploader.js +208 -0
  87. package/src/components/uploads.js +7 -0
  88. package/src/components/validation.js +1 -1
  89. package/src/editing-session.d.ts +26 -0
  90. package/src/editing-session.js +494 -0
  91. package/src/editor-values.js +57 -0
  92. package/src/experiments/selection-trial.js +18 -2
  93. package/src/format.js +22 -7
  94. package/src/gramlot.d.ts +3 -0
  95. package/src/gramlot.js +9 -5
  96. package/src/handlers/device-handler.d.ts +2 -1
  97. package/src/handlers/rpc-handler.d.ts +3 -3
  98. package/src/index-page-styles.js +1 -0
  99. package/src/index.d.ts +14 -1
  100. package/src/index.js +13 -0
  101. package/src/inout.d.ts +2 -0
  102. package/src/inout.js +6 -0
  103. package/src/markdown-loader.d.ts +1 -0
  104. package/src/markdown-loader.js +4 -0
  105. package/src/markdown.d.ts +1 -0
  106. package/src/markdown.js +2 -0
  107. package/src/media-frame.js +9 -0
  108. package/src/renderer/attributes.js +7 -1
  109. package/src/renderer/gramlot-renderer.d.ts +3 -0
  110. package/src/renderer/gramlot-renderer.js +42 -2
  111. package/src/server/assets.d.ts +1 -1
  112. package/src/server/assets.js +1 -1
  113. package/src/server/gramlot-server.d.ts +8 -1
  114. package/src/server/gramlot-server.js +83 -7
  115. package/src/server/index.d.ts +2 -0
  116. package/src/server/index.js +2 -0
  117. package/src/server/page-base.js +17 -4
  118. package/src/server/page.d.ts +13 -1
  119. package/src/server/page.js +6 -0
  120. package/src/server/source-import.d.ts +2 -0
  121. package/src/server/source-import.js +35 -0
  122. package/src/server/upload.d.ts +20 -0
  123. package/src/server/upload.js +142 -0
  124. package/src/server/visual-editor.d.ts +11 -0
  125. package/src/server/visual-editor.js +159 -0
  126. package/src/source-picker.d.ts +9 -0
  127. package/src/source-picker.js +56 -0
  128. package/src/tree-store.d.ts +24 -0
  129. package/src/tree-store.js +193 -0
  130. package/src/validation-run.js +50 -0
  131. package/src/view/button.js +8 -5
  132. package/src/view/controls.js +9 -42
  133. package/src/view/html.js +10 -2
  134. package/src/visual-editor-canvas.js +29 -0
  135. package/src/visual-editor-catalogue.js +34 -0
  136. package/src/visual-editor-icons.js +10 -0
  137. package/src/visual-editor.d.ts +61 -0
  138. package/src/visual-editor.js +1062 -0
  139. package/themes/gramlot-base/theme.css +141 -0
  140. package/tools/gramlot-tools-inspector.js +1 -1
  141. package/tools/inspector-agent.js +1 -1
  142. package/dist/components/editors/assets/modules/chunk-MMJXUHRQ.js +0 -3
  143. package/src/form-state.d.ts +0 -20
  144. package/src/form-state.js +0 -198
@@ -1,3 +1,3 @@
1
1
  export {default} from "./collection.js";
2
2
  export * from "./collection.js";
3
- export const buildId = "sha256:41859c8895b4c980662c79455c1115c009666a73241e39c78149c0cc2d6e410c";
3
+ export const buildId = "sha256:609c0356086c0bd576f35fb2411fd50d605d2c995f396077c12a22585320ecc3";
@@ -5,6 +5,121 @@
5
5
  "version": "1.1"
6
6
  },
7
7
  "elements": {
8
+ "rowActions": {
9
+ "_meta": {
10
+ "gramlot_component": {
11
+ "command": false,
12
+ "dataScope": false,
13
+ "parameters": {
14
+ "actionState": {
15
+ "default": null,
16
+ "dtype": "T",
17
+ "nullable": true
18
+ },
19
+ "position": {
20
+ "default": "end",
21
+ "dtype": "T"
22
+ },
23
+ "state": {
24
+ "binding": "read",
25
+ "default": null,
26
+ "dtype": "X",
27
+ "nullable": true
28
+ }
29
+ },
30
+ "presentationDefaults": [],
31
+ "sourceContext": true
32
+ },
33
+ "render_tag": "gramlot-row-actions"
34
+ },
35
+ "attributes": {
36
+ "accepts_var_keyword": true,
37
+ "accepts_var_positional": false,
38
+ "parameters": [
39
+ {
40
+ "annotation": {
41
+ "dtype": "T",
42
+ "kind": "dtype"
43
+ },
44
+ "default": "end",
45
+ "has_default": true,
46
+ "kind": "keyword_only",
47
+ "name": "position",
48
+ "role": "attribute"
49
+ },
50
+ {
51
+ "annotation": {
52
+ "items": [
53
+ {
54
+ "dtype": "T",
55
+ "kind": "dtype"
56
+ },
57
+ {
58
+ "dtype": "NN",
59
+ "kind": "dtype"
60
+ }
61
+ ],
62
+ "kind": "union"
63
+ },
64
+ "default": null,
65
+ "has_default": true,
66
+ "kind": "keyword_only",
67
+ "name": "actionState",
68
+ "role": "attribute"
69
+ },
70
+ {
71
+ "annotation": {
72
+ "items": [
73
+ {
74
+ "dtype": "X",
75
+ "kind": "dtype"
76
+ },
77
+ {
78
+ "dtype": "NN",
79
+ "kind": "dtype"
80
+ },
81
+ {
82
+ "base": {
83
+ "dtype": "T",
84
+ "kind": "dtype"
85
+ },
86
+ "kind": "annotated",
87
+ "metadata": [
88
+ {
89
+ "flags": 0,
90
+ "kind": "regex",
91
+ "pattern": "^[\\^=].+"
92
+ }
93
+ ]
94
+ }
95
+ ],
96
+ "kind": "union"
97
+ },
98
+ "default": null,
99
+ "has_default": true,
100
+ "kind": "keyword_only",
101
+ "name": "state",
102
+ "role": "attribute"
103
+ },
104
+ {
105
+ "annotation": {
106
+ "kind": "any"
107
+ },
108
+ "has_default": false,
109
+ "kind": "var_keyword",
110
+ "name": "attr",
111
+ "role": "attribute"
112
+ }
113
+ ]
114
+ },
115
+ "collection_key": null,
116
+ "doc": null,
117
+ "inherits_from": null,
118
+ "node_label": null,
119
+ "ns": null,
120
+ "parent_tags": null,
121
+ "sub_tags": "button,dropDownButton"
122
+ },
8
123
  "tree": {
9
124
  "_meta": {
10
125
  "gramlot_component": {
@@ -18,11 +133,43 @@
18
133
  "default": false,
19
134
  "dtype": "B"
20
135
  },
136
+ "checkChildren": {
137
+ "binding": "read",
138
+ "default": true,
139
+ "dtype": "B"
140
+ },
141
+ "checkedPaths": {
142
+ "binding": "twoWay",
143
+ "default": null,
144
+ "dtype": "T",
145
+ "nullable": true
146
+ },
147
+ "checkedPaths_joiner": {
148
+ "default": ",",
149
+ "dtype": "T"
150
+ },
21
151
  "draggable": {
22
152
  "binding": "read",
23
153
  "default": false,
24
154
  "dtype": "B"
25
155
  },
156
+ "excludeRoot": {
157
+ "binding": "read",
158
+ "default": null,
159
+ "dtype": "T",
160
+ "nullable": true
161
+ },
162
+ "favorites": {
163
+ "binding": "read",
164
+ "default": null,
165
+ "dtype": "X",
166
+ "nullable": true
167
+ },
168
+ "favoritesLabel": {
169
+ "binding": "read",
170
+ "default": "Favorites",
171
+ "dtype": "T"
172
+ },
26
173
  "getIconClass": {
27
174
  "default": null,
28
175
  "dtype": "T",
@@ -43,6 +190,11 @@
43
190
  "default": false,
44
191
  "dtype": "B"
45
192
  },
193
+ "internalNames": {
194
+ "binding": "read",
195
+ "default": false,
196
+ "dtype": "B"
197
+ },
46
198
  "labelAttribute": {
47
199
  "binding": "read",
48
200
  "default": null,
@@ -54,6 +206,14 @@
54
206
  "dtype": "T",
55
207
  "nullable": true
56
208
  },
209
+ "onChecked": {
210
+ "default": null,
211
+ "dtype": [
212
+ "B",
213
+ "T"
214
+ ],
215
+ "nullable": true
216
+ },
57
217
  "searchText": {
58
218
  "binding": "read",
59
219
  "default": "",
@@ -144,6 +304,36 @@
144
304
  "name": "labelAttribute",
145
305
  "role": "attribute"
146
306
  },
307
+ {
308
+ "annotation": {
309
+ "items": [
310
+ {
311
+ "dtype": "B",
312
+ "kind": "dtype"
313
+ },
314
+ {
315
+ "base": {
316
+ "dtype": "T",
317
+ "kind": "dtype"
318
+ },
319
+ "kind": "annotated",
320
+ "metadata": [
321
+ {
322
+ "flags": 0,
323
+ "kind": "regex",
324
+ "pattern": "^[\\^=].+"
325
+ }
326
+ ]
327
+ }
328
+ ],
329
+ "kind": "union"
330
+ },
331
+ "default": false,
332
+ "has_default": true,
333
+ "kind": "keyword_only",
334
+ "name": "internalNames",
335
+ "role": "attribute"
336
+ },
147
337
  {
148
338
  "annotation": {
149
339
  "items": [
@@ -174,6 +364,26 @@
174
364
  "name": "hideValues",
175
365
  "role": "attribute"
176
366
  },
367
+ {
368
+ "annotation": {
369
+ "items": [
370
+ {
371
+ "dtype": "T",
372
+ "kind": "dtype"
373
+ },
374
+ {
375
+ "dtype": "NN",
376
+ "kind": "dtype"
377
+ }
378
+ ],
379
+ "kind": "union"
380
+ },
381
+ "default": null,
382
+ "has_default": true,
383
+ "kind": "keyword_only",
384
+ "name": "excludeRoot",
385
+ "role": "attribute"
386
+ },
177
387
  {
178
388
  "annotation": {
179
389
  "items": [
@@ -276,6 +486,51 @@
276
486
  "name": "searchText",
277
487
  "role": "attribute"
278
488
  },
489
+ {
490
+ "annotation": {
491
+ "items": [
492
+ {
493
+ "dtype": "X",
494
+ "kind": "dtype"
495
+ },
496
+ {
497
+ "dtype": "NN",
498
+ "kind": "dtype"
499
+ },
500
+ {
501
+ "base": {
502
+ "dtype": "T",
503
+ "kind": "dtype"
504
+ },
505
+ "kind": "annotated",
506
+ "metadata": [
507
+ {
508
+ "flags": 0,
509
+ "kind": "regex",
510
+ "pattern": "^[\\^=].+"
511
+ }
512
+ ]
513
+ }
514
+ ],
515
+ "kind": "union"
516
+ },
517
+ "default": null,
518
+ "has_default": true,
519
+ "kind": "keyword_only",
520
+ "name": "favorites",
521
+ "role": "attribute"
522
+ },
523
+ {
524
+ "annotation": {
525
+ "dtype": "T",
526
+ "kind": "dtype"
527
+ },
528
+ "default": "Favorites",
529
+ "has_default": true,
530
+ "kind": "keyword_only",
531
+ "name": "favoritesLabel",
532
+ "role": "attribute"
533
+ },
279
534
  {
280
535
  "annotation": {
281
536
  "items": [
@@ -326,6 +581,91 @@
326
581
  "name": "selectedPath",
327
582
  "role": "attribute"
328
583
  },
584
+ {
585
+ "annotation": {
586
+ "items": [
587
+ {
588
+ "dtype": "B",
589
+ "kind": "dtype"
590
+ },
591
+ {
592
+ "dtype": "T",
593
+ "kind": "dtype"
594
+ },
595
+ {
596
+ "dtype": "NN",
597
+ "kind": "dtype"
598
+ }
599
+ ],
600
+ "kind": "union"
601
+ },
602
+ "default": null,
603
+ "has_default": true,
604
+ "kind": "keyword_only",
605
+ "name": "onChecked",
606
+ "role": "attribute"
607
+ },
608
+ {
609
+ "annotation": {
610
+ "items": [
611
+ {
612
+ "dtype": "T",
613
+ "kind": "dtype"
614
+ },
615
+ {
616
+ "dtype": "NN",
617
+ "kind": "dtype"
618
+ }
619
+ ],
620
+ "kind": "union"
621
+ },
622
+ "default": null,
623
+ "has_default": true,
624
+ "kind": "keyword_only",
625
+ "name": "checkedPaths",
626
+ "role": "attribute"
627
+ },
628
+ {
629
+ "annotation": {
630
+ "dtype": "T",
631
+ "kind": "dtype"
632
+ },
633
+ "default": ",",
634
+ "has_default": true,
635
+ "kind": "keyword_only",
636
+ "name": "checkedPaths_joiner",
637
+ "role": "attribute"
638
+ },
639
+ {
640
+ "annotation": {
641
+ "items": [
642
+ {
643
+ "dtype": "B",
644
+ "kind": "dtype"
645
+ },
646
+ {
647
+ "base": {
648
+ "dtype": "T",
649
+ "kind": "dtype"
650
+ },
651
+ "kind": "annotated",
652
+ "metadata": [
653
+ {
654
+ "flags": 0,
655
+ "kind": "regex",
656
+ "pattern": "^[\\^=].+"
657
+ }
658
+ ]
659
+ }
660
+ ],
661
+ "kind": "union"
662
+ },
663
+ "default": true,
664
+ "has_default": true,
665
+ "kind": "keyword_only",
666
+ "name": "checkChildren",
667
+ "role": "attribute"
668
+ },
329
669
  {
330
670
  "annotation": {
331
671
  "kind": "any"
@@ -343,7 +683,7 @@
343
683
  "node_label": null,
344
684
  "ns": null,
345
685
  "parent_tags": null,
346
- "sub_tags": ""
686
+ "sub_tags": "rowActions[:1]"
347
687
  }
348
688
  },
349
689
  "grammar": {
@@ -8,6 +8,6 @@ mygramlot = GramlotCollection(
8
8
  module="assets/index.js",
9
9
  css=(),
10
10
  dependencies=(),
11
- build_id="sha256:8c0da31937b915ab2c47cbc841151e8aa761db57e530d3c4f0e571814d5cbd72",
11
+ build_id="sha256:21a50a49907e97041f57c721212553fcc24fce5c2007deeaca7ef426a4c1949b",
12
12
  files=("assets/collection.js", "assets/index.js", "assets/modules/chunk-BLMUM44K.js", "assets/modules/typst-client-JHC6UVYG.js", "commands.json", "grammar.json",),
13
13
  )
@@ -1,4 +1,4 @@
1
- import{a as m,b as l}from"./modules/chunk-BLMUM44K.js";var r={};m(r,{defineCollection:()=>d});l(r,w);import*as w from"@gramlot/gramlot/components";import{defineCollection as u}from"@gramlot/gramlot/components";function d(i){if(i.name!=="typst")throw new Error("Unexpected bundled collection");let e=[],t={};i.css?.forEach((s,a)=>{s.href=e[a].href});for(let[s,a]of Object.entries(i.assets??{}))a.href=t[s].href;return u({...i,css:e,assets:t})}function p(i,e){return i.parameters=Object.fromEntries(Object.entries(i.constructor.gramlotComponent.parameters).map(([t,s])=>[t,Object.hasOwn(e,t)?e[t]:s.default])),Object.fromEntries(Object.entries(e).filter(([t])=>!Object.hasOwn(i.parameters,t)))}function f(i){return class extends i{#t=0;#s;#e;#n;#i=!1;#a=[];constructor(){super();let e=this.attachShadow({mode:"open"}),t=this.ownerDocument,s=t.createElement("style");s.textContent=`:host{display:block;height:100%;min-height:0;color:var(--gramlot-ink,CanvasText)}
1
+ import{a as m,b as l}from"./modules/chunk-BLMUM44K.js";var r={};m(r,{defineCollection:()=>d});l(r,b);import*as b from"@gramlot/gramlot/components";import{defineCollection as u}from"@gramlot/gramlot/components";function d(i){if(i.name!=="typst")throw new Error("Unexpected bundled collection");let t=[],e={};i.css?.forEach((s,a)=>{s.href=t[a].href});for(let[s,a]of Object.entries(i.assets??{}))a.href=e[s].href;return u({...i,css:t,assets:e})}function p(i,t){return i.parameters=f(i.constructor.gramlotComponent,t),Object.fromEntries(Object.entries(t).filter(([e])=>!Object.hasOwn(i.parameters,e)))}function f(i,t){return Object.fromEntries(Object.entries(i.parameters).map(([e,s])=>[e,Object.hasOwn(t,e)?t[e]:s.default]))}function g(i){return class extends i{#e=0;#s;#t;#n;#i=!1;#a=[];constructor(){super();let t=this.attachShadow({mode:"open"}),e=this.ownerDocument,s=e.createElement("style");s.textContent=`:host{display:block;height:100%;min-height:0;color:var(--gramlot-ink,CanvasText)}
2
2
  .preview{display:flex;flex-direction:column;height:100%;background:var(--gramlot-surface-subtle,Canvas)}
3
3
  .tools{display:flex;gap:16px;align-items:center;padding:8px 12px;font:inherit}
4
4
  a{color:var(--gramlot-brand-blue,LinkText);border-radius:var(--gramlot-radius-sm,4px);padding:4px 8px;text-decoration:none;white-space:nowrap}
@@ -8,5 +8,5 @@ import{a as m,b as l}from"./modules/chunk-BLMUM44K.js";var r={};m(r,{defineColle
8
8
  .status{white-space:pre-wrap;font-size:.9em;overflow:auto;max-height:8em}
9
9
  .pages{flex:1;min-height:0;overflow:auto;padding:16px}
10
10
  img{display:block;width:100%;height:auto;background:white;box-shadow:0 2px 10px #0002}
11
- img[hidden]{display:none}`;let a=t.createElement("div");a.className="preview";let o=t.createElement("div");o.className="tools",this.download=t.createElement("a"),this.download.textContent="Download PDF",this.status=t.createElement("span"),this.status.className="status",this.status.setAttribute("role","status");let n=t.createElement("div");n.className="pages",this.image=t.createElement("img"),this.image.alt="Typst document preview",this.image.hidden=!0,n.append(this.image),o.append(this.download,this.status),a.append(o,n),e.append(s,a),this.#r()}#r(){this.download.removeAttribute("href"),this.download.setAttribute("aria-disabled","true"),this.download.tabIndex=-1,this.image.hidden=!0,this.image.removeAttribute("src");for(let e of this.#a)this.ownerDocument.defaultView.URL.revokeObjectURL(e);this.#a=[]}connectedCallback(){this.#o()}disconnectedCallback(){++this.#t,clearTimeout(this.#s),this.#e?.release(),this.#e=null,this.#r()}projectAttributes(e){let t=this.parameters?.value,s=p(this,e);return this.download.download=this.parameters.filename,t!==this.parameters.value&&(++this.#t,this.#r(),this.#o()),s}#o(){clearTimeout(this.#s),!(!this.isConnected||!this.parameters)&&(this.status.textContent="Preparing preview\u2026",this.#s=setTimeout(()=>{this.ready=this.#l()},350))}async#l(){if(this.#i)return;let e=this.#t;this.#i=!0;try{this.#n??=import("./modules/typst-client-JHC6UVYG.js");let t=await this.#n;if(!this.isConnected||e!==this.#t)return;this.#e??=t.acquireCompiler(),this.status.textContent="Compiling\u2026";let s=await this.#e.compile(this.parameters.value);if(!this.isConnected||e!==this.#t)return;let{URL:a,Blob:o}=this.ownerDocument.defaultView,n=a.createObjectURL(new o([s.svg],{type:"image/svg+xml"})),c=a.createObjectURL(new o([s.pdf],{type:"application/pdf"}));this.#a=[n,c],this.image.src=n,this.image.hidden=!1,this.download.href=c,this.download.setAttribute("aria-disabled","false"),this.download.tabIndex=0,this.status.textContent=s.diagnostics.length?s.diagnostics.join(`
12
- `):"Preview and PDF are up to date"}catch(t){this.isConnected&&e===this.#t&&(this.status.textContent=t.message)}finally{this.#i=!1,this.isConnected&&e!==this.#t&&this.#o()}}}}var h=(0,r.defineComponent)({name:"typstPreview",tag:"gramlot-typst-preview",base:f,parameters:{value:{dtype:"T",default:"",binding:"read"},filename:{dtype:"T",default:"document.pdf",binding:"read"}},implementation:i=>class extends i{}});var O=d({name:"typst",components:[h]});export{h as TypstPreview,O as default};
11
+ img[hidden]{display:none}`;let a=e.createElement("div");a.className="preview";let o=e.createElement("div");o.className="tools",this.download=e.createElement("a"),this.download.textContent="Download PDF",this.status=e.createElement("span"),this.status.className="status",this.status.setAttribute("role","status");let n=e.createElement("div");n.className="pages",this.image=e.createElement("img"),this.image.alt="Typst document preview",this.image.hidden=!0,n.append(this.image),o.append(this.download,this.status),a.append(o,n),t.append(s,a),this.#r()}#r(){this.download.removeAttribute("href"),this.download.setAttribute("aria-disabled","true"),this.download.tabIndex=-1,this.image.hidden=!0,this.image.removeAttribute("src");for(let t of this.#a)this.ownerDocument.defaultView.URL.revokeObjectURL(t);this.#a=[]}connectedCallback(){this.#o()}disconnectedCallback(){++this.#e,clearTimeout(this.#s),this.#t?.release(),this.#t=null,this.#r()}projectAttributes(t){let e=this.parameters?.value,s=p(this,t);return this.download.download=this.parameters.filename,e!==this.parameters.value&&(++this.#e,this.#r(),this.#o()),s}#o(){clearTimeout(this.#s),!(!this.isConnected||!this.parameters)&&(this.status.textContent="Preparing preview\u2026",this.#s=setTimeout(()=>{this.ready=this.#l()},350))}async#l(){if(this.#i)return;let t=this.#e;this.#i=!0;try{this.#n??=import("./modules/typst-client-JHC6UVYG.js");let e=await this.#n;if(!this.isConnected||t!==this.#e)return;this.#t??=e.acquireCompiler(),this.status.textContent="Compiling\u2026";let s=await this.#t.compile(this.parameters.value);if(!this.isConnected||t!==this.#e)return;let{URL:a,Blob:o}=this.ownerDocument.defaultView,n=a.createObjectURL(new o([s.svg],{type:"image/svg+xml"})),h=a.createObjectURL(new o([s.pdf],{type:"application/pdf"}));this.#a=[n,h],this.image.src=n,this.image.hidden=!1,this.download.href=h,this.download.setAttribute("aria-disabled","false"),this.download.tabIndex=0,this.status.textContent=s.diagnostics.length?s.diagnostics.join(`
12
+ `):"Preview and PDF are up to date"}catch(e){this.isConnected&&t===this.#e&&(this.status.textContent=e.message)}finally{this.#i=!1,this.isConnected&&t!==this.#e&&this.#o()}}}}var c=(0,r.defineComponent)({name:"typstPreview",tag:"gramlot-typst-preview",base:g,parameters:{value:{dtype:"T",default:"",binding:"read"},filename:{dtype:"T",default:"document.pdf",binding:"read"}},implementation:i=>class extends i{}});var P=d({name:"typst",components:[c]});export{c as TypstPreview,P as default};
@@ -1,3 +1,3 @@
1
1
  export {default} from "./collection.js";
2
2
  export * from "./collection.js";
3
- export const buildId = "sha256:8c0da31937b915ab2c47cbc841151e8aa761db57e530d3c4f0e571814d5cbd72";
3
+ export const buildId = "sha256:21a50a49907e97041f57c721212553fcc24fce5c2007deeaca7ef426a4c1949b";
@@ -0,0 +1,13 @@
1
+ from gramlot import GramlotCollection
2
+
3
+ mygramlot = GramlotCollection(
4
+ name="uploads",
5
+ package=__package__,
6
+ grammar="grammar.json",
7
+ commands="commands.json",
8
+ module="assets/index.js",
9
+ css=(),
10
+ dependencies=(),
11
+ build_id="sha256:4eaaa83312ae3d906f36abdedba211197bea33d1f18d9e98405daabef13ad21d",
12
+ files=("assets/collection.js", "assets/index.js", "commands.json", "grammar.json",),
13
+ )