solid-ui 3.1.3-15 → 3.1.3-17

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 (140) hide show
  1. package/dist/chat/message.cjs.js +1 -1
  2. package/dist/chat/message.cjs.js.map +1 -1
  3. package/dist/chat/message.esm.js +9 -8
  4. package/dist/chat/message.esm.js.map +1 -1
  5. package/dist/chunks/{DialogProvider-0HIHjONx.js → DialogProvider-BFllJFfq.js} +2 -2
  6. package/dist/chunks/{DialogProvider-0HIHjONx.js.map → DialogProvider-BFllJFfq.js.map} +1 -1
  7. package/dist/chunks/{account-Ch8h_zTv.js → account-CFAjLyt5.js} +10 -10
  8. package/dist/chunks/{account-Ch8h_zTv.js.map → account-CFAjLyt5.js.map} +1 -1
  9. package/dist/chunks/{auth-D4NUMSzc.js → auth-IpQoQHJx.js} +10 -10
  10. package/dist/chunks/{auth-D4NUMSzc.js.map → auth-IpQoQHJx.js.map} +1 -1
  11. package/dist/chunks/{avatar-BWtz4RlU.js → avatar-CJ728tvg.js} +3 -3
  12. package/dist/chunks/{avatar-BWtz4RlU.js.map → avatar-CJ728tvg.js.map} +1 -1
  13. package/dist/chunks/{button-BJyFKOKO.js → button-CnmrOsEf.js} +2 -2
  14. package/dist/chunks/{button-BJyFKOKO.js.map → button-CnmrOsEf.js.map} +1 -1
  15. package/dist/chunks/{chunk.64OG2H45-BADxAtEI.js → chunk.64OG2H45-BFgXEuP7.js} +2 -2
  16. package/dist/chunks/{chunk.64OG2H45-BADxAtEI.js.map → chunk.64OG2H45-BFgXEuP7.js.map} +1 -1
  17. package/dist/chunks/{combobox-0NWv9K3D.js → combobox-D3eGdicW.js} +3 -3
  18. package/dist/chunks/{combobox-0NWv9K3D.js.map → combobox-D3eGdicW.js.map} +1 -1
  19. package/dist/chunks/{combobox-option-B-twy1Zn.js → combobox-option-BcXpUnWu.js} +2 -2
  20. package/dist/chunks/{combobox-option-B-twy1Zn.js.map → combobox-option-BcXpUnWu.js.map} +1 -1
  21. package/dist/chunks/{components-DrP7BOrs.js → components-BHoVP7zE.js} +13 -11
  22. package/dist/chunks/{components-DrP7BOrs.js.map → components-BHoVP7zE.js.map} +1 -1
  23. package/dist/chunks/{dialog-CcMVH-Ut.js → dialog-D9Ellvjx.js} +4 -4
  24. package/dist/chunks/{dialog-CcMVH-Ut.js.map → dialog-D9Ellvjx.js.map} +1 -1
  25. package/dist/chunks/{dialog-content-DcD_s3hK.js → dialog-content-B2FmmQvH.js} +2 -2
  26. package/dist/chunks/{dialog-content-DcD_s3hK.js.map → dialog-content-B2FmmQvH.js.map} +1 -1
  27. package/dist/chunks/{dialog-footer-CHgSH7G5.js → dialog-footer-CxjoqQJF.js} +2 -2
  28. package/dist/chunks/{dialog-footer-CHgSH7G5.js.map → dialog-footer-CxjoqQJF.js.map} +1 -1
  29. package/dist/chunks/{dialog-header-BjellR7_.js → dialog-header-0dobhr5C.js} +2 -2
  30. package/dist/chunks/{dialog-header-BjellR7_.js.map → dialog-header-0dobhr5C.js.map} +1 -1
  31. package/dist/chunks/{dialogs-CeHuLUo5.js → dialogs-D2n-R0lI.js} +2 -2
  32. package/dist/chunks/{dialogs-CeHuLUo5.js.map → dialogs-D2n-R0lI.js.map} +1 -1
  33. package/dist/chunks/{dialogs-root-CvsON-m8.js → dialogs-root-ngPW2Q6K.js} +3 -3
  34. package/dist/chunks/{dialogs-root-CvsON-m8.js.map → dialogs-root-ngPW2Q6K.js.map} +1 -1
  35. package/dist/chunks/{guard-BIesxo_f.js → guard-CkfPYP4e.js} +3 -3
  36. package/dist/chunks/{guard-BIesxo_f.js.map → guard-CkfPYP4e.js.map} +1 -1
  37. package/dist/chunks/{index.esm-CyyOkz04.js → index.esm-BW2SOmt6.js} +343 -255
  38. package/dist/chunks/index.esm-BW2SOmt6.js.map +1 -0
  39. package/dist/chunks/{input-CFDN76Y5.js → input-BIhn_8nf.js} +2 -2
  40. package/dist/chunks/{input-CFDN76Y5.js.map → input-BIhn_8nf.js.map} +1 -1
  41. package/dist/chunks/{jsonld-52q5nY_t.js → jsonld-PfYSYrj9.js} +120 -99
  42. package/dist/chunks/{jsonld-52q5nY_t.js.map → jsonld-PfYSYrj9.js.map} +1 -1
  43. package/dist/chunks/{login-button-BhdKFJ-F.js → login-button-C7TABAml.js} +4 -4
  44. package/dist/chunks/{login-button-BhdKFJ-F.js.map → login-button-C7TABAml.js.map} +1 -1
  45. package/dist/chunks/{logout-button-ClbKS9ss.js → logout-button-BDpulDka.js} +4 -4
  46. package/dist/chunks/{logout-button-ClbKS9ss.js.map → logout-button-BDpulDka.js.map} +1 -1
  47. package/dist/chunks/{menu-DVgG-el5.js → menu-hMtmUkel.js} +3 -3
  48. package/dist/chunks/{menu-DVgG-el5.js.map → menu-hMtmUkel.js.map} +1 -1
  49. package/dist/chunks/{menu-item-Bj3NgLzB.js → menu-item-BdCkmJol.js} +2 -2
  50. package/dist/chunks/{menu-item-Bj3NgLzB.js.map → menu-item-BdCkmJol.js.map} +1 -1
  51. package/dist/chunks/{photo-capture-CVKE0SKx.js → photo-capture-Bvixtxsq.js} +4 -4
  52. package/dist/chunks/{photo-capture-CVKE0SKx.js.map → photo-capture-Bvixtxsq.js.map} +1 -1
  53. package/dist/chunks/{photo-capture-modal-DARmhHUH.js → photo-capture-modal-BhmL3kYD.js} +6 -6
  54. package/dist/chunks/{photo-capture-modal-DARmhHUH.js.map → photo-capture-modal-BhmL3kYD.js.map} +1 -1
  55. package/dist/chunks/{provider-CBSBzOfP.js → provider-DP9Us_Aw.js} +5 -5
  56. package/dist/chunks/{provider-CBSBzOfP.js.map → provider-DP9Us_Aw.js.map} +1 -1
  57. package/dist/chunks/{rdf-form-BeuzVBOP.js → rdf-form-CUUvMplY.js} +4 -4
  58. package/dist/chunks/{rdf-form-BeuzVBOP.js.map → rdf-form-CUUvMplY.js.map} +1 -1
  59. package/dist/chunks/{rdf-input-n73oeSkf.js → rdf-input-CH5Aah6g.js} +5 -5
  60. package/dist/chunks/{rdf-input-n73oeSkf.js.map → rdf-input-CH5Aah6g.js.map} +1 -1
  61. package/dist/chunks/{select-BuIxSm1A.js → select-BcC-ICqO.js} +2 -2
  62. package/dist/chunks/{select-BuIxSm1A.js.map → select-BcC-ICqO.js.map} +1 -1
  63. package/dist/chunks/{select-option-Z8qZsCQo.js → select-option-B0uXcj2O.js} +2 -2
  64. package/dist/chunks/{select-option-Z8qZsCQo.js.map → select-option-B0uXcj2O.js.map} +1 -1
  65. package/dist/chunks/{signup-button-B-AgjjAK.js → signup-button-06D4XyCv.js} +4 -4
  66. package/dist/chunks/{signup-button-B-AgjjAK.js.map → signup-button-06D4XyCv.js.map} +1 -1
  67. package/dist/chunks/{solid-emblem-D4ItOckU.js → solid-emblem-CcQOqRX0.js} +2 -2
  68. package/dist/chunks/{solid-emblem-D4ItOckU.js.map → solid-emblem-CcQOqRX0.js.map} +1 -1
  69. package/dist/chunks/src-BImdSpRx.js +32792 -0
  70. package/dist/chunks/src-BImdSpRx.js.map +1 -0
  71. package/dist/chunks/{style-CjYxsW7j.js → style-_Eni1Wf8.js} +12 -10
  72. package/dist/chunks/{style-CjYxsW7j.js.map → style-_Eni1Wf8.js.map} +1 -1
  73. package/dist/components/account.js +1 -1
  74. package/dist/components/avatar.js +1 -1
  75. package/dist/components/button.js +1 -1
  76. package/dist/components/combobox-option.js +1 -1
  77. package/dist/components/combobox.js +1 -1
  78. package/dist/components/dialog-content.js +1 -1
  79. package/dist/components/dialog-footer.js +1 -1
  80. package/dist/components/dialog-header.js +1 -1
  81. package/dist/components/dialog-provider.js +1 -1
  82. package/dist/components/dialog.js +1 -1
  83. package/dist/components/dialogs-root.js +1 -1
  84. package/dist/components/guard.js +1 -1
  85. package/dist/components/input.js +1 -1
  86. package/dist/components/login-button.js +1 -1
  87. package/dist/components/login-modal.js +1 -1
  88. package/dist/components/logout-button.js +1 -1
  89. package/dist/components/menu-item.js +1 -1
  90. package/dist/components/menu.js +1 -1
  91. package/dist/components/photo-capture-modal.js +1 -1
  92. package/dist/components/photo-capture.js +1 -1
  93. package/dist/components/provider.js +1 -1
  94. package/dist/components/rdf-form.js +1 -1
  95. package/dist/components/rdf-input.js +1 -1
  96. package/dist/components/select-option.js +1 -1
  97. package/dist/components/select.js +1 -1
  98. package/dist/components/signup-button.js +1 -1
  99. package/dist/components/solid-emblem.js +1 -1
  100. package/dist/components.js +26 -26
  101. package/dist/index.cjs.js +1 -1
  102. package/dist/index.cjs.js.map +1 -1
  103. package/dist/index.d.ts +1 -0
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.esm.js +4 -2
  106. package/dist/index.esm.js.map +1 -1
  107. package/dist/index.js +8 -8
  108. package/dist/lib/code-editor/CodeEditor.cjs.js +2 -0
  109. package/dist/lib/code-editor/CodeEditor.cjs.js.map +1 -0
  110. package/dist/lib/code-editor/CodeEditor.d.ts +18 -0
  111. package/dist/lib/code-editor/CodeEditor.d.ts.map +1 -0
  112. package/dist/lib/code-editor/CodeEditor.esm.js +107 -0
  113. package/dist/lib/code-editor/CodeEditor.esm.js.map +1 -0
  114. package/dist/lib/code-editor/index.cjs.js +1 -0
  115. package/dist/lib/code-editor/index.d.ts +2 -0
  116. package/dist/lib/code-editor/index.d.ts.map +1 -0
  117. package/dist/lib/code-editor/index.esm.js +2 -0
  118. package/dist/lib/log.cjs.js +1 -1
  119. package/dist/lib/log.cjs.js.map +1 -1
  120. package/dist/lib/log.esm.js +10 -8
  121. package/dist/lib/log.esm.js.map +1 -1
  122. package/dist/lib/table.cjs.js.map +1 -1
  123. package/dist/lib/table.esm.js.map +1 -1
  124. package/dist/loader.js +8 -8
  125. package/dist/login/login.cjs.js +1 -1
  126. package/dist/login/login.cjs.js.map +1 -1
  127. package/dist/login/login.d.ts.map +1 -1
  128. package/dist/login/login.esm.js +6 -0
  129. package/dist/login/login.esm.js.map +1 -1
  130. package/dist/solid-ui.js +153 -115
  131. package/dist/solid-ui.min.js +153 -115
  132. package/dist/solid-ui.min.js.map +1 -1
  133. package/dist/widgets/forms.cjs.js +1 -1
  134. package/dist/widgets/forms.cjs.js.map +1 -1
  135. package/dist/widgets/forms.esm.js +13 -11
  136. package/dist/widgets/forms.esm.js.map +1 -1
  137. package/package.json +14 -2
  138. package/dist/chunks/index.esm-CyyOkz04.js.map +0 -1
  139. package/dist/chunks/src-B5SL8UtS.js +0 -15538
  140. package/dist/chunks/src-B5SL8UtS.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// REMOVE @ts-ignore as you migrate files to TypeScript\n// @ts-ignore\nimport ns from './lib/ns'\nimport { acl, aclControl } from './acl/index'\nimport { create } from './create/index'\n// @ts-ignore\nimport { icons } from './lib/iconBase'\nimport * as language from './widgets/forms/autocomplete/language'\nimport * as log from './lib/log'\nimport { matrix } from './matrix/index'\nimport { media } from './media/index'\n// @ts-ignore\nimport { messageArea } from './lib/messageArea'\n// @ts-ignore\nimport { infiniteMessageArea } from './chat/infinite'\n// @ts-ignore\nimport * as pad from './lib/pad'\n// @ts-ignore\nimport * as participation from './lib/participation'\n// @ts-ignore\nimport * as preferences from './lib/preferences'\n// @ts-ignore\nimport { style } from './lib/style'\n// @ts-ignore\nimport { renderTableViewPane as table } from './lib/table'\nimport * as tabs from './lib/tabs'\n// @ts-ignore\nimport * as utils from './utils'\nimport * as login from './login/login'\nimport * as widgets from './widgets/index'\nimport { initHeader } from './header'\nimport { initFooter } from './footer'\nimport * as createTypes from './create/types'\n\nexport const dom = typeof window !== 'undefined' ? window.document : null // Idea that UI.dom can be adapted in non-browser environments\n\n// this variables are directly used in the storybook\nexport {\n ns,\n acl,\n aclControl,\n create,\n createTypes,\n icons,\n language,\n log,\n login,\n matrix,\n media,\n messageArea,\n infiniteMessageArea,\n pad,\n participation,\n preferences,\n style,\n table,\n tabs,\n utils,\n widgets,\n initHeader,\n initFooter\n}\n// uses in solid-panes\nexport type { CreateContext, NewAppInstanceOptions } from './create/types'\n\nexport * from './lib/auth'\nexport * from './lib/components'\nexport * from './lib/dialogs'\nexport * from './lib/file-explorer/context'\n"],"mappings":"+yDAkCA,IAAa,EAAM,OAAO,OAAW,IAAc,OAAO,SAAW"}
1
+ {"version":3,"file":"index.cjs.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// REMOVE @ts-ignore as you migrate files to TypeScript\n// @ts-ignore\nimport ns from './lib/ns'\nimport { acl, aclControl } from './acl/index'\nimport { create } from './create/index'\n// @ts-ignore\nimport { icons } from './lib/iconBase'\nimport * as language from './widgets/forms/autocomplete/language'\nimport * as log from './lib/log'\nimport { matrix } from './matrix/index'\nimport { media } from './media/index'\n// @ts-ignore\nimport { messageArea } from './lib/messageArea'\n// @ts-ignore\nimport { infiniteMessageArea } from './chat/infinite'\n// @ts-ignore\nimport * as pad from './lib/pad'\n// @ts-ignore\nimport * as participation from './lib/participation'\n// @ts-ignore\nimport * as preferences from './lib/preferences'\n// @ts-ignore\nimport { style } from './lib/style'\n// @ts-ignore\nimport { renderTableViewPane as table } from './lib/table'\nimport * as tabs from './lib/tabs'\n// @ts-ignore\nimport * as utils from './utils'\nimport * as login from './login/login'\nimport * as widgets from './widgets/index'\nimport { initHeader } from './header'\nimport { initFooter } from './footer'\nimport * as createTypes from './create/types'\n\nexport const dom = typeof window !== 'undefined' ? window.document : null // Idea that UI.dom can be adapted in non-browser environments\n\n// this variables are directly used in the storybook\nexport {\n ns,\n acl,\n aclControl,\n create,\n createTypes,\n icons,\n language,\n log,\n login,\n matrix,\n media,\n messageArea,\n infiniteMessageArea,\n pad,\n participation,\n preferences,\n style,\n table,\n tabs,\n utils,\n widgets,\n initHeader,\n initFooter\n}\n// uses in solid-panes\nexport type { CreateContext, NewAppInstanceOptions } from './create/types'\n\nexport * from './lib/auth'\nexport * from './lib/components'\nexport * from './lib/dialogs'\nexport * from './lib/file-explorer/context'\nexport * from './lib/code-editor'\n"],"mappings":"04DAkCA,IAAa,EAAM,OAAO,OAAW,IAAc,OAAO,SAAW"}
package/dist/index.d.ts CHANGED
@@ -27,4 +27,5 @@ export * from './lib/auth';
27
27
  export * from './lib/components';
28
28
  export * from './lib/dialogs';
29
29
  export * from './lib/file-explorer/context';
30
+ export * from './lib/code-editor';
30
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,QAAQ,MAAM,uCAAuC,CAAA;AACjE,OAAO,KAAK,GAAG,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,KAAK,GAAG,MAAM,WAAW,CAAA;AAEhC,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,OAAO,EAAE,mBAAmB,IAAI,KAAK,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAElC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,UA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;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,OAAO,EAAE,mBAAmB,IAAI,KAAK,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAElC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAA;AAE7C,eAAO,MAAM,GAAG,iBAAyD,CAAA;AAGzE,OAAO,EACL,EAAE,EACF,GAAG,EACH,UAAU,EACV,MAAM,EACN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,GAAG,EACH,KAAK,EACL,MAAM,EACN,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,GAAG,EACH,aAAa,EACb,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,UAAU,EACV,UAAU,EACX,CAAA;AAED,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAE1E,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mBAAmB,CAAA"}
package/dist/index.esm.js CHANGED
@@ -40,9 +40,11 @@ import "./lib/dialogs/index.esm.js";
40
40
  import B, { DEFAULT_SIGNUP_URL as V } from "./lib/auth/SolidAuth.esm.js";
41
41
  import "./lib/auth/index.esm.js";
42
42
  import { fileExplorerContext as H } from "./lib/file-explorer/context.esm.js";
43
+ import { CodeEditor as U } from "./lib/code-editor/CodeEditor.esm.js";
44
+ import "./lib/code-editor/index.esm.js";
43
45
  //#region src/index.ts
44
- var U = typeof window < "u" ? window.document : null;
46
+ var W = typeof window < "u" ? window.document : null;
45
47
  //#endregion
46
- export { C as Account, j as CloseDialogEvent, T as DEFAULT_AUTH_CONTEXT, O as DEFAULT_DIALOG_CONTEXT, V as DEFAULT_SIGNUP_URL, L as Dialog, P as DialogComponent, M as DialogTrait, I as FormControlComponent, F as FormControlTrait, w as NoopAuth, R as ShowDialogEvent, B as SolidAuth, N as WebComponent, c as acl, l as aclControl, E as authContext, u as create, S as createTypes, A as customElement, k as dialogContext, U as dom, H as fileExplorerContext, D as generateId, i as icons, g as infiniteMessageArea, x as initFooter, b as initHeader, a as language, t as log, s as login, d as matrix, f as media, p as messageArea, e as ns, h as pad, m as participation, _ as preferences, z as showDialog, r as style, v as table, y as tabs, n as utils, o as widgets };
48
+ export { C as Account, j as CloseDialogEvent, U as CodeEditor, T as DEFAULT_AUTH_CONTEXT, O as DEFAULT_DIALOG_CONTEXT, V as DEFAULT_SIGNUP_URL, L as Dialog, P as DialogComponent, M as DialogTrait, I as FormControlComponent, F as FormControlTrait, w as NoopAuth, R as ShowDialogEvent, B as SolidAuth, N as WebComponent, c as acl, l as aclControl, E as authContext, u as create, S as createTypes, A as customElement, k as dialogContext, W as dom, H as fileExplorerContext, D as generateId, i as icons, g as infiniteMessageArea, x as initFooter, b as initHeader, a as language, t as log, s as login, d as matrix, f as media, p as messageArea, e as ns, h as pad, m as participation, _ as preferences, z as showDialog, r as style, v as table, y as tabs, n as utils, o as widgets };
47
49
 
48
50
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// REMOVE @ts-ignore as you migrate files to TypeScript\n// @ts-ignore\nimport ns from './lib/ns'\nimport { acl, aclControl } from './acl/index'\nimport { create } from './create/index'\n// @ts-ignore\nimport { icons } from './lib/iconBase'\nimport * as language from './widgets/forms/autocomplete/language'\nimport * as log from './lib/log'\nimport { matrix } from './matrix/index'\nimport { media } from './media/index'\n// @ts-ignore\nimport { messageArea } from './lib/messageArea'\n// @ts-ignore\nimport { infiniteMessageArea } from './chat/infinite'\n// @ts-ignore\nimport * as pad from './lib/pad'\n// @ts-ignore\nimport * as participation from './lib/participation'\n// @ts-ignore\nimport * as preferences from './lib/preferences'\n// @ts-ignore\nimport { style } from './lib/style'\n// @ts-ignore\nimport { renderTableViewPane as table } from './lib/table'\nimport * as tabs from './lib/tabs'\n// @ts-ignore\nimport * as utils from './utils'\nimport * as login from './login/login'\nimport * as widgets from './widgets/index'\nimport { initHeader } from './header'\nimport { initFooter } from './footer'\nimport * as createTypes from './create/types'\n\nexport const dom = typeof window !== 'undefined' ? window.document : null // Idea that UI.dom can be adapted in non-browser environments\n\n// this variables are directly used in the storybook\nexport {\n ns,\n acl,\n aclControl,\n create,\n createTypes,\n icons,\n language,\n log,\n login,\n matrix,\n media,\n messageArea,\n infiniteMessageArea,\n pad,\n participation,\n preferences,\n style,\n table,\n tabs,\n utils,\n widgets,\n initHeader,\n initFooter\n}\n// uses in solid-panes\nexport type { CreateContext, NewAppInstanceOptions } from './create/types'\n\nexport * from './lib/auth'\nexport * from './lib/components'\nexport * from './lib/dialogs'\nexport * from './lib/file-explorer/context'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,IAAM,OAAO,SAAW,MAAc,OAAO,WAAW"}
1
+ {"version":3,"file":"index.esm.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// REMOVE @ts-ignore as you migrate files to TypeScript\n// @ts-ignore\nimport ns from './lib/ns'\nimport { acl, aclControl } from './acl/index'\nimport { create } from './create/index'\n// @ts-ignore\nimport { icons } from './lib/iconBase'\nimport * as language from './widgets/forms/autocomplete/language'\nimport * as log from './lib/log'\nimport { matrix } from './matrix/index'\nimport { media } from './media/index'\n// @ts-ignore\nimport { messageArea } from './lib/messageArea'\n// @ts-ignore\nimport { infiniteMessageArea } from './chat/infinite'\n// @ts-ignore\nimport * as pad from './lib/pad'\n// @ts-ignore\nimport * as participation from './lib/participation'\n// @ts-ignore\nimport * as preferences from './lib/preferences'\n// @ts-ignore\nimport { style } from './lib/style'\n// @ts-ignore\nimport { renderTableViewPane as table } from './lib/table'\nimport * as tabs from './lib/tabs'\n// @ts-ignore\nimport * as utils from './utils'\nimport * as login from './login/login'\nimport * as widgets from './widgets/index'\nimport { initHeader } from './header'\nimport { initFooter } from './footer'\nimport * as createTypes from './create/types'\n\nexport const dom = typeof window !== 'undefined' ? window.document : null // Idea that UI.dom can be adapted in non-browser environments\n\n// this variables are directly used in the storybook\nexport {\n ns,\n acl,\n aclControl,\n create,\n createTypes,\n icons,\n language,\n log,\n login,\n matrix,\n media,\n messageArea,\n infiniteMessageArea,\n pad,\n participation,\n preferences,\n style,\n table,\n tabs,\n utils,\n widgets,\n initHeader,\n initFooter\n}\n// uses in solid-panes\nexport type { CreateContext, NewAppInstanceOptions } from './create/types'\n\nexport * from './lib/auth'\nexport * from './lib/components'\nexport * from './lib/dialogs'\nexport * from './lib/file-explorer/context'\nexport * from './lib/code-editor'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,IAAM,OAAO,SAAW,MAAc,OAAO,WAAW"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { m as e } from "./chunks/index.esm-CyyOkz04.js";
2
- import { a as t, c as n, n as r, o as i, s as a, t as o } from "./chunks/auth-D4NUMSzc.js";
3
- import { l as s, m as c, t as l } from "./chunks/style-CjYxsW7j.js";
4
- import { _ as u, a as d, b as f, c as p, d as m, f as h, g, h as _, i as v, l as y, m as b, n as x, o as S, p as C, r as w, s as T, t as E, u as D, v as O, x as k, y as A } from "./chunks/src-B5SL8UtS.js";
5
- import { _ as j, a as M, g as N, h as P, m as F, n as I, o as L, t as R, v as z, y as B } from "./chunks/components-DrP7BOrs.js";
6
- import { n as V, t as H } from "./chunks/dialogs-CeHuLUo5.js";
7
- import { t as U } from "./chunks/show-dialog-eEW5yRBv.js";
8
- export { n as Account, P as CloseDialogEvent, t as DEFAULT_AUTH_CONTEXT, j as DEFAULT_DIALOG_CONTEXT, o as DEFAULT_SIGNUP_URL, V as Dialog, M as DialogComponent, F as DialogTrait, R as FormControlComponent, I as FormControlTrait, a as NoopAuth, U as ShowDialogEvent, r as SolidAuth, L as WebComponent, g as acl, u as aclControl, i as authContext, _ as create, w as createTypes, N as customElement, z as dialogContext, E as dom, x as fileExplorerContext, B as generateId, k as icons, y as infiniteMessageArea, v as initFooter, d as initHeader, f as language, c as log, O as login, b as matrix, C as media, h as messageArea, e as ns, D as pad, m as participation, p as preferences, H as showDialog, l as style, T as table, S as tabs, s as utils, A as widgets };
1
+ import { m as e } from "./chunks/index.esm-BW2SOmt6.js";
2
+ import { a as t, c as n, n as r, o as i, s as a, t as o } from "./chunks/auth-IpQoQHJx.js";
3
+ import { l as s, m as c, t as l } from "./chunks/style-_Eni1Wf8.js";
4
+ import { S as u, _ as d, a as f, b as p, c as m, d as h, f as g, g as _, h as v, i as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, x as A, y as j } from "./chunks/src-BImdSpRx.js";
5
+ import { _ as M, a as N, g as P, h as F, m as I, n as L, o as R, t as z, v as B, y as V } from "./chunks/components-BHoVP7zE.js";
6
+ import { n as H, t as U } from "./chunks/dialogs-D2n-R0lI.js";
7
+ import { t as W } from "./chunks/show-dialog-eEW5yRBv.js";
8
+ export { n as Account, F as CloseDialogEvent, S as CodeEditor, t as DEFAULT_AUTH_CONTEXT, M as DEFAULT_DIALOG_CONTEXT, o as DEFAULT_SIGNUP_URL, H as Dialog, N as DialogComponent, I as DialogTrait, z as FormControlComponent, L as FormControlTrait, a as NoopAuth, W as ShowDialogEvent, r as SolidAuth, R as WebComponent, d as acl, k as aclControl, i as authContext, _ as create, y as createTypes, P as customElement, B as dialogContext, D as dom, T as fileExplorerContext, V as generateId, u as icons, O as infiniteMessageArea, f as initFooter, C as initHeader, A as language, c as log, j as login, v as matrix, x as media, w as messageArea, e as ns, h as pad, g as participation, b as preferences, U as showDialog, l as style, m as table, E as tabs, s as utils, p as widgets };
@@ -0,0 +1,2 @@
1
+ let e=require("@codemirror/state"),t=require("@codemirror/view"),n=require("@codemirror/language"),r=require("@codemirror/commands"),i=require("@codemirror/lang-css"),a=require("@codemirror/lang-html"),o=require("@codemirror/lang-javascript"),s=require("@codemirror/lang-json"),c=require("@codemirror/lang-markdown"),l=require("@codemirror/lang-xml"),u=require("@uiw/codemirror-theme-vscode"),d=require("@codemirror/legacy-modes/mode/turtle"),f=require("@codemirror/legacy-modes/mode/sparql"),p=require("@codemirror/legacy-modes/mode/ntriples");var m=class{_view=null;_languageCompartment=null;_editableCompartment=null;_onDirtyChange;_isDirty=!1;async initialize(i,a=``,o=`text/turtle`,s=`dark`,c){this._view&&this._view.destroy(),this._languageCompartment=new e.Compartment,this._editableCompartment=new e.Compartment,this._onDirtyChange=c,this._isDirty=!1;let l=await this._getLanguageExtension(o),d=e.EditorState.create({doc:a,extensions:[s===`dark`?u.vscodeDark:u.vscodeLight,t.EditorView.theme({"&":{minHeight:`6lh`}}),this._languageCompartment.of(l),this._editableCompartment.of(t.EditorView.editable.of(!0)),(0,n.syntaxHighlighting)(n.defaultHighlightStyle,{fallback:!0}),(0,t.lineNumbers)(),(0,r.history)(),(0,t.drawSelection)(),t.EditorView.lineWrapping,t.EditorView.updateListener.of(e=>{e.docChanged&&!this._isDirty&&(this._isDirty=!0,this._onDirtyChange?.(!0))}),t.keymap.of([...r.defaultKeymap,...r.historyKeymap])]});this._view=new t.EditorView({state:d,parent:i})}destroy(){this._view?.destroy(),this._view=null,this._isDirty=!1}getValue(){return this._view?this._view.state.doc.toString():``}replaceContent(e){this._view&&this._view.state.doc.toString()!==e&&this._view.dispatch({changes:{from:0,to:this._view.state.doc.length,insert:e}})}resetDirtyState(){this._isDirty=!1}setReadOnly(e){if(!this._view)return;let n=this._editableCompartment;n&&this._view.dispatch({effects:n.reconfigure(t.EditorView.editable.of(!e))})}focusEditor(){this._view?.focus()}async setLanguage(e){if(!this._view)return;let t=this._languageCompartment;if(!t)return;let n=await this._getLanguageExtension(e);this._view.dispatch({effects:t.reconfigure(n)})}async _getLanguageExtension(e){switch(e){case`text/turtle`:case`text/n3`:return n.StreamLanguage.define(d.turtle);case`application/sparql-update`:case`application/sparql-query`:return n.StreamLanguage.define(f.sparql);case`application/nquads`:case`application/n-quads`:case`application/n-triples`:return n.StreamLanguage.define(p.ntriples);case`application/json`:case`application/ld+json`:return(0,s.json)();case`text/html`:case`application/xhtml+xml`:return(0,a.html)();case`text/markdown`:case`text/x-markdown`:case`text/md`:return(0,c.markdown)();case`application/rdf+xml`:case`application/xml`:return(0,l.xml)();case`text/css`:return(0,i.css)();case`text/javascript`:case`application/javascript`:case`application/ecmascript`:return(0,o.javascript)();default:return[]}}};exports.CodeEditor=m;
2
+ //# sourceMappingURL=CodeEditor.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeEditor.cjs.js","names":[],"sources":["../../../src/lib/code-editor/CodeEditor.ts"],"sourcesContent":["import type { ThemeMode } from 'pane-registry'\nimport { Compartment, EditorState } from '@codemirror/state'\nimport { EditorView, drawSelection, keymap, lineNumbers } from '@codemirror/view'\nimport { defaultHighlightStyle, syntaxHighlighting, StreamLanguage } from '@codemirror/language'\nimport { defaultKeymap, history, historyKeymap } from '@codemirror/commands'\nimport { css } from '@codemirror/lang-css'\nimport { html } from '@codemirror/lang-html'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { json } from '@codemirror/lang-json'\nimport { markdown } from '@codemirror/lang-markdown'\nimport { xml } from '@codemirror/lang-xml'\nimport { vscodeDark, vscodeLight } from '@uiw/codemirror-theme-vscode'\nimport { turtle } from '@codemirror/legacy-modes/mode/turtle'\nimport { sparql } from '@codemirror/legacy-modes/mode/sparql'\nimport { ntriples } from '@codemirror/legacy-modes/mode/ntriples'\n\nexport class CodeEditor {\n private _view: EditorView | null = null\n private _languageCompartment: Compartment | null = null\n private _editableCompartment: Compartment | null = null\n private _onDirtyChange?: (dirty: boolean) => void\n private _isDirty = false\n\n async initialize (container: HTMLElement, initialDoc = '', contentType: string = 'text/turtle', theme: ThemeMode = 'dark', onDirtyChange?: (dirty: boolean) => void) {\n if (this._view) {\n this._view.destroy()\n }\n\n this._languageCompartment = new Compartment()\n this._editableCompartment = new Compartment()\n this._onDirtyChange = onDirtyChange\n this._isDirty = false\n const languageExtension = await this._getLanguageExtension(contentType)\n\n const state = EditorState.create({\n doc: initialDoc,\n extensions: [\n theme === 'dark' ? vscodeDark : vscodeLight,\n EditorView.theme({\n '&': {\n minHeight: '6lh'\n }\n }),\n this._languageCompartment.of(languageExtension),\n this._editableCompartment.of(EditorView.editable.of(true)),\n syntaxHighlighting(defaultHighlightStyle, { fallback: true }),\n lineNumbers(),\n history(),\n drawSelection(),\n EditorView.lineWrapping,\n EditorView.updateListener.of((update) => {\n if (update.docChanged && !this._isDirty) {\n this._isDirty = true\n this._onDirtyChange?.(true)\n }\n }),\n keymap.of([\n ...defaultKeymap,\n ...historyKeymap\n ])\n ]\n })\n\n this._view = new EditorView({\n state,\n parent: container\n })\n }\n\n destroy () {\n this._view?.destroy()\n this._view = null\n this._isDirty = false\n }\n\n getValue (): string {\n return this._view ? this._view.state.doc.toString() : ''\n }\n\n replaceContent (text: string) {\n if (!this._view) return\n const current = this._view.state.doc.toString()\n if (current === text) return\n this._view.dispatch({\n changes: { from: 0, to: this._view.state.doc.length, insert: text }\n })\n }\n\n resetDirtyState () {\n this._isDirty = false\n }\n\n setReadOnly (readOnly: boolean) {\n if (!this._view) return\n const editableCompartment = this._editableCompartment\n if (!editableCompartment) return\n this._view.dispatch({\n effects: editableCompartment.reconfigure(EditorView.editable.of(!readOnly))\n })\n }\n\n focusEditor () {\n this._view?.focus()\n }\n\n async setLanguage (contentType: string) {\n if (!this._view) return\n const languageCompartment = this._languageCompartment\n if (!languageCompartment) return\n\n const extension = await this._getLanguageExtension(contentType)\n this._view.dispatch({\n effects: languageCompartment.reconfigure(extension)\n })\n }\n\n private async _getLanguageExtension (contentType: string) {\n switch (contentType) {\n case 'text/turtle':\n case 'text/n3':\n return StreamLanguage.define(turtle)\n\n case 'application/sparql-update':\n case 'application/sparql-query':\n return StreamLanguage.define(sparql)\n\n case 'application/nquads':\n case 'application/n-quads':\n case 'application/n-triples':\n return StreamLanguage.define(ntriples)\n\n case 'application/json':\n case 'application/ld+json':\n return json()\n\n case 'text/html':\n case 'application/xhtml+xml':\n return html()\n\n case 'text/markdown':\n case 'text/x-markdown':\n case 'text/md':\n return markdown()\n\n case 'application/rdf+xml':\n case 'application/xml':\n return xml()\n\n case 'text/css':\n return css()\n\n case 'text/javascript':\n case 'application/javascript':\n case 'application/ecmascript':\n return javascript()\n\n default:\n return []\n }\n }\n}\n"],"mappings":"iiBAgBA,IAAa,EAAb,KAAwB,CACtB,MAAmC,KACnC,qBAAmD,KACnD,qBAAmD,KACnD,eACA,SAAmB,GAEnB,MAAM,WAAY,EAAwB,EAAa,GAAI,EAAsB,cAAe,EAAmB,OAAQ,EAA0C,CAC/J,KAAK,OACP,KAAK,MAAM,QAAQ,EAGrB,KAAK,qBAAuB,IAAI,EAAA,YAChC,KAAK,qBAAuB,IAAI,EAAA,YAChC,KAAK,eAAiB,EACtB,KAAK,SAAW,GAChB,IAAM,EAAoB,MAAM,KAAK,sBAAsB,CAAW,EAEhE,EAAQ,EAAA,YAAY,OAAO,CAC/B,IAAK,EACL,WAAY,CACV,IAAU,OAAS,EAAA,WAAa,EAAA,YAChC,EAAA,WAAW,MAAM,CACf,IAAK,CACH,UAAW,KACb,CACF,CAAC,EACD,KAAK,qBAAqB,GAAG,CAAiB,EAC9C,KAAK,qBAAqB,GAAG,EAAA,WAAW,SAAS,GAAG,EAAI,CAAC,GACzD,EAAA,EAAA,mBAAA,CAAmB,EAAA,sBAAuB,CAAE,SAAU,EAAK,CAAC,GAC5D,EAAA,EAAA,YA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AuB,EAAqB,CACxD,OAAQ,EAAR,CACE,IAAK,cACL,IAAK,UACH,OAAO,EAAA,eAAe,OAAO,EAAA,MAAM,EAErC,IAAK,4BACL,IAAK,2BACH,OAAO,EAAA,eAAe,OAAO,EAAA,MAAM,EAErC,IAAK,qBACL,IAAK,sBACL,IAAK,wBACH,OAAO,EAAA,eAAe,OAAO,EAAA,QAAQ,EAEvC,IAAK,mBACL,IAAK,sBACH,OAAA,EAAO,EAAA,KAAA,CAAK,EAEd,IAAK,YACL,IAAK,wBACH,OAAA,EAAO,EAAA,KAAA,CAAK,EAEd,IAAK,gBACL,IAAK,kBACL,IAAK,UACH,OAAA,EAAO,EAAA,SAAA,CAAS,EAElB,IAAK,sBACL,IAAK,kBACH,OAAA,EAAO,EAAA,IAAA,CAAI,EAEb,IAAK,WACH,OAAA,EAAO,EAAA,IAAA,CAAI,EAEb,IAAK,kBACL,IAAK,yBACL,IAAK,yBACH,OAAA,EAAO,EAAA,WAAA,CAAW,EAEpB,QACE,MAAO,CAAC,CACZ,CACF,CACF"}
@@ -0,0 +1,18 @@
1
+ import { ThemeMode } from 'pane-registry';
2
+ export declare class CodeEditor {
3
+ private _view;
4
+ private _languageCompartment;
5
+ private _editableCompartment;
6
+ private _onDirtyChange?;
7
+ private _isDirty;
8
+ initialize(container: HTMLElement, initialDoc?: string, contentType?: string, theme?: ThemeMode, onDirtyChange?: (dirty: boolean) => void): Promise<void>;
9
+ destroy(): void;
10
+ getValue(): string;
11
+ replaceContent(text: string): void;
12
+ resetDirtyState(): void;
13
+ setReadOnly(readOnly: boolean): void;
14
+ focusEditor(): void;
15
+ setLanguage(contentType: string): Promise<void>;
16
+ private _getLanguageExtension;
17
+ }
18
+ //# sourceMappingURL=CodeEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../src/lib/code-editor/CodeEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAgB9C,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,oBAAoB,CAA2B;IACvD,OAAO,CAAC,oBAAoB,CAA2B;IACvD,OAAO,CAAC,cAAc,CAAC,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAQ;IAElB,UAAU,CAAE,SAAS,EAAE,WAAW,EAAE,UAAU,SAAK,EAAE,WAAW,GAAE,MAAsB,EAAE,KAAK,GAAE,SAAkB,EAAE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IA8CnK,OAAO;IAMP,QAAQ,IAAK,MAAM;IAInB,cAAc,CAAE,IAAI,EAAE,MAAM;IAS5B,eAAe;IAIf,WAAW,CAAE,QAAQ,EAAE,OAAO;IAS9B,WAAW;IAIL,WAAW,CAAE,WAAW,EAAE,MAAM;YAWxB,qBAAqB;CA4CpC"}
@@ -0,0 +1,107 @@
1
+ import { Compartment as e, EditorState as t } from "@codemirror/state";
2
+ import { EditorView as n, drawSelection as r, keymap as i, lineNumbers as a } from "@codemirror/view";
3
+ import { StreamLanguage as o, defaultHighlightStyle as s, syntaxHighlighting as c } from "@codemirror/language";
4
+ import { defaultKeymap as l, history as u, historyKeymap as d } from "@codemirror/commands";
5
+ import { css as f } from "@codemirror/lang-css";
6
+ import { html as p } from "@codemirror/lang-html";
7
+ import { javascript as m } from "@codemirror/lang-javascript";
8
+ import { json as h } from "@codemirror/lang-json";
9
+ import { markdown as g } from "@codemirror/lang-markdown";
10
+ import { xml as _ } from "@codemirror/lang-xml";
11
+ import { vscodeDark as v, vscodeLight as y } from "@uiw/codemirror-theme-vscode";
12
+ import { turtle as b } from "@codemirror/legacy-modes/mode/turtle";
13
+ import { sparql as x } from "@codemirror/legacy-modes/mode/sparql";
14
+ import { ntriples as S } from "@codemirror/legacy-modes/mode/ntriples";
15
+ //#region src/lib/code-editor/CodeEditor.ts
16
+ var C = class {
17
+ _view = null;
18
+ _languageCompartment = null;
19
+ _editableCompartment = null;
20
+ _onDirtyChange;
21
+ _isDirty = !1;
22
+ async initialize(o, f = "", p = "text/turtle", m = "dark", h) {
23
+ this._view && this._view.destroy(), this._languageCompartment = new e(), this._editableCompartment = new e(), this._onDirtyChange = h, this._isDirty = !1;
24
+ let g = await this._getLanguageExtension(p), _ = t.create({
25
+ doc: f,
26
+ extensions: [
27
+ m === "dark" ? v : y,
28
+ n.theme({ "&": { minHeight: "6lh" } }),
29
+ this._languageCompartment.of(g),
30
+ this._editableCompartment.of(n.editable.of(!0)),
31
+ c(s, { fallback: !0 }),
32
+ a(),
33
+ u(),
34
+ r(),
35
+ n.lineWrapping,
36
+ n.updateListener.of((e) => {
37
+ e.docChanged && !this._isDirty && (this._isDirty = !0, this._onDirtyChange?.(!0));
38
+ }),
39
+ i.of([...l, ...d])
40
+ ]
41
+ });
42
+ this._view = new n({
43
+ state: _,
44
+ parent: o
45
+ });
46
+ }
47
+ destroy() {
48
+ this._view?.destroy(), this._view = null, this._isDirty = !1;
49
+ }
50
+ getValue() {
51
+ return this._view ? this._view.state.doc.toString() : "";
52
+ }
53
+ replaceContent(e) {
54
+ this._view && this._view.state.doc.toString() !== e && this._view.dispatch({ changes: {
55
+ from: 0,
56
+ to: this._view.state.doc.length,
57
+ insert: e
58
+ } });
59
+ }
60
+ resetDirtyState() {
61
+ this._isDirty = !1;
62
+ }
63
+ setReadOnly(e) {
64
+ if (!this._view) return;
65
+ let t = this._editableCompartment;
66
+ t && this._view.dispatch({ effects: t.reconfigure(n.editable.of(!e)) });
67
+ }
68
+ focusEditor() {
69
+ this._view?.focus();
70
+ }
71
+ async setLanguage(e) {
72
+ if (!this._view) return;
73
+ let t = this._languageCompartment;
74
+ if (!t) return;
75
+ let n = await this._getLanguageExtension(e);
76
+ this._view.dispatch({ effects: t.reconfigure(n) });
77
+ }
78
+ async _getLanguageExtension(e) {
79
+ switch (e) {
80
+ case "text/turtle":
81
+ case "text/n3": return o.define(b);
82
+ case "application/sparql-update":
83
+ case "application/sparql-query": return o.define(x);
84
+ case "application/nquads":
85
+ case "application/n-quads":
86
+ case "application/n-triples": return o.define(S);
87
+ case "application/json":
88
+ case "application/ld+json": return h();
89
+ case "text/html":
90
+ case "application/xhtml+xml": return p();
91
+ case "text/markdown":
92
+ case "text/x-markdown":
93
+ case "text/md": return g();
94
+ case "application/rdf+xml":
95
+ case "application/xml": return _();
96
+ case "text/css": return f();
97
+ case "text/javascript":
98
+ case "application/javascript":
99
+ case "application/ecmascript": return m();
100
+ default: return [];
101
+ }
102
+ }
103
+ };
104
+ //#endregion
105
+ export { C as CodeEditor };
106
+
107
+ //# sourceMappingURL=CodeEditor.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeEditor.esm.js","names":[],"sources":["../../../src/lib/code-editor/CodeEditor.ts"],"sourcesContent":["import type { ThemeMode } from 'pane-registry'\nimport { Compartment, EditorState } from '@codemirror/state'\nimport { EditorView, drawSelection, keymap, lineNumbers } from '@codemirror/view'\nimport { defaultHighlightStyle, syntaxHighlighting, StreamLanguage } from '@codemirror/language'\nimport { defaultKeymap, history, historyKeymap } from '@codemirror/commands'\nimport { css } from '@codemirror/lang-css'\nimport { html } from '@codemirror/lang-html'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { json } from '@codemirror/lang-json'\nimport { markdown } from '@codemirror/lang-markdown'\nimport { xml } from '@codemirror/lang-xml'\nimport { vscodeDark, vscodeLight } from '@uiw/codemirror-theme-vscode'\nimport { turtle } from '@codemirror/legacy-modes/mode/turtle'\nimport { sparql } from '@codemirror/legacy-modes/mode/sparql'\nimport { ntriples } from '@codemirror/legacy-modes/mode/ntriples'\n\nexport class CodeEditor {\n private _view: EditorView | null = null\n private _languageCompartment: Compartment | null = null\n private _editableCompartment: Compartment | null = null\n private _onDirtyChange?: (dirty: boolean) => void\n private _isDirty = false\n\n async initialize (container: HTMLElement, initialDoc = '', contentType: string = 'text/turtle', theme: ThemeMode = 'dark', onDirtyChange?: (dirty: boolean) => void) {\n if (this._view) {\n this._view.destroy()\n }\n\n this._languageCompartment = new Compartment()\n this._editableCompartment = new Compartment()\n this._onDirtyChange = onDirtyChange\n this._isDirty = false\n const languageExtension = await this._getLanguageExtension(contentType)\n\n const state = EditorState.create({\n doc: initialDoc,\n extensions: [\n theme === 'dark' ? vscodeDark : vscodeLight,\n EditorView.theme({\n '&': {\n minHeight: '6lh'\n }\n }),\n this._languageCompartment.of(languageExtension),\n this._editableCompartment.of(EditorView.editable.of(true)),\n syntaxHighlighting(defaultHighlightStyle, { fallback: true }),\n lineNumbers(),\n history(),\n drawSelection(),\n EditorView.lineWrapping,\n EditorView.updateListener.of((update) => {\n if (update.docChanged && !this._isDirty) {\n this._isDirty = true\n this._onDirtyChange?.(true)\n }\n }),\n keymap.of([\n ...defaultKeymap,\n ...historyKeymap\n ])\n ]\n })\n\n this._view = new EditorView({\n state,\n parent: container\n })\n }\n\n destroy () {\n this._view?.destroy()\n this._view = null\n this._isDirty = false\n }\n\n getValue (): string {\n return this._view ? this._view.state.doc.toString() : ''\n }\n\n replaceContent (text: string) {\n if (!this._view) return\n const current = this._view.state.doc.toString()\n if (current === text) return\n this._view.dispatch({\n changes: { from: 0, to: this._view.state.doc.length, insert: text }\n })\n }\n\n resetDirtyState () {\n this._isDirty = false\n }\n\n setReadOnly (readOnly: boolean) {\n if (!this._view) return\n const editableCompartment = this._editableCompartment\n if (!editableCompartment) return\n this._view.dispatch({\n effects: editableCompartment.reconfigure(EditorView.editable.of(!readOnly))\n })\n }\n\n focusEditor () {\n this._view?.focus()\n }\n\n async setLanguage (contentType: string) {\n if (!this._view) return\n const languageCompartment = this._languageCompartment\n if (!languageCompartment) return\n\n const extension = await this._getLanguageExtension(contentType)\n this._view.dispatch({\n effects: languageCompartment.reconfigure(extension)\n })\n }\n\n private async _getLanguageExtension (contentType: string) {\n switch (contentType) {\n case 'text/turtle':\n case 'text/n3':\n return StreamLanguage.define(turtle)\n\n case 'application/sparql-update':\n case 'application/sparql-query':\n return StreamLanguage.define(sparql)\n\n case 'application/nquads':\n case 'application/n-quads':\n case 'application/n-triples':\n return StreamLanguage.define(ntriples)\n\n case 'application/json':\n case 'application/ld+json':\n return json()\n\n case 'text/html':\n case 'application/xhtml+xml':\n return html()\n\n case 'text/markdown':\n case 'text/x-markdown':\n case 'text/md':\n return markdown()\n\n case 'application/rdf+xml':\n case 'application/xml':\n return xml()\n\n case 'text/css':\n return css()\n\n case 'text/javascript':\n case 'application/javascript':\n case 'application/ecmascript':\n return javascript()\n\n default:\n return []\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,IAAb,MAAwB;CACtB,QAAmC;CACnC,uBAAmD;CACnD,uBAAmD;CACnD;CACA,WAAmB;CAEnB,MAAM,WAAY,GAAwB,IAAa,IAAI,IAAsB,eAAe,IAAmB,QAAQ,GAA0C;EAQnK,AAPI,KAAK,SACP,KAAK,MAAM,QAAQ,GAGrB,KAAK,uBAAuB,IAAI,EAAY,GAC5C,KAAK,uBAAuB,IAAI,EAAY,GAC5C,KAAK,iBAAiB,GACtB,KAAK,WAAW;EAChB,IAAM,IAAoB,MAAM,KAAK,sBAAsB,CAAW,GAEhE,IAAQ,EAAY,OAAO;GAC/B,KAAK;GACL,YAAY;IACV,MAAU,SAAS,IAAa;IAChC,EAAW,MAAM,EACf,KAAK,EACH,WAAW,MACb,EACF,CAAC;IACD,KAAK,qBAAqB,GAAG,CAAiB;IAC9C,KAAK,qBAAqB,GAAG,EAAW,SAAS,GAAG,EAAI,CAAC;IACzD,EAAmB,GAAuB,EAAE,UAAU,GAAK,CAAC;IAC5D,EAAY;IACZ,EAAQ;IACR,EAAc;IACd,EAAW;IACX,EAAW,eAAe,IAAI,MAAW;KACvC,AAAI,EAAO,cAAc,CAAC,KAAK,aAC7B,KAAK,WAAW,IAChB,KAAK,iBAAiB,EAAI;IAE9B,CAAC;IACD,EAAO,GAAG,CACR,GAAG,GACH,GAAG,CACL,CAAC;GACH;EACF,CAAC;E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AK;GACL,KAAK,WACH,OAAO,EAAS;GAElB,KAAK;GACL,KAAK,mBACH,OAAO,EAAI;GAEb,KAAK,YACH,OAAO,EAAI;GAEb,KAAK;GACL,KAAK;GACL,KAAK,0BACH,OAAO,EAAW;GAEpB,SACE,OAAO,CAAC;EACZ;CACF;AACF"}
@@ -0,0 +1 @@
1
+ const e=require("./CodeEditor.cjs.js");exports.CodeEditor=e.CodeEditor;
@@ -0,0 +1,2 @@
1
+ export * from './CodeEditor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/code-editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { CodeEditor as e } from "./CodeEditor.esm.js";
2
+ export { e as CodeEditor };
@@ -1,2 +1,2 @@
1
- var e=require("../_virtual/_rolldown/runtime.cjs.js").__exportAll({LogLevel:()=>c,alert:()=>b,clear:()=>x,debug:()=>g,dumpHTML:()=>C,error:()=>v,escapeForXML:()=>E,info:()=>_,logAscending:()=>w,logDescending:()=>T,msg:()=>m,setInternals:()=>D,setLevel:()=>S,success:()=>y,warn:()=>h}),t=1,n=2,r=4,i=8,a=16,o=32,s=63,c=function(e){return e[e.Error=t]=`Error`,e[e.Warning=n]=`Warning`,e[e.Message=r]=`Message`,e[e.Success=i]=`Success`,e[e.Info=a]=`Info`,e[e.Debug=o]=`Debug`,e[e.All=s]=`All`,e}({}),l=7,u=!1,d=document,f=window;function p(e,t=r,n=`mesg`){if(l&t)if(d!==void 0){let t=d.getElementById(`status`);if(!t)return;let r=d.createElement(`span`);r.setAttribute(`class`,n);let i=new Date;r.innerHTML=`${i.getHours()}:${i.getMinutes()}:${i.getSeconds()} [${n}] ${E(e)}<br/>`,u?t.insertBefore(r,t.firstChild):t.appendChild(r)}else typeof console<`u`&&console.log(e)}function m(e){p(e)}function h(e){p(e,n,`warn`)}function g(e){p(e,o,`dbug`)}function _(e){p(e,a,`info`)}function v(e){p(e,t,`eror`)}function y(e){p(e,i,`good`)}function b(e){f&&f.alert!==void 0?f.alert(e):h(e)}function x(){let e=d?.getElementById(`status`);e&&(e.innerHTML=``)}function S(e){l=s,g(`Log level is now `+e),l=e}function C(){if(!d)return;let e=l;l=s,g(d?.body?.innerHTML||``),l=e}function w(){u=!0}function T(){u=!1}function E(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function D(e,t){f=e,d=t}exports.LogLevel=c,exports.alert=b,exports.clear=x,exports.debug=g,exports.dumpHTML=C,exports.error=v,exports.escapeForXML=E,exports.info=_,exports.logAscending=w,exports.logDescending=T,Object.defineProperty(exports,"log_exports",{enumerable:!0,get:function(){return e}}),exports.msg=m,exports.setInternals=D,exports.setLevel=S,exports.success=y,exports.warn=h;
1
+ var e=require("../_virtual/_rolldown/runtime.cjs.js").__exportAll({LogLevel:()=>c,alert:()=>b,clear:()=>x,debug:()=>g,dumpHTML:()=>C,error:()=>v,escapeForXML:()=>E,info:()=>_,logAscending:()=>w,logDescending:()=>T,msg:()=>m,setInternals:()=>D,setLevel:()=>S,success:()=>y,warn:()=>h}),t=1,n=2,r=4,i=8,a=16,o=32,s=63,c=function(e){return e[e.Error=t]=`Error`,e[e.Warning=n]=`Warning`,e[e.Message=r]=`Message`,e[e.Success=i]=`Success`,e[e.Info=a]=`Info`,e[e.Debug=o]=`Debug`,e[e.All=s]=`All`,e}({}),l=7,u=!1,d=document,f=window;function p(e,t=r,n=`mesg`){if(l&t){if(d!==void 0){let t=d.getElementById(`status`);if(!t)return;let r=d.createElement(`span`);r.setAttribute(`class`,n);let i=new Date;r.innerHTML=`${i.getHours()}:${i.getMinutes()}:${i.getSeconds()} [${n}] ${E(e)}<br/>`,u?t.insertBefore(r,t.firstChild):t.appendChild(r)}else typeof console<`u`&&console.log(e)}}function m(e){p(e)}function h(e){p(e,n,`warn`)}function g(e){p(e,o,`dbug`)}function _(e){p(e,a,`info`)}function v(e){p(e,t,`eror`)}function y(e){p(e,i,`good`)}function b(e){f&&f.alert!==void 0?f.alert(e):h(e)}function x(){let e=d?.getElementById(`status`);e&&(e.innerHTML=``)}function S(e){l=s,g(`Log level is now `+e),l=e}function C(){if(!d)return;let e=l;l=s,g(d?.body?.innerHTML||``),l=e}function w(){u=!0}function T(){u=!1}function E(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function D(e,t){f=e,d=t}exports.LogLevel=c,exports.alert=b,exports.clear=x,exports.debug=g,exports.dumpHTML=C,exports.error=v,exports.escapeForXML=E,exports.info=_,exports.logAscending=w,exports.logDescending=T,Object.defineProperty(exports,"log_exports",{enumerable:!0,get:function(){return e}}),exports.msg=m,exports.setInternals=D,exports.setLevel=S,exports.success=y,exports.warn=h;
2
2
  //# sourceMappingURL=log.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.cjs.js","names":[],"sources":["../../src/lib/log.ts"],"sourcesContent":["// /////////////////////// Logging\n//\n// bitmask levels\n// const TNONE = 0\n/** @internal */\nconst TERROR = 1\n/** @internal */\nconst TWARN = 2\n/** @internal */\nconst TMESG = 4\n/** @internal */\nconst TSUCCESS = 8\n/** @internal */\nconst TINFO = 16\n/** @internal */\nconst TDEBUG = 32\n/** @internal */\nconst TALL = 63\n\n/** @internal */\nexport enum LogLevel {\n Error = TERROR,\n Warning = TWARN,\n Message = TMESG,\n Success = TSUCCESS,\n Info = TINFO,\n Debug = TDEBUG,\n All = TALL\n}\n\n/** @internal */\nlet _level: number = TERROR + TWARN + TMESG\n/** @internal */\nlet _ascending: boolean = false\n/** @internal */\nlet _dom: HTMLDocument = document // must be able to override for tests\n/** @internal */\nlet _window: Window = window // must be able to override for tests\n\n/** @internal */\nfunction log (str: string, type: number = TMESG, typestr: string = 'mesg') {\n if (!(_level & type)) return // bitmask\n\n if (typeof _dom !== 'undefined') {\n const logArea = _dom.getElementById('status')\n if (!logArea) return\n\n const addendum = _dom.createElement('span')\n addendum.setAttribute('class', typestr)\n const now = new Date()\n addendum.innerHTML = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} [${typestr}] ${escapeForXML(str)}<br/>`\n if (_ascending) {\n logArea.insertBefore(addendum, logArea.firstChild)\n } else {\n logArea.appendChild(addendum)\n }\n } else if (typeof console !== 'undefined') {\n console.log(str)\n }\n}\n\n/**\n * Adds a message to the element with id \"status\". The messages are prepended with\n * time and type of message, in this case [mesg].\n */\nexport function msg (message: string) {\n log(message)\n}\n\n/**\n * Adds a warning message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [warn].\n */\nexport function warn (message: string): void {\n log(message, TWARN, 'warn')\n}\n\n/**\n * Adds a debugging message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [dbug].\n */\nexport function debug (message: string): void {\n log(message, TDEBUG, 'dbug')\n}\n\n/**\n * Adds a info message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [info].\n */\nexport function info (message: string): void {\n log(message, TINFO, 'info')\n}\n\n/**\n * Adds a error to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [eror].\n */\nexport function error (message: string): void {\n log(message, TERROR, 'eror')\n}\n\n/**\n * Adds a success message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [good].\n */\nexport function success (message: string): void {\n log(message, TSUCCESS, 'good')\n}\n\n/**\n * Uses the global alert to send an alert. If global alert is not available, it\n * will output the message using the method [[warning]]s.\n */\nexport function alert (message: string): void {\n if (_window && typeof _window.alert !== 'undefined') {\n _window.alert(message)\n } else {\n warn(message)\n }\n}\n\n/**\n * Will clear the content of the element with id \"status\".\n */\nexport function clear (): void {\n const logArea = _dom?.getElementById('status')\n if (!logArea) return\n logArea.innerHTML = ''\n}\n\n/**\n * Lets you configure which types of messages will be shown. The module uses\n * [bitmask](https://en.wikipedia.org/wiki/Mask_(computing)) to filter which\n * types of messages should be shown. E.g. if you only want warning messages\n * to be shown, pass 2 to the function, if you want warning and success to be\n * shown, pass 10 (2+8). By passing the sum of all, 63, you'll show all\n * types of messages.\n *\n * - Error: 1\n * - Warning: 2\n * - Message: 4\n * - Success: 8\n * - Info: 16\n * - Debug: 32\n */\nexport function setLevel (level: number): void {\n _level = TALL\n debug('Log level is now ' + level)\n _level = level\n}\n\n/**\n * Will dump the current HTML using the [[debug]] method.\n */\nexport function dumpHTML (): void {\n if (!_dom) return\n const level = _level\n _level = TALL\n debug(_dom?.body?.innerHTML || '')\n _level = level\n}\n\n/**\n * Will start prepending messages the list of log messages.\n */\nexport function logAscending () {\n _ascending = true\n}\n\n/**\n * Will start appending messages the list of log messages. (This is default\n * behavior.)\n */\nexport function logDescending () {\n _ascending = false\n}\n\n/** @internal */\nexport function escapeForXML (str: string): string {\n // can be replaced with function utils module when migrating\n return str\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n}\n\n/** @internal */\nexport function setInternals (window, document) {\n _window = window\n _dom = document\n}\n"],"mappings":"6RAKM,EAAS,EAET,EAAQ,EAER,EAAQ,EAER,EAAW,EAEX,EAAQ,GAER,EAAS,GAET,EAAO,GAGD,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,MAAQ,GAAA,QACR,EAAA,EAAA,QAAU,GAAA,UACV,EAAA,EAAA,QAAU,GAAA,UACV,EAAA,EAAA,QAAU,GAAA,UACV,EAAA,EAAA,KAAO,GAAA,OACP,EAAA,EAAA,MAAQ,GAAA,QACR,EAAA,EAAA,IAAM,GAAA,OACR,EAAA,CAAA,CAAA,EAGI,EAAiB,EAEjB,EAAsB,GAEtB,EAAqB,SAErB,EAAkB,OAGtB,SAAS,EAAK,EAAa,EAAe,EAAO,EAAkB,OAAQ,CACnE,KAAS,EAEf,GAAW,IAAS,OAAa,CAC/B,IAAM,EAAU,EAAK,eAAe,QAAQ,EAC5C,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,EAAK,cAAc,MAAM,EAC1C,EAAS,aAAa,QAAS,CAAO,EACtC,IAAM,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QAAQ,KAAM,MAAM,CACzB,CAGA,SAAgB,EAAc,EAAQ,EAAU,CAC9C,EAAU,EACV,EAAO,CACT"}
1
+ {"version":3,"file":"log.cjs.js","names":[],"sources":["../../src/lib/log.ts"],"sourcesContent":["// /////////////////////// Logging\n//\n// bitmask levels\n// const TNONE = 0\n/** @internal */\nconst TERROR = 1\n/** @internal */\nconst TWARN = 2\n/** @internal */\nconst TMESG = 4\n/** @internal */\nconst TSUCCESS = 8\n/** @internal */\nconst TINFO = 16\n/** @internal */\nconst TDEBUG = 32\n/** @internal */\nconst TALL = 63\n\n/** @internal */\nexport enum LogLevel {\n Error = TERROR,\n Warning = TWARN,\n Message = TMESG,\n Success = TSUCCESS,\n Info = TINFO,\n Debug = TDEBUG,\n All = TALL\n}\n\n/** @internal */\nlet _level: number = TERROR + TWARN + TMESG\n/** @internal */\nlet _ascending: boolean = false\n/** @internal */\nlet _dom: HTMLDocument = document // must be able to override for tests\n/** @internal */\nlet _window: Window = window // must be able to override for tests\n\n/** @internal */\nfunction log (str: string, type: number = TMESG, typestr: string = 'mesg') {\n if (!(_level & type)) return // bitmask\n\n if (typeof _dom !== 'undefined') {\n const logArea = _dom.getElementById('status')\n if (!logArea) return\n\n const addendum = _dom.createElement('span')\n addendum.setAttribute('class', typestr)\n const now = new Date()\n addendum.innerHTML = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} [${typestr}] ${escapeForXML(str)}<br/>`\n if (_ascending) {\n logArea.insertBefore(addendum, logArea.firstChild)\n } else {\n logArea.appendChild(addendum)\n }\n } else if (typeof console !== 'undefined') {\n console.log(str)\n }\n}\n\n/**\n * Adds a message to the element with id \"status\". The messages are prepended with\n * time and type of message, in this case [mesg].\n */\nexport function msg (message: string) {\n log(message)\n}\n\n/**\n * Adds a warning message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [warn].\n */\nexport function warn (message: string): void {\n log(message, TWARN, 'warn')\n}\n\n/**\n * Adds a debugging message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [dbug].\n */\nexport function debug (message: string): void {\n log(message, TDEBUG, 'dbug')\n}\n\n/**\n * Adds a info message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [info].\n */\nexport function info (message: string): void {\n log(message, TINFO, 'info')\n}\n\n/**\n * Adds a error to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [eror].\n */\nexport function error (message: string): void {\n log(message, TERROR, 'eror')\n}\n\n/**\n * Adds a success message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [good].\n */\nexport function success (message: string): void {\n log(message, TSUCCESS, 'good')\n}\n\n/**\n * Uses the global alert to send an alert. If global alert is not available, it\n * will output the message using the method [[warning]]s.\n */\nexport function alert (message: string): void {\n if (_window && typeof _window.alert !== 'undefined') {\n _window.alert(message)\n } else {\n warn(message)\n }\n}\n\n/**\n * Will clear the content of the element with id \"status\".\n */\nexport function clear (): void {\n const logArea = _dom?.getElementById('status')\n if (!logArea) return\n logArea.innerHTML = ''\n}\n\n/**\n * Lets you configure which types of messages will be shown. The module uses\n * [bitmask](https://en.wikipedia.org/wiki/Mask_(computing)) to filter which\n * types of messages should be shown. E.g. if you only want warning messages\n * to be shown, pass 2 to the function, if you want warning and success to be\n * shown, pass 10 (2+8). By passing the sum of all, 63, you'll show all\n * types of messages.\n *\n * - Error: 1\n * - Warning: 2\n * - Message: 4\n * - Success: 8\n * - Info: 16\n * - Debug: 32\n */\nexport function setLevel (level: number): void {\n _level = TALL\n debug('Log level is now ' + level)\n _level = level\n}\n\n/**\n * Will dump the current HTML using the [[debug]] method.\n */\nexport function dumpHTML (): void {\n if (!_dom) return\n const level = _level\n _level = TALL\n debug(_dom?.body?.innerHTML || '')\n _level = level\n}\n\n/**\n * Will start prepending messages the list of log messages.\n */\nexport function logAscending () {\n _ascending = true\n}\n\n/**\n * Will start appending messages the list of log messages. (This is default\n * behavior.)\n */\nexport function logDescending () {\n _ascending = false\n}\n\n/** @internal */\nexport function escapeForXML (str: string): string {\n // can be replaced with function utils module when migrating\n return str\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n}\n\n/** @internal */\nexport function setInternals (window, document) {\n _window = window\n _dom = document\n}\n"],"mappings":"6RAKM,EAAS,EAET,EAAQ,EAER,EAAQ,EAER,EAAW,EAEX,EAAQ,GAER,EAAS,GAET,EAAO,GAGD,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,MAAQ,GAAA,QACR,EAAA,EAAA,QAAU,GAAA,UACV,EAAA,EAAA,QAAU,GAAA,UACV,EAAA,EAAA,QAAU,GAAA,UACV,EAAA,EAAA,KAAO,GAAA,OACP,EAAA,EAAA,MAAQ,GAAA,QACR,EAAA,EAAA,IAAM,GAAA,OACR,EAAA,CAAA,CAAA,EAGI,EAAiB,EAEjB,EAAsB,GAEtB,EAAqB,SAErB,EAAkB,OAGtB,SAAS,EAAK,EAAa,EAAe,EAAO,EAAkB,OAAQ,CACnE,KAAS,EAEf,IAAW,IAAS,OAAa,CAC/B,IAAM,EAAU,EAAK,eAAe,QAAQ,EAC5C,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,EAAK,cAAc,MAAM,EAC1C,EAAS,aAAa,QAAS,CAAO,EACtC,IAAM,EAAM,IAAI,KAChB,EAAS,UAAY,GAAG,EAAI,SAAS,EAAE,GAAG,EAAI,WAAW,EAAE,GAAG,EAAI,WAAW,EAAE,IAAI,EAAQ,IAAI,EAAa,CAAG,EAAE,OAC7G,EACF,EAAQ,aAAa,EAAU,EAAQ,UAAU,EAEjD,EAAQ,YAAY,CAAQ,CAEhC,MAAW,OAAO,QAAY,KAC5B,QAAQ,IAAI,CAAG,CAAA,CAEnB,CAMA,SAAgB,EAAK,EAAiB,CACpC,EAAI,CAAO,CACb,CAMA,SAAgB,EAAM,EAAuB,CAC3C,EAAI,EAAS,EAAO,MAAM,CAC5B,CAMA,SAAgB,EAAO,EAAuB,CAC5C,EAAI,EAAS,EAAQ,MAAM,CAC7B,CAMA,SAAgB,EAAM,EAAuB,CAC3C,EAAI,EAAS,EAAO,MAAM,CAC5B,CAMA,SAAgB,EAAO,EAAuB,CAC5C,EAAI,EAAS,EAAQ,MAAM,CAC7B,CAMA,SAAgB,EAAS,EAAuB,CAC9C,EAAI,EAAS,EAAU,MAAM,CAC/B,CAMA,SAAgB,EAAO,EAAuB,CACxC,GAAkB,EAAQ,QAAU,OACtC,EAAQ,MAAM,CAAO,EAErB,EAAK,CAAO,CAEhB,CAKA,SAAgB,GAAe,CAC7B,IAAM,EAAU,GAAM,eAAe,QAAQ,EACxC,IACL,EAAQ,UAAY,GACtB,CAiBA,SAAgB,EAAU,EAAqB,CAC7C,EAAS,EACT,EAAM,oBAAsB,CAAK,EACjC,EAAS,CACX,CAKA,SAAgB,GAAkB,CAChC,GAAI,CAAC,EAAM,OACX,IAAM,EAAQ,EACd,EAAS,EACT,EAAM,GAAM,MAAM,WAAa,EAAE,EACjC,EAAS,CACX,CAKA,SAAgB,GAAgB,CAC9B,EAAa,EACf,CAMA,SAAgB,GAAiB,CAC/B,EAAa,EACf,CAGA,SAAgB,EAAc,EAAqB,CAEjD,OAAO,EACJ,QAAQ,KAAM,OAAO,CAAC,CACtB,QAAQ,KAAM,MAAM,CAAC,CACrB,QAAQ,KAAM,MAAM,CACzB,CAGA,SAAgB,EAAc,EAAQ,EAAU,CAC9C,EAAU,EACV,EAAO,CACT"}
@@ -20,14 +20,16 @@ var t = /* @__PURE__ */ e({
20
20
  return e[e.Error = n] = "Error", e[e.Warning = r] = "Warning", e[e.Message = i] = "Message", e[e.Success = a] = "Success", e[e.Info = o] = "Info", e[e.Debug = s] = "Debug", e[e.All = c] = "All", e;
21
21
  }({}), u = 7, d = !1, f = document, p = window;
22
22
  function m(e, t = i, n = "mesg") {
23
- if (u & t) if (f !== void 0) {
24
- let t = f.getElementById("status");
25
- if (!t) return;
26
- let r = f.createElement("span");
27
- r.setAttribute("class", n);
28
- let i = /* @__PURE__ */ new Date();
29
- r.innerHTML = `${i.getHours()}:${i.getMinutes()}:${i.getSeconds()} [${n}] ${D(e)}<br/>`, d ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
30
- } else typeof console < "u" && console.log(e);
23
+ if (u & t) {
24
+ if (f !== void 0) {
25
+ let t = f.getElementById("status");
26
+ if (!t) return;
27
+ let r = f.createElement("span");
28
+ r.setAttribute("class", n);
29
+ let i = /* @__PURE__ */ new Date();
30
+ r.innerHTML = `${i.getHours()}:${i.getMinutes()}:${i.getSeconds()} [${n}] ${D(e)}<br/>`, d ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
31
+ } else typeof console < "u" && console.log(e);
32
+ }
31
33
  }
32
34
  function h(e) {
33
35
  m(e);
@@ -1 +1 @@
1
- {"version":3,"file":"log.esm.js","names":[],"sources":["../../src/lib/log.ts"],"sourcesContent":["// /////////////////////// Logging\n//\n// bitmask levels\n// const TNONE = 0\n/** @internal */\nconst TERROR = 1\n/** @internal */\nconst TWARN = 2\n/** @internal */\nconst TMESG = 4\n/** @internal */\nconst TSUCCESS = 8\n/** @internal */\nconst TINFO = 16\n/** @internal */\nconst TDEBUG = 32\n/** @internal */\nconst TALL = 63\n\n/** @internal */\nexport enum LogLevel {\n Error = TERROR,\n Warning = TWARN,\n Message = TMESG,\n Success = TSUCCESS,\n Info = TINFO,\n Debug = TDEBUG,\n All = TALL\n}\n\n/** @internal */\nlet _level: number = TERROR + TWARN + TMESG\n/** @internal */\nlet _ascending: boolean = false\n/** @internal */\nlet _dom: HTMLDocument = document // must be able to override for tests\n/** @internal */\nlet _window: Window = window // must be able to override for tests\n\n/** @internal */\nfunction log (str: string, type: number = TMESG, typestr: string = 'mesg') {\n if (!(_level & type)) return // bitmask\n\n if (typeof _dom !== 'undefined') {\n const logArea = _dom.getElementById('status')\n if (!logArea) return\n\n const addendum = _dom.createElement('span')\n addendum.setAttribute('class', typestr)\n const now = new Date()\n addendum.innerHTML = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} [${typestr}] ${escapeForXML(str)}<br/>`\n if (_ascending) {\n logArea.insertBefore(addendum, logArea.firstChild)\n } else {\n logArea.appendChild(addendum)\n }\n } else if (typeof console !== 'undefined') {\n console.log(str)\n }\n}\n\n/**\n * Adds a message to the element with id \"status\". The messages are prepended with\n * time and type of message, in this case [mesg].\n */\nexport function msg (message: string) {\n log(message)\n}\n\n/**\n * Adds a warning message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [warn].\n */\nexport function warn (message: string): void {\n log(message, TWARN, 'warn')\n}\n\n/**\n * Adds a debugging message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [dbug].\n */\nexport function debug (message: string): void {\n log(message, TDEBUG, 'dbug')\n}\n\n/**\n * Adds a info message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [info].\n */\nexport function info (message: string): void {\n log(message, TINFO, 'info')\n}\n\n/**\n * Adds a error to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [eror].\n */\nexport function error (message: string): void {\n log(message, TERROR, 'eror')\n}\n\n/**\n * Adds a success message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [good].\n */\nexport function success (message: string): void {\n log(message, TSUCCESS, 'good')\n}\n\n/**\n * Uses the global alert to send an alert. If global alert is not available, it\n * will output the message using the method [[warning]]s.\n */\nexport function alert (message: string): void {\n if (_window && typeof _window.alert !== 'undefined') {\n _window.alert(message)\n } else {\n warn(message)\n }\n}\n\n/**\n * Will clear the content of the element with id \"status\".\n */\nexport function clear (): void {\n const logArea = _dom?.getElementById('status')\n if (!logArea) return\n logArea.innerHTML = ''\n}\n\n/**\n * Lets you configure which types of messages will be shown. The module uses\n * [bitmask](https://en.wikipedia.org/wiki/Mask_(computing)) to filter which\n * types of messages should be shown. E.g. if you only want warning messages\n * to be shown, pass 2 to the function, if you want warning and success to be\n * shown, pass 10 (2+8). By passing the sum of all, 63, you'll show all\n * types of messages.\n *\n * - Error: 1\n * - Warning: 2\n * - Message: 4\n * - Success: 8\n * - Info: 16\n * - Debug: 32\n */\nexport function setLevel (level: number): void {\n _level = TALL\n debug('Log level is now ' + level)\n _level = level\n}\n\n/**\n * Will dump the current HTML using the [[debug]] method.\n */\nexport function dumpHTML (): void {\n if (!_dom) return\n const level = _level\n _level = TALL\n debug(_dom?.body?.innerHTML || '')\n _level = level\n}\n\n/**\n * Will start prepending messages the list of log messages.\n */\nexport function logAscending () {\n _ascending = true\n}\n\n/**\n * Will start appending messages the list of log messages. (This is default\n * behavior.)\n */\nexport function logDescending () {\n _ascending = false\n}\n\n/** @internal */\nexport function escapeForXML (str: string): string {\n // can be replaced with function utils module when migrating\n return str\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n}\n\n/** @internal */\nexport function setInternals (window, document) {\n _window = window\n _dom = document\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;IAKM,IAAS,GAET,IAAQ,GAER,IAAQ,GAER,IAAW,GAEX,IAAQ,IAER,IAAS,IAET,IAAO,IAGD,IAAL,yBAAA,GAAA;QACL,EAAA,EAAA,QAAQ,KAAA,SACR,EAAA,EAAA,UAAU,KAAA,WACV,EAAA,EAAA,UAAU,KAAA,WACV,EAAA,EAAA,UAAU,KAAA,WACV,EAAA,EAAA,OAAO,KAAA,QACP,EAAA,EAAA,QAAQ,KAAA,SACR,EAAA,EAAA,MAAM,KAAA;AACR,EAAA,CAAA,CAAA,GAGI,IAAiB,GAEjB,IAAsB,IAEtB,IAAqB,UAErB,IAAkB;AAGtB,SAAS,EAAK,GAAa,IAAe,GAAO,IAAkB,QAAQ;CACnE,QAAS,GAEf,IAAW,MAAS,QAAa;EAC/B,IAAM,IAAU,EAAK,eAAe,QAAQ;EAC5C,IAAI,CAAC,GAAS;EAEd,IAAM,IAAW,EAAK,cAAc,MAAM;EAC1C,EAAS,aAAa,SAAS,CAAO;EACtC,IAAM,oBAAM,IAAI,KAAK;EAErB,AADA,EAAS,YAAY,GAAG,EAAI,SAAS,EAAE,GAAG,EAAI,WAAW,EAAE,GAAG,EAAI,WAA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A,IAAU,GACV,IAAO;AACT"}
1
+ {"version":3,"file":"log.esm.js","names":[],"sources":["../../src/lib/log.ts"],"sourcesContent":["// /////////////////////// Logging\n//\n// bitmask levels\n// const TNONE = 0\n/** @internal */\nconst TERROR = 1\n/** @internal */\nconst TWARN = 2\n/** @internal */\nconst TMESG = 4\n/** @internal */\nconst TSUCCESS = 8\n/** @internal */\nconst TINFO = 16\n/** @internal */\nconst TDEBUG = 32\n/** @internal */\nconst TALL = 63\n\n/** @internal */\nexport enum LogLevel {\n Error = TERROR,\n Warning = TWARN,\n Message = TMESG,\n Success = TSUCCESS,\n Info = TINFO,\n Debug = TDEBUG,\n All = TALL\n}\n\n/** @internal */\nlet _level: number = TERROR + TWARN + TMESG\n/** @internal */\nlet _ascending: boolean = false\n/** @internal */\nlet _dom: HTMLDocument = document // must be able to override for tests\n/** @internal */\nlet _window: Window = window // must be able to override for tests\n\n/** @internal */\nfunction log (str: string, type: number = TMESG, typestr: string = 'mesg') {\n if (!(_level & type)) return // bitmask\n\n if (typeof _dom !== 'undefined') {\n const logArea = _dom.getElementById('status')\n if (!logArea) return\n\n const addendum = _dom.createElement('span')\n addendum.setAttribute('class', typestr)\n const now = new Date()\n addendum.innerHTML = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} [${typestr}] ${escapeForXML(str)}<br/>`\n if (_ascending) {\n logArea.insertBefore(addendum, logArea.firstChild)\n } else {\n logArea.appendChild(addendum)\n }\n } else if (typeof console !== 'undefined') {\n console.log(str)\n }\n}\n\n/**\n * Adds a message to the element with id \"status\". The messages are prepended with\n * time and type of message, in this case [mesg].\n */\nexport function msg (message: string) {\n log(message)\n}\n\n/**\n * Adds a warning message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [warn].\n */\nexport function warn (message: string): void {\n log(message, TWARN, 'warn')\n}\n\n/**\n * Adds a debugging message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [dbug].\n */\nexport function debug (message: string): void {\n log(message, TDEBUG, 'dbug')\n}\n\n/**\n * Adds a info message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [info].\n */\nexport function info (message: string): void {\n log(message, TINFO, 'info')\n}\n\n/**\n * Adds a error to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [eror].\n */\nexport function error (message: string): void {\n log(message, TERROR, 'eror')\n}\n\n/**\n * Adds a success message to the element with id \"status\". The messages are\n * prepended with time and type of message, in this case [good].\n */\nexport function success (message: string): void {\n log(message, TSUCCESS, 'good')\n}\n\n/**\n * Uses the global alert to send an alert. If global alert is not available, it\n * will output the message using the method [[warning]]s.\n */\nexport function alert (message: string): void {\n if (_window && typeof _window.alert !== 'undefined') {\n _window.alert(message)\n } else {\n warn(message)\n }\n}\n\n/**\n * Will clear the content of the element with id \"status\".\n */\nexport function clear (): void {\n const logArea = _dom?.getElementById('status')\n if (!logArea) return\n logArea.innerHTML = ''\n}\n\n/**\n * Lets you configure which types of messages will be shown. The module uses\n * [bitmask](https://en.wikipedia.org/wiki/Mask_(computing)) to filter which\n * types of messages should be shown. E.g. if you only want warning messages\n * to be shown, pass 2 to the function, if you want warning and success to be\n * shown, pass 10 (2+8). By passing the sum of all, 63, you'll show all\n * types of messages.\n *\n * - Error: 1\n * - Warning: 2\n * - Message: 4\n * - Success: 8\n * - Info: 16\n * - Debug: 32\n */\nexport function setLevel (level: number): void {\n _level = TALL\n debug('Log level is now ' + level)\n _level = level\n}\n\n/**\n * Will dump the current HTML using the [[debug]] method.\n */\nexport function dumpHTML (): void {\n if (!_dom) return\n const level = _level\n _level = TALL\n debug(_dom?.body?.innerHTML || '')\n _level = level\n}\n\n/**\n * Will start prepending messages the list of log messages.\n */\nexport function logAscending () {\n _ascending = true\n}\n\n/**\n * Will start appending messages the list of log messages. (This is default\n * behavior.)\n */\nexport function logDescending () {\n _ascending = false\n}\n\n/** @internal */\nexport function escapeForXML (str: string): string {\n // can be replaced with function utils module when migrating\n return str\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/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