@startinblox/core 0.17.31 → 0.18.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_snowpack/pkg/autolinker.js +3515 -3367
- package/dist/_snowpack/pkg/autolinker.js.map +1 -1
- package/dist/_snowpack/pkg/common/{_baseUnary-217dffb2.js → _baseUnary-c1edb653.js} +16 -40
- package/dist/_snowpack/pkg/common/{_baseUnary-217dffb2.js.map → _baseUnary-c1edb653.js.map} +1 -1
- package/dist/_snowpack/pkg/common/{_commonjsHelpers-8c19dec8.js → _commonjsHelpers-37fa8da4.js} +6 -2
- package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js.map +1 -0
- package/dist/_snowpack/pkg/common/{decode-a4c334cf.js → decode-26fbf385.js} +38 -69
- package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +1 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js +1104 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +1 -0
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js +4767 -4246
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -1
- package/dist/_snowpack/pkg/dialog-polyfill.js +107 -139
- package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -1
- package/dist/_snowpack/pkg/fusejs.js +411 -601
- package/dist/_snowpack/pkg/fusejs.js.map +1 -1
- package/dist/_snowpack/pkg/jsonld-context-parser.js +718 -686
- package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -1
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +59 -59
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +1 -1
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -14
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +1 -1
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +13 -14
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -1
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +17 -15
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -1
- package/dist/_snowpack/pkg/lit-html/directives/until.js +45 -46
- package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -1
- package/dist/_snowpack/pkg/lit-html.js +37 -35
- package/dist/_snowpack/pkg/lit-html.js.map +1 -1
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js +1 -20
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +1 -1
- package/dist/_snowpack/pkg/markdown-it.js +1731 -2284
- package/dist/_snowpack/pkg/markdown-it.js.map +1 -1
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js +236 -294
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -1
- package/dist/_snowpack/pkg/quill.js +12077 -11017
- package/dist/_snowpack/pkg/quill.js.map +1 -1
- package/dist/_snowpack/pkg/slim-select.js +711 -1
- package/dist/_snowpack/pkg/slim-select.js.map +1 -1
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1 -16
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +1 -1
- package/dist/_snowpack/pkg/tui-calendar.js +44297 -40075
- package/dist/_snowpack/pkg/tui-calendar.js.map +1 -1
- package/dist/components/solid-ac-checker.js +4 -17
- package/dist/components/solid-calendar.js +5 -26
- package/dist/components/solid-delete.js +9 -24
- package/dist/components/solid-display.js +15 -59
- package/dist/components/solid-form-search.js +27 -79
- package/dist/components/solid-form.js +48 -143
- package/dist/components/solid-lang.js +8 -19
- package/dist/components/solid-map.js +26 -64
- package/dist/components/solid-table.js +51 -133
- package/dist/components/solid-widget.js +2 -24
- package/dist/index.js +17 -11
- package/dist/libs/Component.js +4 -10
- package/dist/libs/ComponentFactory.js +6 -34
- package/dist/libs/Compositor.js +8 -15
- package/dist/libs/Sib.js +7 -21
- package/dist/libs/filter.js +184 -0
- package/dist/libs/helpers.js +19 -47
- package/dist/libs/interfaces.js +1 -1
- package/dist/libs/lit-helpers.js +7 -34
- package/dist/libs/polyfills.js +7 -10
- package/dist/libs/store/server-pagination.js +22 -0
- package/dist/libs/store/server-search.js +35 -0
- package/dist/libs/store/store.js +212 -227
- package/dist/mixins/attributeBinderMixin.js +17 -25
- package/dist/mixins/contextMixin.js +5 -7
- package/dist/mixins/counterMixin.js +2 -23
- package/dist/mixins/federationMixin.js +2 -14
- package/dist/mixins/filterMixin.js +60 -100
- package/dist/mixins/grouperMixin.js +11 -18
- package/dist/mixins/highlighterMixin.js +2 -8
- package/dist/mixins/interfaces.js +3 -5
- package/dist/mixins/listMixin.js +12 -43
- package/dist/mixins/nextMixin.js +1 -4
- package/dist/mixins/paginateMixin.js +17 -30
- package/dist/mixins/requiredMixin.js +1 -9
- package/dist/mixins/serverPaginationMixin.js +122 -0
- package/dist/mixins/sorterMixin.js +26 -44
- package/dist/mixins/storeMixin.js +28 -21
- package/dist/mixins/translationMixin.js +2 -12
- package/dist/mixins/validationMixin.js +28 -46
- package/dist/mixins/widgetMixin.js +58 -154
- package/dist/new-widgets/attributeMixins/actionMixin.js +1 -2
- package/dist/new-widgets/attributeMixins/blankMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/booleanMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/index.js +1 -2
- package/dist/new-widgets/attributeMixins/mailtoMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/multipleMixin.js +1 -2
- package/dist/new-widgets/attributeMixins/numberMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/placeholderMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/telMixin.js +1 -4
- package/dist/new-widgets/baseWidgetMixin.js +5 -18
- package/dist/new-widgets/callbackMixins/autocompletionMixin.js +3 -11
- package/dist/new-widgets/callbackMixins/index.js +1 -2
- package/dist/new-widgets/callbackMixins/richtextMixin.js +1 -6
- package/dist/new-widgets/interfaces.js +1 -0
- package/dist/new-widgets/new-widget-factory.js +14 -19
- package/dist/new-widgets/templateAdditionMixins/addableMixin.js +6 -21
- package/dist/new-widgets/templateAdditionMixins/index.js +2 -3
- package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +5 -18
- package/dist/new-widgets/templateAdditionMixins/labelMixin.js +5 -18
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js +21 -27
- package/dist/new-widgets/templates/displayTemplatesDirectory.js +35 -70
- package/dist/new-widgets/templates/formTemplatesDirectory.js +350 -315
- package/dist/new-widgets/templates/groupTemplatesDirectory.js +5 -15
- package/dist/new-widgets/templates/index.js +1 -2
- package/dist/new-widgets/templates/setTemplatesDirectory.js +4 -37
- package/dist/new-widgets/templatesDependencies/altMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/editableMixin.js +9 -26
- package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +3 -7
- package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +1 -5
- package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +1 -11
- package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +3 -13
- package/dist/new-widgets/templatesDependencies/formFileMixin.js +1 -13
- package/dist/new-widgets/templatesDependencies/formLengthMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/formMixin.js +4 -14
- package/dist/new-widgets/templatesDependencies/formNumberMixin.js +1 -5
- package/dist/new-widgets/templatesDependencies/formRadioMixin.js +1 -5
- package/dist/new-widgets/templatesDependencies/formStepMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js +13 -0
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +23 -18
- package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +1 -10
- package/dist/new-widgets/templatesDependencies/patternMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/rangeMixin.js +5 -15
- package/dist/new-widgets/templatesDependencies/setMixin.js +1 -4
- package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +1 -4
- package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +1 -5
- package/dist/new-widgets/valueTransformationMixins/dateMixin.js +5 -11
- package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +1 -5
- package/dist/new-widgets/valueTransformationMixins/index.js +1 -2
- package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +1 -7
- package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +1 -5
- package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +1 -7
- package/dist/solid-template-element.js +24 -44
- package/dist/widgets/baseWidget.js +21 -85
- package/dist/widgets/widget-factory.js +4 -6
- package/package.json +8 -6
- package/dist/_snowpack/env.js +0 -3
- package/dist/_snowpack/pkg/autolinker.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map +0 -1
- package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map +0 -1
- package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/lit-html-babd44cd.js +0 -1119
- package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map +0 -1
- package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/dialog-polyfill.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/fusejs.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/jsonld-context-parser.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/until.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/markdown-it.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/quill.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/slim-select.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/tui-calendar.js.map.proxy.js +0 -1
- package/dist/components/solid-ac-checker.js.map +0 -1
- package/dist/components/solid-calendar.js.map +0 -1
- package/dist/components/solid-delete.js.map +0 -1
- package/dist/components/solid-display.js.map +0 -1
- package/dist/components/solid-form-search.js.map +0 -1
- package/dist/components/solid-form.js.map +0 -1
- package/dist/components/solid-lang.js.map +0 -1
- package/dist/components/solid-map.js.map +0 -1
- package/dist/components/solid-table.js.map +0 -1
- package/dist/components/solid-widget.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/libs/Component.js.map +0 -1
- package/dist/libs/ComponentFactory.js.map +0 -1
- package/dist/libs/Compositor.js.map +0 -1
- package/dist/libs/Sib.js.map +0 -1
- package/dist/libs/helpers.js.map +0 -1
- package/dist/libs/interfaces.js.map +0 -1
- package/dist/libs/lit-helpers.js.map +0 -1
- package/dist/libs/polyfills.js.map +0 -1
- package/dist/libs/store/store.js.map +0 -1
- package/dist/mixins/attributeBinderMixin.js.map +0 -1
- package/dist/mixins/contextMixin.js.map +0 -1
- package/dist/mixins/counterMixin.js.map +0 -1
- package/dist/mixins/federationMixin.js.map +0 -1
- package/dist/mixins/filterMixin.js.map +0 -1
- package/dist/mixins/grouperMixin.js.map +0 -1
- package/dist/mixins/highlighterMixin.js.map +0 -1
- package/dist/mixins/interfaces.js.map +0 -1
- package/dist/mixins/listMixin.js.map +0 -1
- package/dist/mixins/nextMixin.js.map +0 -1
- package/dist/mixins/paginateMixin.js.map +0 -1
- package/dist/mixins/requiredMixin.js.map +0 -1
- package/dist/mixins/sorterMixin.js.map +0 -1
- package/dist/mixins/storeMixin.js.map +0 -1
- package/dist/mixins/translationMixin.js.map +0 -1
- package/dist/mixins/validationMixin.js.map +0 -1
- package/dist/mixins/widgetMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/actionMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/blankMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/booleanMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/index.js.map +0 -1
- package/dist/new-widgets/attributeMixins/mailtoMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/multipleMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/numberMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/placeholderMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/telMixin.js.map +0 -1
- package/dist/new-widgets/baseWidgetMixin.js.map +0 -1
- package/dist/new-widgets/callbackMixins/autocompletionMixin.js.map +0 -1
- package/dist/new-widgets/callbackMixins/index.js.map +0 -1
- package/dist/new-widgets/callbackMixins/richtextMixin.js.map +0 -1
- package/dist/new-widgets/new-widget-factory.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/addableMixin.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/index.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/labelMixin.js.map +0 -1
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/formTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/groupTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/index.js.map +0 -1
- package/dist/new-widgets/templates/setTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/altMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/editableMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formDropdownMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formFileMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formLengthMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formNumberMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formRadioMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formStepMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/patternMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/rangeMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/setMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/dateMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/index.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/markdownMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/multilineMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/oembedMixin.js.map +0 -1
- package/dist/solid-template-element.js.map +0 -1
- package/dist/widgets/baseWidget.js.map +0 -1
- package/dist/widgets/widget-factory.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["Compositor.ts"],"names":["HOOKS","API","Compositor","merge","component","mixins","name","attributes","mergeAttributes","initialState","mergeInitialState","methods","mergeMethods","accessors","mergeAccessors","hooks","mergeHooks","mergeMixin","deepMergeMixin","mixinAccumulator","currentMixin","use","currentMixins","forEach","mix","has","set","console","warn","Map","Array","from","values","mixin","created","attached","detached","reverse","hookName","push","keys","Reflect","ownKeys","filter","key","indexOf","Object","getOwnPropertyDescriptor","get","prop"],"mappings":"AAQA,MAAMA,KAAK,GAAG,CAAC,SAAD,EAAY,UAAZ,EAAwB,UAAxB,CAAd;AACA,MAAMC,GAAG,GAAG,CACV,MADU,EAEV,KAFU,EAGV,YAHU,EAIV,cAJU,EAKV,GAAGD,KALO,CAAZ;AAQA,OAAO,MAAME,UAAN,CAAiB;AACtB,SAAcC,KAAd,CAAoBC,SAApB,EAAqDC,MAArD,EAA+G;AAC7G,WAAO;AACLC,MAAAA,IAAI,EAAEF,SAAS,CAACE,IADX;AAELC,MAAAA,UAAU,EAAEL,UAAU,CAACM,eAAX,CAA2B,CAAEJ,SAAF,EAAa,GAAGC,MAAhB,CAA3B,CAFP;AAGLI,MAAAA,YAAY,EAAEP,UAAU,CAACQ,iBAAX,CAA6B,CAAEN,SAAF,EAAa,GAAGC,MAAhB,CAA7B,CAHT;AAILM,MAAAA,OAAO,EAAET,UAAU,CAACU,YAAX,CAAwB,CAAER,SAAF,EAAa,GAAGC,MAAhB,CAAxB,CAJJ;AAKLQ,MAAAA,SAAS,EAAEX,UAAU,CAACY,cAAX,CAA0B,CAAEV,SAAF,EAAa,GAAGC,MAAhB,CAA1B,CALN;AAMLU,MAAAA,KAAK,EAAEb,UAAU,CAACc,UAAX,CAAsB,CAAEZ,SAAF,EAAa,GAAGC,MAAhB,CAAtB;AANF,KAAP;AAQD;;AAED,SAAcY,UAAd,CAAyBb,SAAzB,EAAkF;AAChF,aAASc,cAAT,CAAwBC,gBAAxB,EAA2FC,YAA3F,EAA+H;AAC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AFD;AAGD,KAbD;AAcA,WAAOjC,OAAP;AACD;;AAED,SAAcG,cAAd,CAA6BT,MAA7B,EAAsF;AACpF,UAAMQ,SAAS,GAAG,EAAlB;AACAR,IAAAA,MAAM,CAACgC,OAAP,GAAiBd,OAAjB,CAAyBU,KAAK,IAAI;AAChCQ,MAAAA,OAAO,CACNC,OADD,CACST,KADT,EAECU,MAFD,CAEQC,GAAG,IACT,OAAOA,GAAP,KAAe,QAAf,IACA3C,GAAG,CAAC4C,OAAJ,CAAYD,GAAZ,IAAmB,CADnB,KAECE,MAAM,CAACC,wBAAP,CAAgCd,KAAhC,EAAuCW,GAAvC,EAA6CI,GAA7C,IAAoDF,MAAM,CAACC,wBAAP,CAAgCd,KAAhC,EAAuCW,GAAvC,EAA6ClB,GAFlG,CAHF,EAOCH,OAPD,CAOS0B,IAAI,IAAI;AACfpC,QAAAA,SAAS,CAACoC,IAAD,CAAT,GAAkB,EAAE,GAAGpC,SAAS,CAACoC,IAAD;AAAd,SAAlB;AACA,YAAIR,OAAO,CAACM,wBAAR,CAAiCd,KAAjC,EAAwCgB,IAAxC,EAA+CD,GAAnD,EAAwDnC,SAAS,CAACoC,IAAD,CAAT,CAAgBD,GAAhB,GAAsBP,OAAO,CAACM,wBAAR,CAAiCd,KAAjC,EAAwCgB,IAAxC,EAA+CD,GAArE;AACxD,YAAIP,OAAO,CAACM,wBAAR,CAAiCd,KAAjC,EAAwCgB,IAAxC,EAA+CvB,GAAnD,EAAwDb,SAAS,CAACoC,IAAD,CAAT,CAAgBvB,GAAhB,GAAsBe,OAAO,CAACM,wBAAR,CAAiCd,KAAjC,EAAwCgB,IAAxC,EAA+CvB,GAArE;AACzD,OAXD;AAYD,KAbD;AAcA,WAAOb,SAAP;AACD;;AAlHqB","sourcesContent":["import type {\n MixinStaticInterface,\n ComponentStaticInterface,\n AttributesDefinitionInterface,\n ArrayOfHooksInterface,\n AccessorStaticInterface\n} from './interfaces';\n\nconst HOOKS = ['created', 'attached', 'detached'];\nconst API = [\n 'name',\n 'use',\n 'attributes',\n 'initialState',\n ...HOOKS,\n];\n\nexport class Compositor {\n public static merge(component: MixinStaticInterface, mixins: MixinStaticInterface[]): ComponentStaticInterface {\n return {\n name: component.name,\n attributes: Compositor.mergeAttributes([ component, ...mixins ]),\n initialState: Compositor.mergeInitialState([ component, ...mixins ]),\n methods: Compositor.mergeMethods([ component, ...mixins]),\n accessors: Compositor.mergeAccessors([ component, ...mixins]),\n hooks: Compositor.mergeHooks([ component, ...mixins ]),\n };\n }\n\n public static mergeMixin(component: MixinStaticInterface): MixinStaticInterface[] {\n function deepMergeMixin(mixinAccumulator: Map<MixinStaticInterface, MixinStaticInterface>, currentMixin: MixinStaticInterface) {\n const { use: currentMixins } = currentMixin;\n if (currentMixins) {\n currentMixins.forEach(mix => {\n if (!mixinAccumulator.has(mix)) {\n mixinAccumulator.set(mix, mix);\n deepMergeMixin(mixinAccumulator, mix);\n } else {\n console.warn(`Duplicate mixin import (${mix.name})`);\n }\n });\n }\n }\n\n const mixins = new Map();\n deepMergeMixin(mixins, component);\n\n return Array.from(mixins.values());\n }\n\n public static mergeAttributes(mixins: MixinStaticInterface[]): AttributesDefinitionInterface {\n let attributes = {};\n\n mixins.forEach(mixin => {\n if (!!mixin.attributes) {\n attributes = {...mixin.attributes, ...attributes };\n }\n });\n\n return attributes;\n }\n\n public static mergeInitialState(mixins: MixinStaticInterface[]): any {\n let initialState = {};\n\n mixins.forEach(mixin => {\n if (!!mixin.initialState) {\n initialState = {...mixin.initialState, ...initialState };\n }\n });\n\n return initialState;\n }\n\n public static mergeHooks(mixins: MixinStaticInterface[]): ArrayOfHooksInterface {\n const hooks = {\n created: [],\n attached: [],\n detached: [],\n };\n mixins\n .reverse()\n .forEach(mixin => {\n HOOKS.forEach(hookName => {\n if(!!mixin[hookName] && typeof mixin[hookName] === 'function') {\n hooks[hookName].push(mixin[hookName]);\n }\n });\n });\n \n\n return hooks;\n }\n\n public static mergeMethods(mixins: MixinStaticInterface[]): Map<any, any> {\n const methods = new Map();\n\n mixins.reverse().forEach(mixin => {\n const keys = Reflect\n .ownKeys(mixin)\n .filter(key => (\n typeof key === 'string' &&\n API.indexOf(key) < 0 &&\n !Object.getOwnPropertyDescriptor(mixin, key)!.get &&\n !Object.getOwnPropertyDescriptor(mixin, key)!.set &&\n typeof mixin[key] === 'function'));\n\n keys.forEach(key => {\n methods.set(key, mixin[key]);\n });\n });\n return methods;\n }\n\n public static mergeAccessors(mixins: MixinStaticInterface[]): AccessorStaticInterface {\n const accessors = {};\n mixins.reverse().forEach(mixin => {\n Reflect\n .ownKeys(mixin)\n .filter(key => (\n typeof key === 'string' &&\n API.indexOf(key) < 0 &&\n (Object.getOwnPropertyDescriptor(mixin, key)!.get || Object.getOwnPropertyDescriptor(mixin, key)!.set)\n ))\n .forEach(prop => {\n accessors[prop] = { ...accessors[prop] };\n if (Reflect.getOwnPropertyDescriptor(mixin, prop)!.get) accessors[prop].get = Reflect.getOwnPropertyDescriptor(mixin, prop)!.get;\n if (Reflect.getOwnPropertyDescriptor(mixin, prop)!.set) accessors[prop].set = Reflect.getOwnPropertyDescriptor(mixin, prop)!.set;\n });\n });\n return accessors;\n }\n}\n"]}
|
package/dist/libs/Sib.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["Sib.ts"],"names":["ComponentFactory","defineComponent","Sib","register","componentDefinition","component","build","cls","toElement","name","HTMLElement","constructor","created","_component","Error","observedAttributes","attributeChangedCallback","oldValue","newValue","attr","replace","_c","p1","p2","toUpperCase","attributesCallback","connectedCallback","attached","disconnectedCallback","detached"],"mappings":";;AAAA,SAASA,gBAAT,QAAiC,uBAAjC;AACA,SAASC,eAAT,QAAgC,cAAhC;AAOA,OAAO,MAAMC,GAAN,CAAU;AACb,SAAcC,QAAd,CAAuBC,mBAAvB,EAAuE;AACnE,UAAMC,SAAS,GAAGL,gBAAgB,CAACM,KAAjB,CAAuBF,mBAAvB,CAAlB;AACA,UAAMG,GAAG,GAAG,KAAKC,SAAL,CAAeH,SAAf,CAAZ;AACAJ,IAAAA,eAAe,CAACI,SAAS,CAACI,IAAX,EAAiBF,GAAjB,CAAf;AACH;;AAED,SAAiBC,SAAjB,CAA2BH,SAA3B,EAAyF;AAAA;;AACrF,mBAAO,cAAcK,WAAd,CAA0B;AAG7BC,MAAAA,WAAW,GAAG;AACV;;AADU,4CAFkC,IAElC;;AAEV,aAAKN,SAAL,GAAiB,IAAIA,SAAJ,CAAc,IAAd,CAAjB;AACA,aAAKA,SAAL,CAAeO,OAAf;AACH;;AAED,UAAIP,SAAJ,GAAoC;AAChC,YAAI,KAAKQ,UAAL,KAAoB,IAAxB,EAA8B;AAC1B,gBAAM,IAAIC,KAAJ,CAAU,oBAAV,CAAN;AACH;;AACD,eAAO,KAAKD,UAAZ;AACH;;AACD,UAAIR,SAAJ,CAAcA,SAAd,EAA6C;AACzC,aAAKQ,UAAL,GAAkBR,SAAlB;AACH;;AAED,iBAAWU,kBAAX,GAAgC;AAC5B,eAAaV,SAAN,CAAiBU,kBAAxB;AACH;;AAEDC,MAAAA,wBAAwB,CAACP,IAAD,EAAOQ,QAAP,EAAiBC,QAAjB,EAA2B;AAC/C,cAAMC,IAAI,GAAGV,IAAI,CAACW,OAAL,CAAa,wBAAb,EAAuC,CAACC,EAAD,EAAKC,EAAL,EAASC,EAAT,eAAmBD,EAAnB,SAAwBC,EAAE,CAACC,WAAH,EAAxB,CAAvC,CAAb;AACA,aAAKnB,SAAL,CAAeoB,kBAAf,CAAkCN,IAAlC,EAAwCD,QAAxC,EAAkDD,QAAlD;AACH;;AAEDS,MAAAA,iBAAiB,GAAG;AAChB,aAAKrB,SAAL,CAAesB,QAAf;AACH;;AAEDC,MAAAA,oBAAoB,GAAG;AACnB,aAAKvB,SAAL,CAAewB,QAAf;AACH;;AAlC4B,KAAjC;AAoCH;;AA5CY","sourcesContent":["import { ComponentFactory } from \"./ComponentFactory.js\";\nimport { defineComponent } from \"./helpers.js\";\nimport type {\n ComponentConstructorInterface,\n ComponentInterface,\n MixinStaticInterface\n} from \"./interfaces.js\";\n\nexport class Sib {\n public static register(componentDefinition: MixinStaticInterface):void {\n const component = ComponentFactory.build(componentDefinition);\n const cls = this.toElement(component);\n defineComponent(component.name, cls);\n }\n\n protected static toElement(component: ComponentConstructorInterface): typeof HTMLElement {\n return class extends HTMLElement {\n private _component: ComponentInterface | null = null;\n\n constructor() {\n super();\n this.component = new component(this);\n this.component.created();\n }\n\n get component(): ComponentInterface {\n if (this._component === null) {\n throw new Error('No component found');\n }\n return this._component;\n }\n set component(component: ComponentInterface) {\n this._component = component;\n }\n\n static get observedAttributes() {\n return (<any>component).observedAttributes;\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n const attr = name.replace(/([a-z0-9])-([a-z0-9])/g, (_c, p1, p2) => `${p1}${p2.toUpperCase()}`);\n this.component.attributesCallback(attr, newValue, oldValue);\n }\n\n connectedCallback() {\n this.component.attached();\n }\n\n disconnectedCallback() {\n this.component.detached();\n }\n }\n }\n}\n"]}
|
package/dist/libs/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["helpers.ts"],"names":["Fuse","uniqID","Math","random","pow","toString","slice","stringToDom","html","template","document","createElement","innerHTML","content","evalTemplateString","str","variables","keys","Object","values","map","key","AsyncFunction","getPrototypeOf","constructor","func","call","e","console","log","SyntaxError","importCSS","stylesheets","linksElements","url","relativeSource","link","Array","from","head","querySelectorAll","find","href","rel","appendChild","push","importJS","plugins","URL","baseURI","script","src","source","match","Error","stack","f2","split","filter","l","includes","line","calledFile","replace","loadScript","Promise","resolve","querySelector","async","onload","setTimeout","domIsReady","readyState","addEventListener","setDeepProperty","obj","path","value","name","shift","length","parseFieldsString","fields","fieldsArray","indexOf","firstBracket","noset","substring","findClosingBracketMatchIndex","re","a","pos","depth","i","defineComponent","tagName","componentClass","customElements","get","define","warn","fuzzyCompare","subject","search","fuse","shouldSort","threshold","compare","string","query","toLowerCase","String","boolean","number","list","range","resource","ret","transformArrayToContainer","newValue","predicate","predicateValue","isArray","forEach","childPredicate","index"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,SAAjB;;AAEA,SAASC,MAAT,GAA0B;AACxB,SAAO,MAAM,CAACC,IAAI,CAACC,MAAL,KAAgBD,IAAI,CAACE,GAAL,CAAS,EAAT,EAAa,EAAb,CAAjB,EAAmCC,QAAnC,CAA4C,EAA5C,EAAgDC,KAAhD,CAAsD,CAAtD,EAAyD,EAAzD,CAAb;AACD;;AAED,SAASC,WAAT,CAAqBC,IAArB,EAAqD;AACnD,QAAMC,QAAQ,GAAGC,QAAQ,CAACC,aAAT,CAAuB,UAAvB,CAAjB;AACAF,EAAAA,QAAQ,CAACG,SAAT,GAAqBJ,IAArB;AACA,SAAOC,QAAQ,CAACI,OAAhB;AACD;;AAED,eAAeC,kBAAf,CAAkCC,GAAlC,EAA+CC,SAA6B,GAAG,EAA/E,EAAmF;AACjF,QAAMC,IAAI,GAAGC,MAAM,CAACD,IAAP,CAAYD,SAAZ,CAAb;AACA,QAAMG,MAAM,GAAGF,IAAI,CAACG,GAAL,CAASC,GAAG,IAAIL,SAAS,CAACK,GAAD,CAAzB,CAAf;;AACA,MAAI;AACF,UAAMC,aAAa,GAAGJ,MAAM,CAACK,cAAP,CAAsB,kBAAgB,CAAE,CAAxC,EAA0CC,WAAhE;AACA,UAAMC,IAAI,GAAGH,aAAa,CAACI,IAAd,CAAmB,IAAnB,EAAyB,GAAGT,IAA5B,EAAkC,aAAaF,GAAb,GAAmB,GAArD,CAAb;AACA,WAAO,MAAMU,IAAI,CAAC,GAAGN,MAAJ,CAAjB;AACD,GAJD,CAIE,OAAOQ,CAAP,EAAU;AACVC,IAAAA,OAAO,CAACC,GAAR,CAAYF,CAAZ;AACA,UAAM,IAAIG,WAAJ,CAAgB,MAAMf,GAAN,GAAY,GAA5B,CAAN;AACD;AACF;;AAED,SAASgB,SAAT,CAAmB,GAAGC,WAAtB,EAA6C;AAC3C,QA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D;AAGD;AACF;;AACD,SAAOL,QAAP;AACD;;AAED,SACEtH,MADF,EAEEM,WAFF,EAGEO,kBAHF,EAIEiB,SAJF,EAKEe,QALF,EAMEkB,UANF,EAOEO,UAPF,EAQEG,eARF,EASEO,iBATF,EAUEO,4BAVF,EAWEM,eAXF,EAYEO,YAZF,EAaEM,OAbF,EAcEW,yBAdF","sourcesContent":["import Fuse from \"fuse.js\";\n\nfunction uniqID(): string {\n return '_' + (Math.random() * Math.pow(36, 20)).toString(36).slice(0, 10);\n}\n\nfunction stringToDom(html: string): DocumentFragment {\n const template = document.createElement('template');\n template.innerHTML = html;\n return template.content;\n}\n\nasync function evalTemplateString(str: string, variables: {[key:string]:any} = {}) {\n const keys = Object.keys(variables);\n const values = keys.map(key => variables[key]);\n try {\n const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor\n const func = AsyncFunction.call(null, ...keys, 'return `' + str + '`');\n return await func(...values);\n } catch (e) {\n console.log(e);\n throw new SyntaxError('`' + str + '`');\n }\n}\n\nfunction importCSS(...stylesheets: string[]) {\n const linksElements: HTMLLinkElement[] = []; \n for(let url of stylesheets) {\n url = relativeSource(url);\n let link = Array.from(document.head.querySelectorAll('link')).find(\n link => link.href === url,\n );\n if (link) return link;\n link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = url;\n document.head.appendChild(link);\n linksElements.push(link);\n };\n return linksElements;\n}\n\nfunction importJS(...plugins: string[]): HTMLScriptElement[] {\n return plugins.map(url => {\n url = new URL(url, document.baseURI).href;\n let script = Array.from(document.querySelectorAll('script')).find(\n script => script.src === url,\n );\n if (script) return script;\n script = document.createElement('script');\n script.src = url;\n document.head.appendChild(script);\n return script;\n });\n}\n\nfunction relativeSource(source: string) {\n if (!source.match(/^\\..?\\//)) return new URL(source, document.baseURI).href;\n const e = new Error();\n if(!e.stack) return source;\n const f2 = e.stack.split('\\n').filter(l => l.includes(':'))[2];\n let line = f2.match(/[a-z]+:.*$/);\n if (!line) return source;\n const calledFile = line[0].replace(/(\\:[0-9]+){2}\\)?$/,'');\n source = new URL(source, calledFile).href;\n return source;\n}\n\nfunction loadScript(source: string) {\n source = relativeSource(source);\n return new Promise(resolve => {\n var script = document.createElement('script');\n var head = document.querySelector('head');\n script.async = true;\n script.onload = () => setTimeout(resolve, 0);\n script.src = source;\n if(head) head.appendChild(script);\n });\n}\n\nfunction domIsReady(): Promise<void> {\n return new Promise(function(resolve) {\n if (document.readyState === 'complete') {\n resolve();\n } else {\n document.addEventListener('DOMContentLoaded', () => resolve());\n }\n });\n}\n\nfunction setDeepProperty(obj: {[index:string]:any}, path: string[], value: any) {\n const name = path.shift();\n if (name) {\n if (!(name in obj)) obj[name] = {};\n if (path.length) setDeepProperty(obj[name], path, value);\n else obj[name] = value;\n }\n}\n\nfunction parseFieldsString(fields: string): string[] {\n let fieldsArray: string[];\n\n // remove all sets from fields\n while(fields.indexOf('(') > 0){\n let firstBracket = fields.indexOf('(');\n let noset = fields.substring(firstBracket, findClosingBracketMatchIndex(fields, firstBracket)+1)\n fields = fields.replace(noset, '')\n }\n\n const re = /((^\\s*|,)\\s*)((\"(\\\\\"|[^\"])*\")|('(\\\\'|[^'])*')|[^,]*)/gm; // match , not inside quotes\n fieldsArray = fields.match(re) || []; // separate fields\n if (!fieldsArray) return [];\n return fieldsArray.map(a => a.replace(/^[\\s,]+/, '')) // remove commas and spaces\n}\n\nfunction findClosingBracketMatchIndex(str: string, pos: number) {\n if (str[pos] != '(') throw new Error(\"No '(' at index \" + pos);\n let depth = 1;\n for (let i = pos + 1; i < str.length; i++) {\n switch (str[i]) {\n case '(':\n depth++;\n break;\n case ')':\n if (--depth == 0) return i;\n break;\n }\n }\n return -1;\n}\n\nfunction defineComponent(tagName: string, componentClass: typeof HTMLElement) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, componentClass);\n } else {\n console.warn(`Warning: the component \"${tagName}\" has already been loaded in another version of sib-core.`)\n }\n}\n\nfunction fuzzyCompare(subject: string, search: string) {\n const fuse = new Fuse([subject], {\n shouldSort: false,\n threshold: 0.37,\n }).search(search);\n return fuse.length > 0;\n}\n\nconst compare: { [k: string]: (subject: any, query: any) => boolean } = {\n string(subject: string, query: string) {\n if(query === '') return true;\n if(subject.toString().toLowerCase().includes(String(query).toLowerCase())) return true;\n return fuzzyCompare(subject, query);\n },\n boolean(subject: boolean, query: boolean) {\n if (!query) return true;\n return subject;\n },\n number(subject: number, query: number) {\n return subject === query;\n },\n list(subject: string, list: string[]) {\n return list.includes(subject);\n },\n range(subject: number | Date, range: [any, any]) {\n return (\n (range[0] == null || range[0] === '' || subject >= range[0]) &&\n (range[1] == null || range[1] === '' || subject <= range[1])\n );\n },\n resource(subject, query) {\n // dropdown default ' - ' option return an empty string\n if(query === '') return true;\n if (!query['@id']) return false;\n const ret = subject['@id'] === query['@id'];\n return ret;\n }\n};\n\nfunction transformArrayToContainer(resource: object) {\n const newValue = { ...resource };\n for (let predicate of Object.keys(newValue)) { // iterate over all properties\n const predicateValue = newValue[predicate];\n if (!predicateValue || typeof predicateValue !== 'object') continue; // undefined or literal, do nothing\n\n // check all keys of nested resource\n if (!Array.isArray(predicateValue) && predicateValue['@id']) {\n newValue[predicate] = transformArrayToContainer(resource[predicate]);\n }\n\n // for arrays\n if (Array.isArray(predicateValue)) {\n newValue[predicate] = { 'ldp:contains': [...predicateValue] }; // transform to container\n newValue[predicate]['ldp:contains'].forEach((childPredicate: any, index: number) => { // and check all nested resources\n newValue[predicate]['ldp:contains'][index] = transformArrayToContainer(childPredicate);\n });\n }\n }\n return newValue;\n}\n\nexport {\n uniqID,\n stringToDom,\n evalTemplateString,\n importCSS,\n importJS,\n loadScript,\n domIsReady,\n setDeepProperty,\n parseFieldsString,\n findClosingBracketMatchIndex,\n defineComponent,\n fuzzyCompare,\n compare,\n transformArrayToContainer\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["interfaces.ts"],"names":[],"mappings":"AAKC;AAUA;AA8BA;AAsBA;AAIA","sourcesContent":["export interface AccessorStaticInterface {\n [key: string]: {\n get: Function;\n set: Function;\n }\n};\n\nexport interface ArrayOfHooksInterface {\n created: HookInterface[];\n attached: HookInterface[];\n detached: HookInterface[];\n}\n\nexport interface AttributeChangedCallbackInterface {\n (newValue: any, oldValue: any): void;\n};\n\nexport interface AttributeDefinitionInterface {\n type?: any;\n default?: any;\n required?: boolean;\n callback?: AttributeChangedCallbackInterface;\n}\n\nexport interface AttributesDefinitionInterface {\n [key: string]: AttributeDefinitionInterface;\n}\n\nexport type ComponentConstructorInterface = new (element: HTMLElement) => ComponentInterface;\n\nexport interface ComponentInterface {\n element: HTMLElement;\n created():void;\n attached():void;\n detached():void;\n\n attributesCallback(key: string, value: any, oldValue: any):void;\n}\n\nexport interface ComponentStaticInterface extends HasAttributesDefinitionInterface, HasInitialStateInterface {\n name: String;\n\n hooks: ArrayOfHooksInterface;\n methods: Map<string, Function>;\n accessors: AccessorStaticInterface;\n};\n\nexport interface HasAttributesDefinitionInterface {\n attributes?: AttributesDefinitionInterface | undefined;\n}\n\nexport interface HasHooksInterface {\n created?: HookInterface;\n attached?: HookInterface;\n detached?: HookInterface;\n}\n\nexport interface HasInitialStateInterface {\n initialState?: object | undefined;\n}\n\nexport interface HasMixinsInterface {\n use?: MixinStaticInterface[] | undefined;\n}\n\nexport interface HookInterface {\n (): void;\n};\n\nexport interface MixinStaticInterface extends HasAttributesDefinitionInterface, HasMixinsInterface, HasInitialStateInterface, HasHooksInterface {\n name: String;\n};\n\nexport interface LocationResourceInterface {\n lat?: HookInterface;\n lng?: HookInterface;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["lit-helpers.ts"],"names":["html","directive","noChange","prevCache","WeakMap","spread","spreadData","part","prevData","get","set","key","value","prefix","element","committer","prevHandler","name","slice","removeEventListener","addEventListener","setAttribute","removeAttribute","String","undefined","dropIndices","arr","needlessValues","newArr","j","i","n","length","index","push","templateStringsCache","preHTML","strings","values","cachedStrings","isS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;;AAED,MAAI,CAACL,aAAL,EAAoB;AAChBA,IAAAA,aAAa,GAAG,EAAhB;AACAJ,IAAAA,oBAAoB,CAACzB,GAArB,CAAyB2B,OAAzB,EAAkCE,aAAlC;AACH;;AAEDA,EAAAA,aAAa,CAACL,IAAd,CAAmB;AACfG,IAAAA,OAAO,EAAEM,UADM;AAEfhB,IAAAA;AAFe,GAAnB;AAKA,SAAO3B,IAAI,CAAC2C,UAAD,EAAoB,GAAGlB,WAAW,CAACa,MAAD,EAASX,cAAT,CAAlC,CAAX;AACH","sourcesContent":["/**\n * Spread function from open-wc/lit-helpers\n * More informations here: https://open-wc.org/developing/lit-helpers.html\n */\nimport {html, TemplateResult, directive, noChange } from 'lit-html';\n\nconst prevCache = new WeakMap();\nexport const spread = directive((spreadData) => (part) => {\n const prevData = prevCache.get(part);\n if (prevData === spreadData) {\n return;\n }\n prevCache.set(part, spreadData);\n\n if (spreadData) {\n for (const key in spreadData) {\n const value = spreadData[key];\n if (value === noChange) continue;\n\n const prefix = key[0];\n const { element } = part.committer;\n\n if (prefix === '@') {\n const prevHandler = prevData && prevData[key];\n if (!prevHandler || prevHandler !== value) {\n const name = key.slice(1);\n if (prevHandler) element.removeEventListener(name, prevHandler);\n element.addEventListener(name, value);\n }\n continue;\n }\n if (prefix === '.') {\n if (!prevData || prevData[key] !== value) {\n element[key.slice(1)] = value;\n }\n continue;\n }\n if (prefix === '?') {\n if (!prevData || prevData[key] !== value) {\n const name = key.slice(1);\n if (value) {\n element.setAttribute(name, '');\n } else {\n element.removeAttribute(name);\n }\n }\n continue;\n }\n if (!prevData || prevData[key] !== value) {\n if (value != null) {\n element.setAttribute(key, String(value));\n } else {\n element.removeAttribute(key);\n }\n }\n }\n }\n\n if (prevData) {\n for (const key in prevData) {\n if (!spreadData || !(key in spreadData)) {\n const prefix = key[0];\n const { element } = part.committer;\n\n if (prefix === '@') {\n element.removeEventListener(key.slice(1), prevData[key]);\n continue;\n }\n if (prefix === '.') {\n element[key.slice(1)] = undefined;\n continue;\n }\n if (prefix === '?') {\n element.removeAttribute(key.slice(1));\n continue;\n }\n element.removeAttribute(key);\n }\n }\n }\n});\n\n\ninterface CachedNeedlessValue {\n value: any;\n index: number;\n}\n\ninterface CachedTemplateStrings {\n strings: string[];\n needlessValues: CachedNeedlessValue[];\n}\n\nfunction dropIndices(arr: any[], needlessValues: CachedNeedlessValue[]): any[] {\n const newArr: any[] = [];\n let j = 0;\n\n for (let i = 0, n = arr.length; i < n; ++i) {\n if (needlessValues[j].index === i) {\n ++j;\n } else {\n newArr.push(arr[i]);\n }\n }\n\n return newArr;\n}\n\nconst templateStringsCache = new WeakMap<TemplateStringsArray, CachedTemplateStrings[]>();\n\n// Convert dynamic tags to template strings\n// example: <${'div'}>${'this is example'}</${'div'}> => <div>${'this is example'}</div>\nexport function preHTML(strings: TemplateStringsArray, ...values: any[]): TemplateResult {\n // check cache !important return equal link at first argument\n let cachedStrings = templateStringsCache.get(strings) as CachedTemplateStrings[];\n if (cachedStrings) {\n for (let i = 0, n = cachedStrings.length; i < n; ++i) {\n const needlessValues = cachedStrings[i].needlessValues;\n let isSame = true;\n for (let ii = 0, nn = needlessValues.length; ii < nn; ++ii) {\n if (values[needlessValues[ii].index] !== needlessValues[ii].value) {\n isSame = false;\n break;\n }\n }\n\n if (isSame) {\n return html(\n cachedStrings[i].strings as any,\n ...dropIndices(values, needlessValues)\n );\n }\n }\n }\n\n const needlessValues: CachedNeedlessValue[] = [];\n const newStrings: string[] = [];\n\n let str: string;\n for (let i = 0, n = strings.length; i < n; ++i) {\n str = strings[i];\n\n while (\n str[str.length - 1] === '<' // open tag\n || (str[str.length - 2] === '<' && str[str.length - 1] === '/') // close tag\n ) {\n needlessValues.push({\n value: values[i],\n index: i,\n });\n str += values[i] + strings[++i];\n }\n\n newStrings.push(str);\n }\n\n if (!cachedStrings) {\n cachedStrings = [];\n templateStringsCache.set(strings, cachedStrings);\n }\n\n cachedStrings.push({\n strings: newStrings,\n needlessValues,\n });\n\n return html(newStrings as any, ...dropIndices(values, needlessValues));\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["polyfills.ts"],"names":["Array","prototype","Object","defineProperty","configurable","value","flat","depth","isNaN","Number","slice","call","reduce","acc","cur","isArray","push","apply","writable","Element","toggleAttribute","name","force","undefined","hasAttribute","removeAttribute","setAttribute"],"mappings":"AAAA;AACA,IAAI,EAAE,UAAUA,KAAK,CAACC,SAAlB,CAAJ,EAAkC;AAChCC,EAAAA,MAAM,CAACC,cAAP,CAAsBH,KAAK,CAACC,SAA5B,EAAuC,MAAvC,EAA+C;AAC7CG,IAAAA,YAAY,EAAE,IAD+B;AAE7CC,IAAAA,KAAK,EAAE,SAASC,IAAT,CAA2BC,KAAK,GAAG,CAAnC,EAAsC;AAC3CA,MAAAA,KAAK,GAAGC,KAAK,CAACD,KAAD,CAAL,GAAe,CAAf,GAAmBE,MAAM,CAACF,KAAD,CAAjC;AACA,UAAIA,KAAK,KAAK,CAAd,EAAiB,OAAOP,KAAK,CAACC,SAAN,CAAgBS,KAAhB,CAAsBC,IAAtB,CAA2B,IAA3B,CAAP;AACjB,aAAOX,KAAK,CAACC,SAAN,CAAgBW,MAAhB,CAAuBD,IAAvB,CACL,IADK,EAEL,UAASE,GAAT,EAAoBC,GAApB,EAA8B;AAC5B,YAAId,KAAK,CAACe,OAAN,CAAcD,GAAd,CAAJ,EAAwB;AACtBD,UAAAA,GAAG,CAACG,IAAJ,CAASC,KAAT,CAAeJ,GAAf,EAAoBP,IAAI,CAACK,IAAL,CAAUG,GAAV,EAAeP,KAAK,GAAG,CAAvB,CAApB;AACD,SAFD,MAEO;AACLM,UAAAA,GAAG,CAACG,IAAJ,CAASF,GAAT;AACD;;AACD,eAAOD,GAAP;AACD,OATI,EAUL,EAVK,CAAP;AAYD,KAjB4C;AAkB7CK,IAAAA,QAAQ,EAAE;AAlBmC,GAA/C;AAoBD,C,CAED;;;AACA,IAAI,CAACC,OAAO,CAAClB,SAAR,CAAkBmB,eAAvB,EAAwC;AACtCD,EAAAA,OAAO,CAAClB,SAAR,CAAkBmB,eAAlB,GAAoC,UAASC,IAAT,EAAeC,KAAK,GAAGC,SAAvB,EAAkC;AACpE,QAAID,KAAK,KAAKC,SAAd,EAAyBD,KAAK,GAAG,CAAC,CAACA,KAAV;;AAEzB,QAAI,KAAKE,YAAL,CAAkBH,IAAlB,CAAJ,EAA6B;AAC3B,UAAIC,KAAJ,EAAW,OAAO,IAAP;AAEX,WAAKG,eAAL,CAAqBJ,IAArB;AACA,aAAO,KAAP;AACD;;AACD,QAAIC,KAAK,KAAK,KAAd,EAAqB,OAAO,KAAP;AAErB,SAAKI,YAAL,CAAkBL,IAAlB,EAAwB,EAAxB;AACA,WAAO,IAAP;AACD,GAbD;AAcD;;AAED","sourcesContent":["// Array.prototype.flat\nif (!('flat' in Array.prototype)) {\n Object.defineProperty(Array.prototype, 'flat', {\n configurable: true,\n value: function flat(this: any[], depth = 1) {\n depth = isNaN(depth) ? 1 : Number(depth);\n if (depth === 0) return Array.prototype.slice.call(this);\n return Array.prototype.reduce.call<any, any[], any[]>(\n this,\n function(acc:any[], cur: any) {\n if (Array.isArray(cur)) {\n acc.push.apply(acc, flat.call(cur, depth - 1));\n } else {\n acc.push(cur);\n }\n return acc;\n },\n [],\n );\n },\n writable: true,\n });\n}\n\n// Element.prototype.toggleAttribute\nif (!Element.prototype.toggleAttribute) {\n Element.prototype.toggleAttribute = function(name, force = undefined) {\n if (force !== undefined) force = !!force;\n\n if (this.hasAttribute(name)) {\n if (force) return true;\n\n this.removeAttribute(name);\n return false;\n }\n if (force === false) return false;\n\n this.setAttribute(name, '');\n return true;\n };\n}\n\nexport {}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["store.ts"],"names":["JSONLDContextParser","PubSub","ContextParser","myParser","base_context","rdf","rdfs","ldp","foaf","name","acl","permissions","mode","geo","lat","lng","Store","constructor","storeOptions","id","resolve","handler","event","detail","resource","document","removeEventListener","cache","Map","subscriptionIndex","subscriptionVirtualContainersIndex","loadingList","Set","headers","fetch","fetchMethod","session","getData","context","idParent","localData","has","get","isFullResource","Promise","addEventListener","resolveResource","add","clientContext","parse","_isLocalId","fetchData","error","console","delete","serverContext","resourceProxy","CustomGetter","getProxy","cacheGraph","dispatchEvent","CustomEvent","fetchAuthn","iri","options","authenticated","then","fn","_convertHeaders","_getAbsoluteIri","_getLanguage","method","credentials","response","ok","json","key","parentContext","parentId","properties","merge","set","getSubObjects","res","newParentContext","getChildren","cacheChildrenPromises","subscribeResourceTo","push","all","match","_fetch","body","JSON","stringify","store","clearCache","_updateResource","includes","Error","expandedId","_getExpandedId","nestedResources","getNestedResources","resourcesToRefresh","resourcesToNotify","refreshResources","resourceIds","notifyResources","filter","resourceWithContexts","map","resourceId","publish","cachedResource","isContainer","nestedProperties","excludeKeys","p","Object","keys","forEach","child","setLocalData","post","put","patch","deleted","headersObject","Headers","value","entries","expandTerm","startsWith","nestedResourceId","existingSubscriptions","subscribeVirtualContainerTo","virtualContainerId","parentIri","URL","location","href","_resourceIsComplete","length","localStorage","getItem","window","navigator","language","slice","selectLanguage","selectedLanguageCode","setItem","sibStore","sibAuth","querySelector","sibAuthDefined","customElements","whenDefined","localName","getFetch","Symbol","toPrimitive","expandProperties","prop","objectReplaceProperty","object","oldProp","newProp","defineProperty","getOwnPropertyDescriptor","path","path1","split","path2","getResource","getExpandedPredicate","e","lastPath1El","pop","unshift","undefined","join","iriParent","getProperties","getCompactedPredicate","getLdpContains","children","subObjects","property","isFullNestedResource","getResourceData","getPermissions","perm","compactIri","getCompactedIri","toString","Proxy","bind"],"mappings":";;;;AAAA,OAAOA,mBAAP,MAAgC,uBAAhC,C,CACA;;AACA,OAAOC,MAAP,MAAmB,mCAAnB;AAGA,MAAMC,aAAa,GAAGF,mBAAmB,CAACE,aAA1C;AACA,MAAMC,QAAQ,GAAG,IAAID,aAAJ,EAAjB;AAEA,OAAO,MAAME,YAAY,GAAG;AA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parser';\n//@ts-ignore\nimport PubSub from 'https://cdn.skypack.dev/pubsub-js';\nimport type { Resource } from '../../mixins/interfaces';\n\nconst ContextParser = JSONLDContextParser.ContextParser;\nconst myParser = new ContextParser();\n\nexport const base_context = {\n '@vocab': 'http://happy-dev.fr/owl/#',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n ldp: 'http://www.w3.org/ns/ldp#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n name: 'rdfs:label',\n acl: 'http://www.w3.org/ns/auth/acl#',\n permissions: 'acl:accessControl',\n mode: 'acl:mode',\n geo: \"http://www.w3.org/2003/01/geo/wgs84_pos#\",\n lat: \"geo:lat\",\n lng: \"geo:long\"\n};\n\nclass Store {\n cache: Map<string, any>;\n subscriptionIndex: Map<string, any>; // index of all the containers per resource\n subscriptionVirtualContainersIndex: Map<string, any>; // index of all the containers per resource\n loadingList: Set<String>;\n headers: object;\n fetch: Promise<any> | undefined;\n session: Promise<any> | undefined;\n\n constructor(private storeOptions: StoreOptions) {\n this.cache = new Map();\n this.subscriptionIndex = new Map();\n this.subscriptionVirtualContainersIndex = new Map();\n this.loadingList = new Set();\n this.headers = {'Content-Type': 'application/ld+json'};\n this.fetch = this.storeOptions.fetchMethod;\n this.session = this.storeOptions.session;\n }\n\n /**\n * Fetch data and cache it\n * @param id - uri of the resource to fetch\n * @param context - context used to expand id and predicates when accessing the resource\n * @param idParent - uri of the parent caller used to expand uri for local files\n *\n * @returns The fetched resource\n *\n * @async\n */\n\n async getData(id: string, context:any = {}, idParent = \"\", localData?: object): Promise<Resource|null> {\n if (localData == null && this.cache.has(id) && !this.loadingList.has(id)) {\n const resource = this.get(id);\n if (resource && resource.isFullResource()) return resource; // if resource is not complete, re-fetch it\n }\n\n return new Promise(async (resolve) => {\n document.addEventListener('resourceReady', this.resolveResource(id, resolve));\n\n if (this.loadingList.has(id)) return;\n this.loadingList.add(id);\n\n // Generate proxy\n const clientContext = await myParser.parse(context);\n let resource: any = null;\n if(this._isLocalId(id)) {\n if(localData == null) localData = {};\n localData[\"@id\"] = id;\n resource = localData;\n } else try {\n resource = localData || await this.fetchData(id, clientContext, idParent);\n } catch (error) { console.error(error) }\n if (!resource) {\n this.loadingList.delete(id);\n resolve(null);\n return;\n }\n const serverContext = await myParser.parse([resource['@context'] || {}]);\n const resourceProxy = new CustomGetter(id, resource, clientContext, serverContext, idParent).getProxy();\n\n // Cache proxy\n await this.cacheGraph(id, resourceProxy, clientContext, serverContext, idParent || id);\n this.loadingList.delete(id);\n document.dispatchEvent(new CustomEvent('resourceReady', { detail: { id: id, resource: this.get(id) } }));\n });\n }\n\n async fetchAuthn(iri: string, options: any) {\n let authenticated = false;\n if (this.session) authenticated = await this.session;\n\n if (this.fetch && authenticated) { // authenticated\n return this.fetch.then(fn => fn(iri, options))\n } else { // anonymous\n if (options.headers) options.headers = this._convertHeaders(options.headers);\n return fetch(iri, options);\n }\n }\n\n async fetchData(id: string, context = {}, idParent = \"\") {\n const iri = this._getAbsoluteIri(id, context, idParent);\n const headers = { ...this.headers, 'accept-language': this._getLanguage() };\n return this.fetchAuthn(iri, {\n method: 'GET',\n headers: headers,\n credentials: 'include'\n }).then(response => {\n if (!response.ok) return;\n return response.json()\n })\n }\n\n async cacheGraph(key: string, resource: any, clientContext: object, parentContext: object, parentId: string) {\n if (resource.properties) { // if proxy, cache it\n if (this.get(key)) { // if already cached, merge data\n this.cache.get(key).merge(resource);\n } else { // else, put in cache\n this.cache.set(key, resource);\n }\n }\n\n // Cache nested resources\n if (resource.getSubObjects) {\n for (let res of resource.getSubObjects()) {\n let newParentContext = parentContext;\n // If additional context in resource, use it to expand properties\n if (res['@context']) newParentContext = await myParser.parse({ ...parentContext, ...res['@context'] });\n const resourceProxy = new CustomGetter(res['@id'], res, clientContext, newParentContext, parentId).getProxy();\n // this.subscribeResourceTo(resource['@id'], res['@id']); // removed to prevent useless updates\n await this.cacheGraph(res['@id'], resourceProxy, clientContext, parentContext, parentId);\n }\n }\n\n // Cache children of container\n if (resource['@type'] == \"ldp:Container\" && resource.getChildren) {\n const cacheChildrenPromises: Promise<void>[] = [];\n for (let res of resource.getChildren()) {\n this.subscribeResourceTo(resource['@id'], res['@id']);\n cacheChildrenPromises.push(this.cacheGraph(res['@id'], res, clientContext, parentContext, parentId))\n }\n await Promise.all(cacheChildrenPromises);\n return;\n }\n\n // Create proxy, (fetch data) and cache resource\n if (resource['@id'] && !resource.properties) {\n if (resource['@id'].match(/^b\\d+$/)) return; // not anonymous node\n // Fetch data if\n if (resource['@type'] === \"sib:federatedContainer\" && resource['@cache'] !== 'false') { // if object is federated container\n await this.getData(resource['@id'], clientContext, parentId); // then init graph\n return;\n }\n const resourceProxy = new CustomGetter(resource['@id'], resource, clientContext, parentContext, parentId).getProxy();\n await this.cacheGraph(key, resourceProxy, clientContext, parentContext, parentId);\n }\n }\n\n /**\n * Update fetch\n * @param method - 'POST', 'PATCH', 'PUT', '_LOCAL'\n * @param resource - resource to send\n * @param id - uri to update\n * @returns - object\n */\n async _fetch(method: string, resource: object, id: string): Promise<any> {\n if (method !== '_LOCAL')\n return this.fetchAuthn(id, {\n method: method,\n headers: this.headers,\n body: JSON.stringify(resource),\n credentials: 'include'\n })\n\n const resourceProxy = store.get(id);\n const clientContext = resourceProxy ? resourceProxy.clientContext : resource['@context']\n this.clearCache(id);\n await this.getData(id, clientContext, '', resource);\n return {ok: true}\n }\n\n async _updateResource(method: string, resource: object, id: string) {\n if (!['POST', 'PUT', 'PATCH', '_LOCAL'].includes(method)) throw new Error('Error: method not allowed');\n\n const context = await myParser.parse([resource['@context'] || {}]); // parse context before expandTerm\n const expandedId = this._getExpandedId(id, context);\n return this._fetch(method, resource, id).then(response => {\n if (response.ok) {\n if(method !== '_LOCAL') this.clearCache(expandedId); // clear cache\n this.getData(expandedId, resource['@context']).then(async () => { // re-fetch data\n const nestedResources = await this.getNestedResources(resource, id);\n const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];\n const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];\n\n return this.refreshResources([...nestedResources, ...resourcesToRefresh]) // refresh related resources\n .then(resourceIds => this.notifyResources([expandedId, ...resourceIds, ...resourcesToNotify])); // notify components\n });\n return response.headers?.get('Location') || null;\n } else {\n throw response;\n }\n });\n }\n\n /**\n * Clear cache and refetch data for a list of ids\n * @param resourceIds -\n * @returns - all the resource ids\n */\n async refreshResources(resourceIds: string[]) {\n resourceIds = [...new Set(resourceIds.filter(id => this.cache.has(id)))]; // remove duplicates and not cached resources\n const resourceWithContexts = resourceIds.map(resourceId => ({ \"id\": resourceId, \"context\": store.get(resourceId)?.clientContext }));\n for (const resource of resourceWithContexts) {\n if (!this._isLocalId(resource.id)) this.clearCache(resource.id);\n }\n await Promise.all(resourceWithContexts.map(({ id, context }) => this.getData(id, context || base_context)))\n return resourceIds;\n }\n /**\n * Notifies all components for a list of ids\n * @param resourceIds -\n */\n async notifyResources(resourceIds: string[]) {\n resourceIds = [...new Set(resourceIds)]; // remove duplicates\n for (const id of resourceIds) PubSub.publish(id);\n }\n\n /**\n * Return id of nested properties of a resource\n * @param resource - object\n * @param id - string\n */\n async getNestedResources(resource: object, id: string) {\n const cachedResource = store.get(id);\n if (!cachedResource || cachedResource.isContainer()) return [];\n let nestedProperties:any[] = [];\n const excludeKeys = ['@context'];\n for (let p of Object.keys(resource)) {\n if (resource[p]\n && typeof resource[p] === 'object'\n && !excludeKeys.includes(p)\n && resource[p]['@id']) {\n nestedProperties.push(resource[p]['@id']);\n }\n }\n return nestedProperties;\n }\n\n /**\n * Returns the resource with id from the cache\n * @param id - id of the resource to retrieve\n *\n * @returns Resource (Proxy) if in the cache, null otherwise\n */\n get(id: string): Resource | null {\n return this.cache.get(id) || null;\n }\n\n\n /**\n * Removes a resource from the cache\n * @param id - id of the resource to remove from the cache\n */\n clearCache(id: string): void {\n if (this.cache.has(id)) {\n // For federation, clear each source\n const resource = this.cache.get(id);\n if (resource['@type'] === 'ldp:Container') {\n resource['ldp:contains'].forEach((child: object) => {\n if (child && child['@type'] === 'ldp:Container') this.cache.delete(child['@id'])\n })\n }\n\n this.cache.delete(id);\n }\n }\n\n /**\n * Send data to create a local resource in a container\n * @param resource - resource to create\n * @param id - uri of the container to add resource. should start with ``\n *\n * @returns id of the posted resource\n */\n async setLocalData(resource: object, id: string): Promise<string | null> {\n return this._updateResource('_LOCAL', resource, id);\n }\n\n /**\n * Send a POST request to create a resource in a container\n * @param resource - resource to create\n * @param id - uri of the container to add resource\n *\n * @returns id of the posted resource\n */\n async post(resource: object, id: string): Promise<string | null> {\n return this._updateResource('POST', resource, id);\n }\n\n /**\n * Send a PUT request to edit a resource\n * @param resource - resource data to send\n * @param id - uri of the resource to edit\n *\n * @returns id of the edited resource\n */\n async put(resource: object, id: string): Promise<string | null> {\n return this._updateResource('PUT', resource, id);\n }\n\n /**\n * Send a PATCH request to edit a resource\n * @param resource - resource data to send\n * @param id - uri of the resource to patch\n *\n * @returns id of the edited resource\n */\n async patch(resource: object, id: string): Promise<string | null> {\n return this._updateResource('PATCH', resource, id);\n }\n\n /**\n * Send a DELETE request to delete a resource\n * @param id - uri of the resource to delete\n * @param context - can be used to expand id\n *\n * @returns id of the deleted resource\n */\n async delete(id: string, context: object = {}) {\n const expandedId = this._getExpandedId(id, context);\n const deleted = await this.fetchAuthn(expandedId, {\n method: 'DELETE',\n headers: this.headers,\n credentials: 'include'\n });\n\n const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];\n const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];\n\n this.refreshResources([...resourcesToNotify, ...resourcesToRefresh])\n .then(resourceIds => this.notifyResources(resourceIds));\n\n return deleted;\n }\n\n /**\n * Convert headers object to Headers\n * @param headersObject - object\n * @returns {Headers}\n */\n _convertHeaders(headersObject: object): Headers {\n const headers = new Headers();\n for (const [key, value] of Object.entries(headersObject)){\n headers.set(key, value as string);\n }\n return headers;\n }\n\n _getExpandedId(id: string, context: object) {\n return (context && Object.keys(context)) ? ContextParser.expandTerm(id, context) : id;\n }\n\n _isLocalId(id: string) {\n return id.startsWith('store://local.');\n }\n\n /**\n * Make a resource listen changes of another one\n * @param resourceId - id of the resource which needs to be updated\n * @param nestedResourceId - id of the resource which will change\n */\n subscribeResourceTo(resourceId: string, nestedResourceId: string) {\n const existingSubscriptions = this.subscriptionIndex.get(nestedResourceId) || [];\n this.subscriptionIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, resourceId])])\n }\n\n /**\n * Make a virtual container listen for changes of a resource\n * @param virtualContainerId - id of the container which needs to be updated\n * @param nestedResourceId - id of the resource which will change\n */\n subscribeVirtualContainerTo(virtualContainerId: string, nestedResourceId: string) {\n const existingSubscriptions = this.subscriptionVirtualContainersIndex.get(nestedResourceId) || [];\n this.subscriptionVirtualContainersIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, virtualContainerId])])\n }\n\n /**\n * Return absolute IRI of the resource\n * @param id\n * @param context\n * @param parentId\n */\n _getAbsoluteIri(id: string, context: object, parentId: string): string {\n let iri = ContextParser.expandTerm(id, context); // expand if reduced ids\n if (parentId) { // and get full URL from parent caller for local files\n let parentIri = new URL(parentId, document.location.href).href;\n iri = new URL(iri, parentIri).href;\n } else {\n iri = new URL(iri, document.location.href).href;\n }\n return iri;\n }\n\n /**\n * Check if object is a full resource\n * @param resource\n */\n _resourceIsComplete(resource: object) {\n return !!(Object.keys(resource).filter(p => !p.startsWith('@')).length > 0 && resource['@id'])\n }\n\n /**\n * Return language of the users\n */\n _getLanguage() {\n return localStorage.getItem('language') || window.navigator.language.slice(0,2);\n }\n\n /**\n * Save the preferred language of the user\n * @param selectedLanguageCode\n */\n selectLanguage(selectedLanguageCode: string) {\n localStorage.setItem('language', selectedLanguageCode);\n }\n\n resolveResource = function(id: string, resolve) {\n const handler = function(event) {\n if (event.detail.id === id) {\n resolve(event.detail.resource);\n // TODO : callback\n document.removeEventListener('resourceReady', handler);\n }\n };\n return handler;\n };\n}\n\nlet store: Store;\nif (window.sibStore) {\n store = window.sibStore;\n} else {\n const sibAuth = document.querySelector('sib-auth');\n const storeOptions: StoreOptions = {}\n\n if (sibAuth) {\n const sibAuthDefined = customElements.whenDefined(sibAuth.localName);\n storeOptions.session = sibAuthDefined.then(() => (sibAuth as any).session)\n storeOptions.fetchMethod = sibAuthDefined.then(() => (sibAuth as any).getFetch())\n }\n\n store = new Store(storeOptions);\n window.sibStore = store;\n}\n\nexport {\n store\n};\n\n\nclass CustomGetter {\n resource: any; // content of the requested resource\n resourceId: string;\n clientContext: object; // context given by the app\n serverContext: object; // context given by the server\n parentId: string; // id of the parent resource, used to get the absolute url of the current resource\n\n constructor(resourceId: string, resource: object, clientContext: object, serverContext: object = {}, parentId: string = \"\") {\n this.clientContext = clientContext;\n this.serverContext = serverContext;\n this.parentId = parentId;\n this.resource = this.expandProperties({ ...resource }, serverContext);\n this.resourceId = resourceId;\n }\n\n /**\n * Expand all predicates of a resource with a given context\n * @param resource: object\n * @param context: object\n */\n expandProperties(resource: object, context: object | string) {\n for (let prop of Object.keys(resource)) {\n if (!prop) continue;\n this.objectReplaceProperty(resource, prop, ContextParser.expandTerm(prop, context as JSONLDContextParser.IJsonLdContextNormalized, true));\n }\n return resource\n }\n\n /**\n * Change the key of an object\n * @param object: object\n * @param oldProp: string - current key\n * @param newProp: string - new key to set\n */\n objectReplaceProperty(object: object, oldProp: string, newProp: string) {\n if (newProp !== oldProp) {\n Object.defineProperty(\n object,\n newProp,\n Object.getOwnPropertyDescriptor(object, oldProp) || ''\n );\n delete object[oldProp];\n }\n }\n\n /**\n * Get the property of a resource for a given path\n * @param path: string\n */\n async get(path: any) {\n if (!path) return;\n const path1: string[] = path.split('.');\n const path2: string[] = [];\n let value: any;\n if (!this.isFullResource()) { // if resource is not complete, fetch it first\n await this.getResource(this.resourceId, this.clientContext, this.parentId);\n }\n while (true) {\n try {\n value = this.resource[this.getExpandedPredicate(path1[0])];\n } catch (e) { break }\n\n if (path1.length <= 1) break; // no dot path\n const lastPath1El = path1.pop();\n if(lastPath1El) path2.unshift(lastPath1El);\n }\n if (path2.length === 0) { // end of the path\n if (!value || !value['@id']) return value; // no value or not a resource\n return await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId); // return complete resource\n }\n if (!value) return undefined;\n let resource = await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId);\n\n store.subscribeResourceTo(this.resourceId, value['@id']);\n return resource ? await resource[path2.join('.')] : undefined; // return value\n }\n\n /**\n * Cache resource in the store, and return the created proxy\n * @param id\n * @param context\n * @param iriParent\n */\n async getResource(id: string, context: object, iriParent: string): Promise<Resource | null> {\n return store.getData(id, context, iriParent);\n }\n\n /**\n * Return true if the resource is a container\n */\n isContainer(): boolean {\n return this.resource[\"@type\"] == \"ldp:Container\" || this.resource[\"@type\"] == \"sib:federatedContainer\";\n }\n\n /**\n * Get all properties of a resource\n */\n getProperties(): string[] {\n return Object.keys(this.resource).map(prop => this.getCompactedPredicate(prop));\n }\n\n /**\n * Get children of container as objects\n */\n getChildren(): object[] {\n return this.resource[this.getExpandedPredicate(\"ldp:contains\")] || [];\n }\n\n /**\n * Get children of container as Proxys\n */\n getLdpContains(): CustomGetter[] {\n const children = this.resource[this.getExpandedPredicate(\"ldp:contains\")];\n return children ? children.map((res: object) => store.get(res['@id'])) : [];\n }\n\n /**\n * Get all nested resource or containers which contains datas\n */\n getSubObjects() {\n let subObjects: any = [];\n for (let p of Object.keys(this.resource)) {\n let property = this.resource[p];\n if (!this.isFullNestedResource(property)) continue; // if not a resource, stop\n if (property['@type'] == \"ldp:Container\" &&\n (property['ldp:contains'] == undefined ||\n (property['ldp:contains'].length >= 1 && !this.isFullNestedResource(property['ldp:contains'][0])))\n ) continue; // if not a full container\n subObjects.push(property)\n }\n return subObjects;\n }\n\n merge(resource: CustomGetter) {\n this.resource = {...this.getResourceData(), ...resource.getResourceData()}\n }\n\n getResourceData(): object { return this.resource }\n\n /**\n * return true if prop is a resource with an @id and some properties\n * @param prop\n */\n isFullNestedResource(prop: any): boolean {\n return prop &&\n typeof prop == \"object\" &&\n prop['@id'] != undefined &&\n Object.keys(prop).filter(p => !p.startsWith('@')).length > 0;\n }\n /**\n * return true resource seems complete\n * @param prop\n */\n isFullResource(): boolean {\n return Object.keys(this.resource).filter(p => !p.startsWith('@')).length > 0;\n }\n\n getPermissions(): string[] {\n const permissions = this.resource[this.getExpandedPredicate(\"permissions\")];\n return permissions ? permissions.map(perm => ContextParser.expandTerm(perm.mode['@type'], this.serverContext, true)) : [];\n }\n\n /**\n * Remove the resource from the cache\n */\n clearCache(): void {\n store.clearCache(this.resourceId);\n }\n\n getExpandedPredicate(property: string) { return ContextParser.expandTerm(property, this.clientContext, true) }\n getCompactedPredicate(property: string) { return ContextParser.compactIri(property, this.clientContext, true) }\n getCompactedIri(id: string) { return ContextParser.compactIri(id, this.clientContext) }\n toString() { return this.getCompactedIri(this.resource['@id']) }\n [Symbol.toPrimitive]() { return this.getCompactedIri(this.resource['@id']) }\n\n\n /**\n * Returns a Proxy which handles the different get requests\n */\n getProxy() {\n return new Proxy(this, {\n get: (resource, property) => {\n if (!this.resource) return undefined;\n if (typeof resource[property] === 'function') return resource[property].bind(resource)\n\n switch (property) {\n case '@id':\n return this.getCompactedIri(this.resource['@id']); // Compact @id if possible\n case '@type':\n return this.resource['@type']; // return synchronously\n case 'properties':\n return this.getProperties();\n case 'ldp:contains':\n return this.getLdpContains(); // returns standard arrays synchronously\n case 'permissions':\n return this.getPermissions(); // get expanded permissions\n case 'clientContext':\n return this.clientContext; // get saved client context to re-fetch easily a resource\n case 'then':\n return;\n default:\n return resource.get(property);\n }\n }\n })\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["attributeBinderMixin.ts"],"names":["base_context","store","AttributeBinderMixin","name","use","initialState","bindedAttributes","created","resetAttributesData","attr","Object","keys","element","setAttribute","replaceAttributesData","reset","oldAttributes","Array","from","attributes","reduce","obj","value","match","newAttributes","transformAttributes","resource","isContainer","startsWith","path","replace","userId","retry","getUser","bind","user","getData","context","sibAuth","document","querySelector","fn","ms","maxRetries","Promise","resolve","reject","retries","then","catch","setTimeout"],"mappings":"AAAA,SAASA,YAAT,EAAuBC,KAAvB,QAAoC,qBAApC;AAGA,MAAMC,oBAAoB,GAAG;AAC3BC,EAAAA,IAAI,EAAE,wBADqB;AAE3BC,EAAAA,GAAG,EAAE,EAFsB;AAG3BC,EAAAA,YAAY,EAAE;AACZC,IAAAA,gBAAgB,EAAE;AADN,GAHa;;AAM3BC,EAAAA,OAAO,GAAG;AACR,SAAKD,gBAAL,GAAwB,EAAxB;AACD,GAR0B;;AAS3B;AACF;AACA;AACEE,EAAAA,mBAAmB,GAAG;AACpB,SAAK,IAAIC,IAAT,IAAiBC,MAAM,CAACC,IAAP,CAAY,KAAKL,gBAAjB,CAAjB,EAAqD;AACnD,WAAKM,OAAL,CAAaC,YAAb,CAA0BJ,IAA1B,EAAgC,KAAKH,gBAAL,CAAsBG,IAAtB,CAAhC;AACD;AACF,GAhB0B;;AAiB3B;AACF;AACA;AACA;AACE,QAAMK,qBAAN,CAA4BC,KAAK,GAAG,IAApC,EAA0C;AACxC,QAAIA,KAAJ,EAAW,KAAKP,mBAAL;AAEX,UAAMQ,aAAkB,GAAGC,KAAK,CAACC,IAAN,CAAW,KAAKN,OAAL,CAAaO,UAAxB,EAAoC;AAApC,KACxBC,MADwB,CACjB,CAACC,GAAD,EAAWZ,IAAX,KAAyB;AAC/B;AACA,UAAI,CAACA,IAAI,CAACa,KAAL,CAAWC,KAAX,CAAiB,sCAAjB,CAAL,EAA+D,OAAO,EAAE,GAAGF;AAAL,OAAP,CAFhC,CAI/B;;AACA,UAAI,CAAC,KAAKf,gBAAL,CAAsBG,IAAI,CAACN,IAA3B,CAAL,EAAuC,KAAKG,gBAAL,CAAsBG,IAAI,CAACN,IAA3B,IAAmCM,IAAI,CAACa,KAAxC;AAEvC,aAAO,EACL,GAAGD,GADE;AAE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D;AAClD,WAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAIC,OAAO,GAAG,CAAd;AACAN,MAAAA,EAAE,GAAGO,IAAL,CAAUH,OAAV,EAAmBI,KAAnB,CAAyB,MAAM;AAC7BC,QAAAA,UAAU,CAAC,MAAM;AACf,YAAEH,OAAF;AACA,cAAIA,OAAO,IAAIJ,UAAf,EAA2B,OAAOG,MAAM,EAAb;AAC3B,eAAKd,KAAL,CAAWS,EAAX,EAAeC,EAAf,EAAmBM,IAAnB,CAAwBH,OAAxB;AACD,SAJS,EAIPH,EAJO,CAAV;AAKD,OAND;AAOD,KATM,CAAP;AAUD;;AA5G0B,CAA7B;AA+GA,SACExC,oBADF","sourcesContent":["import { base_context, store } from '../libs/store/store';\nimport type { Resource } from './interfaces';\n\nconst AttributeBinderMixin = {\n name: 'attribute-binder-mixin',\n use: [],\n initialState: {\n bindedAttributes: null\n },\n created() {\n this.bindedAttributes = {};\n },\n /**\n * Reset attributes values\n */\n resetAttributesData() {\n for (let attr of Object.keys(this.bindedAttributes)) {\n this.element.setAttribute(attr, this.bindedAttributes[attr]);\n }\n },\n /**\n * Replace store://XXX attributes by corresponding data\n * @param reset - set to false if no need to reset data\n */\n async replaceAttributesData(reset = true) {\n if (reset) this.resetAttributesData();\n\n const oldAttributes: any = Array.from(this.element.attributes) // transform NamedNodeMap in object\n .reduce((obj: any, attr: any) => {\n // Keep only attributes starting with `store://...`\n if (!attr.value.match(/^store:\\/\\/(resource|container|user)/)) return { ...obj }\n\n // Save attr for reset later\n if (!this.bindedAttributes[attr.name]) this.bindedAttributes[attr.name] = attr.value;\n\n return {\n ...obj,\n [attr.name]: attr.value, // add \"key: value\"\n };\n }, {});\n\n const newAttributes = await this.transformAttributes({ ...oldAttributes }, this.resource); // generate new attributes\n\n for (let attr of Object.keys(newAttributes)) { // set attributes on element\n if (oldAttributes[attr] == newAttributes[attr]) continue; // only if it changed\n this.element.setAttribute(attr, newAttributes[attr]);\n }\n },\n\n /**\n * Transform attributes from `store://...` to their actual value\n * @param attributes - object representing attributes of an element\n * @param resource - resource to use to resolve attributes\n * @returns - object representing attributes of an element with resolved values\n */\n async transformAttributes(attributes: object, resource: Resource) {\n const isContainer = resource && resource.isContainer();\n\n for (let attr of Object.keys(attributes)) {\n const value = attributes[attr];\n // Avoid error if value is a number\n if (typeof value === 'string') {\n // Replace attribute value\n if (!isContainer && resource && value.startsWith('store://resource')) { // RESOURCE\n let path = value.replace('store://resource.', '');\n attributes[attr] = resource ? await resource[path] : '';\n } else if (isContainer && resource && value.startsWith('store://container')) { // CONTAINER\n let path = value.replace('store://container.', '');\n attributes[attr] = resource ? await resource[path] : '';\n } else if (value.startsWith('store://user')) { // USER\n const userId = await this.retry(this.getUser.bind(this)); // retry until sibAuth is defined\n const user = userId && userId['@id'] ? await store.getData(userId['@id'], this.context || base_context) : null;\n if (!user) {\n attributes[attr] = '';\n continue;\n }\n let path = value.replace('store://user.', '');\n attributes[attr] = user ? await user[path] : '';\n }\n }\n }\n return attributes;\n },\n\n /**\n * Returns logged in user from sib-auth\n * @returns userId\n */\n async getUser() {\n const sibAuth: any = document.querySelector('sib-auth');\n return sibAuth.getUser();\n },\n\n /**\n * Retry [fn] for [maxRetries] times every [ms]\n * @param fn\n * @param ms\n * @param maxRetries\n * @returns\n */\n async retry(fn: Function, ms = 200, maxRetries = 5) {\n return new Promise((resolve, reject) => {\n let retries = 0;\n fn().then(resolve).catch(() => {\n setTimeout(() => {\n ++retries;\n if (retries == maxRetries) return reject();\n this.retry(fn, ms).then(resolve);\n }, ms);\n });\n });\n }\n}\n\nexport {\n AttributeBinderMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["contextMixin.ts"],"names":["base_context","ContextMixin","name","use","attributes","extraContext","type","String","default","context","extra_context","extraContextElement","document","getElementById","querySelector","JSON","parse","textContent"],"mappings":"AAAA,SAASA,YAAT,QAA6B,qBAA7B;AAEA,MAAMC,YAAY,GAAG;AACnBC,EAAAA,IAAI,EAAE,aADa;AAEnBC,EAAAA,GAAG,EAAE,EAFc;AAGnBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,YAAY,EAAE;AACZC,MAAAA,IAAI,EAAEC,MADM;AAEZC,MAAAA,OAAO,EAAE;AAFG;AADJ,GAHO;;AASnB,MAAIC,OAAJ,GAAsB;AACpB,WAAO,EAAE,GAAGT,YAAL;AAAmB,SAAG,KAAKU;AAA3B,KAAP;AACD,GAXkB;;AAYnB,MAAIA,aAAJ,GAA4B;AAC1B,QAAIC,mBAAmB,GAAG,KAAKN,YAAL,GAC1BO,QAAQ,CAACC,cAAT,CAAwB,KAAKR,YAA7B,CAD0B,GACmB;AAC7CO,IAAAA,QAAQ,CAACE,aAAT,CAAuB,wBAAvB,CAFA,CAD0B,CAGwB;;AAElD,QAAIH,mBAAJ,EAAyB,OAAOI,IAAI,CAACC,KAAL,CAAWL,mBAAmB,CAACM,WAApB,IAAmC,IAA9C,CAAP;AACzB,WAAO,EAAP;AACD;;AAnBkB,CAArB;AAsBA,SACEhB,YADF","sourcesContent":["import { base_context } from '../libs/store/store';\n\nconst ContextMixin = {\n name: 'store-mixin',\n use: [],\n attributes: {\n extraContext: {\n type: String,\n default: null\n },\n },\n get context(): object {\n return { ...base_context, ...this.extra_context };\n },\n get extra_context(): object {\n let extraContextElement = this.extraContext ?\n document.getElementById(this.extraContext) : // take element extra context first\n document.querySelector('[data-default-context]'); // ... or look for a default extra context\n\n if (extraContextElement) return JSON.parse(extraContextElement.textContent || \"{}\");\n return {};\n },\n};\n\nexport {\n ContextMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["counterMixin.ts"],"names":["html","unsafeHTML","evalTemplateString","CounterMixin","name","use","attributes","counterTemplate","type","String","default","initialState","counter","parentCounterDiv","attached","listPostProcessors","push","countResources","bind","resources","div","context","initParentCounterDiv","renderCallbacks","template","renderCounter","length","parent","nextProcessor","shift","document","createElement","element","insertBefore","resourceNumber","htmlCounter","e","console","error","Error"],"mappings":";;;;;;;;;;;;AAAA,SAASA,IAAT,QAAqB,UAArB;AACA,SAASC,UAAT,QAA2B,iCAA3B;AACA,SAASC,kBAAT,QAAmC,iBAAnC;AAEA,MAAMC,YAAY,GAAG;AACnBC,EAAAA,IAAI,EAAE,eADa;AAEnBC,EAAAA,GAAG,EAAE,EAFc;AAGnBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,eAAe,EAAE;AACfC,MAAAA,IAAI,EAAEC,MADS;AAEfC,MAAAA,OAAO,EAAE;AAFM;AADP,GAHO;AASnBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,OAAO,EAAE,IADG;AAEZC,IAAAA,gBAAgB,EAAE;AAFN,GATK;;AAanBC,EAAAA,QAAQ,GAAG;AACT,SAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,KAAKC,cAAL,CAAoBC,IAApB,CAAyB,IAAzB,CAA7B;AACD,GAfkB;;AAgBnB,QAAMD,cAAN,CAAqBE,SAArB,EAA0CJ,kBAA1C,EAA0EK,GAA1E,EAA4FC,OAA5F,EAA6G;AAC3G,QAAI,KAAKd,eAAT,EAA0B;AACxB,WAAKe,oBAAL,CAA0BF,GAA1B;AACA,WAAKG,eAAL,CAAqBP,IAArB,CAA0B;AAAE;AAC1BQ,QAAAA,QAAQ,EAAE,MAAM,KAAKC,aAAL,CAAmBN,SAAS,CAACO,MAA7B,CADQ;AAExBC,QAAAA,MAAM,EAAE,KAAKd;AAFW,OAA1B;AAID;;AAED,UAAMe,aAAa,GAAGb,kBAAkB,CAACc,KAAnB,EAAtB;AACA,QAAID,aAAJ,EAAmB,MAAMA,aAAa,CAACT,SAAD,EAAYJ,kBAAZ,EAAgCK,GAAhC,EAAqCC,OAArC,CAAnB;AACpB,GA3BkB;;AA4BnB;AACF;AACA;AACA;AACEC,EAAAA,oBAAoB,CAACF,GAAD,EAAmB;AACrC,QAAI,KAAKP,gBAAT,EAA2B;AAC3B,SAAKA,gBAAL,GAAwBiB,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAxB;AACA,SAAKC,OAAL,CAAaC,YAAb,CAA0B,KAAKpB,gBAA/B,EAAiDO,GAAjD;AACD,GApCkB;;AAqCnB,QAAMK,aAAN,CAAoBS,cAApB,EAA4C;AAC1C,QAAIC,WAAJ;;AACA,QAAI;AACFA,MAAAA,WAAW,GAAG,MAAMjC,kBAAkB,CAAC,KAAKK,eAAN,EAAuB;AAC3DK,QAAAA,OAAO,EAAEsB;AADkD,OAAvB,CAAtC;AAGD,KAJD,CAIE,OAAOE,CAAP,EAAU;AACVC,MAAAA,OAAO,CAACC,KAAR,CAAc,IAAIC,KAAJ,CAAU,2BAAV,CAAd,EAAsDH,CAAtD;AACA,YAAMA,CAAN;AACD;;AACD,WAAOpC,IAAP,oBAAcC,UAAU,CAACkC,WAAD,CAAxB;AACD;;AAhDkB,CAArB;AAmDA,SACEhC,YADF","sourcesContent":["import { html } from 'lit-html';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html';\nimport { evalTemplateString } from '../libs/helpers';\n\nconst CounterMixin = {\n name: 'counter-mixin',\n use: [],\n attributes: {\n counterTemplate: {\n type: String,\n default: null\n },\n },\n initialState: {\n counter: null,\n parentCounterDiv: null,\n },\n attached() {\n this.listPostProcessors.push(this.countResources.bind(this));\n },\n async countResources(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string) {\n if (this.counterTemplate) {\n this.initParentCounterDiv(div);\n this.renderCallbacks.push({ // add counter template to render callback\n template: await this.renderCounter(resources.length),\n parent: this.parentCounterDiv\n });\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);\n },\n /**\n * Create the parent div of the counter in the component.\n * @param div: parent div where to insert the counter div\n */\n initParentCounterDiv(div: HTMLElement) {\n if (this.parentCounterDiv) return;\n this.parentCounterDiv = document.createElement('div');\n this.element.insertBefore(this.parentCounterDiv, div);\n },\n async renderCounter(resourceNumber: number) {\n let htmlCounter: string;\n try {\n htmlCounter = await evalTemplateString(this.counterTemplate, {\n counter: resourceNumber,\n });\n } catch (e) {\n console.error(new Error('error in counter-template'), e);\n throw e;\n }\n return html`${unsafeHTML(htmlCounter)}`;\n }\n}\n\nexport {\n CounterMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["federationMixin.ts"],"names":["store","FederationMixin","name","use","initialState","containerFetched","attached","listPostProcessors","push","fetchSources","bind","resources","div","context","newResources","getResources","Set","nextProcessor","shift","getChildResources","res","isContainer","containerId","includes","resourcesFetched","fetchSource","Promise","all","map","cachedContainer","get","clearCache","container","getData"],"mappings":"AAAA,SAASA,KAAT,QAAsB,qBAAtB;AAGA,MAAMC,eAAe,GAAG;AACtBC,EAAAA,IAAI,EAAE,kBADgB;AAEtBC,EAAAA,GAAG,EAAE,EAFiB;AAGtBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,gBAAgB,EAAE;AADN,GAHQ;;AAMtBC,EAAAA,QAAQ,GAAS;AACf,SAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,KAAKC,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB,CAA7B;AACD,GARqB;;AAStB,QAAMD,YAAN,CAAmBE,SAAnB,EAA0CJ,kBAA1C,EAA0EK,GAA1E,EAA4FC,OAA5F,EAA6G;AAC3G,SAAKR,gBAAL,GAAwB,EAAxB;AACA,QAAIS,YAAwB,GAAG,MAAM,KAAKC,YAAL,CAAkBJ,SAAlB,CAArC;AACAG,IAAAA,YAAY,GAAG,CAAC,GAAG,IAAIE,GAAJ,CAAQF,YAAR,CAAJ,CAAf,CAH2G,CAGhE;;AAE3C,UAAMG,aAAa,GAAGV,kBAAkB,CAACW,KAAnB,EAAtB;AACA,QAAGD,aAAH,EAAkB,MAAMA,aAAa,CAACH,YAAD,EAAeP,kBAAf,EAAmCK,GAAnC,EAAwCC,OAAxC,CAAnB;AACnB,GAhBqB;;AAiBtB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iE,CAKC;;AAClE,WAAOmB,SAAS,GAAGA,SAAS,CAAC,cAAD,CAAZ,GAA+B,IAA/C;AACD;;AA9CqB,CAAxB;AAiDA,SACE/B,eADF","sourcesContent":["import { store } from '../libs/store/store';\nimport type { Resource } from './interfaces';\n\nconst FederationMixin = {\n name: 'federation-mixin',\n use: [],\n initialState: {\n containerFetched: null\n },\n attached(): void {\n this.listPostProcessors.push(this.fetchSources.bind(this));\n },\n async fetchSources(resources: Resource[], listPostProcessors: Function[], div: HTMLElement, context: string) {\n this.containerFetched = [];\n let newResources: Resource[] = await this.getResources(resources);\n newResources = [...new Set(newResources)]; // remove possible duplicates\n\n const nextProcessor = listPostProcessors.shift();\n if(nextProcessor) await nextProcessor(newResources, listPostProcessors, div, context);\n },\n async getResources(resources: Resource[]): Promise<Resource[]> {\n const newResources: Resource[] = [];\n\n const getChildResources = async (res: Resource) => {\n if (!res) return;\n if (res.isContainer()) { // if this is a container\n const containerId = res['@id'];\n if (!this.containerFetched.includes(containerId)) { // prevent from including twice the same source\n this.containerFetched.push(containerId);\n\n const resourcesFetched = await this.fetchSource(containerId); // fetch the resources of this container\n if (resourcesFetched) newResources.push(...(await this.getResources(resourcesFetched))); // Add content of source to array...\n }\n } else {\n newResources.push(res); // Or resource directly if not a container\n }\n }\n\n await Promise.all(resources.map(res => getChildResources(res)));\n return newResources;\n },\n\n async fetchSource(containerId: string): Promise<Resource[] | null> {\n const cachedContainer = store.get(containerId); // find container in cache\n if (!cachedContainer || cachedContainer['ldp:contains'] === null) { // if container not fetched\n store.clearCache(containerId); // empty cache\n }\n const container = await store.getData(containerId, this.context); // and fetch it\n return container ? container['ldp:contains'] : null;\n },\n}\n\nexport {\n FederationMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["filterMixin.ts"],"names":["compare","parseFieldsString","FilterMixin","name","use","initialState","searchCount","attributes","searchFields","type","String","default","filteredBy","callback","newValue","searchForm","getAttribute","component","detach","populate","created","Map","element","addEventListener","window","document","contains","updateAutoRanges","attached","listPostProcessors","push","filterCallback","bind","filters","value","filterList","resources","div","context","has","set","createFilter","filteredResources","Promise","all","map","matchFilters","filter","_v","index","nextProcessor","shift","get","resource","empty","matchValue","subject","query","list","length","v","q","isContainer","ret","resolve","matchFilter","fields","isSet","getSet","isSearchField","getSearchField","reduce","initial","field","Object","keys","getValuesOfField","arrayOfDataObjects","arrayOfDataIds","obj","nextArrayOfObjects","console","warn","nextArrayOfIds","getElementById","createElement","attach","toggleAttribute","searchAttributes","Array","from","attr","startsWith","replace","forEach","setAttribute","insertBefore","firstChild","hasAttribute"],"mappings":"AAAA,SAASA,OAAT,EAAkBC,iBAAlB,QAA2C,iBAA3C;AAEA,MAAMC,WAAW,GAAG;AAClBC,EAAAA,IAAI,EAAE,cADY;AAElBC,EAAAA,GAAG,EAAE,EAFa;AAGlBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,WAAW,EAAE;AADD,GAHI;AAMlBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,YAAY,EAAE;AACZC,MAAAA,IAAI,EAAEC,MADM;AAEZC,MAAAA,OAAO,EAAE;AAFG,KADJ;AAKVC,IAAAA,UAAU,EAAE;AACVH,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE,IAFC;;AAGVE,MAAAA,QAAQ,CAACC,QAAD,EAAmB;AACzB;AACA,YAAIA,QAAQ,IAAI,KAAKC,UAAjB,IAA+BD,QAAQ,KAAK,KAAKC,UAAL,CAAgBC,YAAhB,CAA6B,IAA7B,CAAhD,EAAoF;AAClF,eAAKD,UAAL,CAAgBE,SAAhB,CAA0BC,MAA1B,CAAiC,IAAjC;AACA,eAAKH,UAAL,GAAkB,IAAlB;AACA,eAAKI,QAAL;AACD;AACF;;AAVS;AALF,GANM;;AAwBlBC,EAAAA,OAAO,GAAG;AACR,SAAKd,WAAL,GAAmB,IAAIe,GAAJ,EAAnB;AACA,SAAKC,OAAL,CAAaC,gBAAb,CAA8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ACAkD,EAAAA,aAAa,CAACI,KAAD,EAAgB;AAC3B,WAAO,KAAK1D,UAAL,CAAgBmF,YAAhB,CAA6B,YAAYzB,KAAzC,CAAP;AACD,GApKiB;;AAqKlBH,EAAAA,cAAc,CAACG,KAAD,EAA0B;AACtC,WAAOxE,iBAAiB,CAAC,KAAKc,UAAL,CAAgBC,YAAhB,CAA6B,YAAYyD,KAAzC,CAAD,CAAxB;AACD;;AAvKiB,CAApB;AA0KA,SACEvE,WADF","sourcesContent":["import { compare, parseFieldsString } from '../libs/helpers';\n\nconst FilterMixin = {\n name: 'filter-mixin',\n use: [],\n initialState: {\n searchCount: null,\n },\n attributes: {\n searchFields: {\n type: String,\n default: null\n },\n filteredBy: {\n type: String,\n default: null,\n callback(newValue: string) {\n // if we change search form, re-populate\n if (newValue && this.searchForm && newValue !== this.searchForm.getAttribute('id')) {\n this.searchForm.component.detach(this);\n this.searchForm = null;\n this.populate();\n }\n }\n }\n },\n created() {\n this.searchCount = new Map();\n this.element.addEventListener('populate', () => {\n if (!window.document.contains(this.element)) return;\n this.searchForm?.component.updateAutoRanges();\n })\n },\n attached(): void {\n this.listPostProcessors.push(this.filterCallback.bind(this));\n },\n get filters(): object {\n return this.searchForm?.component.value ?? {};\n },\n set filters(filters) {\n this.searchForm.component.value = filters;\n this.filterList();\n },\n async filterCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n if (this.filteredBy || this.searchFields) {\n if (!this.searchCount.has(context)) this.searchCount.set(context, 1);\n if (!this.searchForm) await this.createFilter(context);\n const filteredResources = await Promise.all(resources.map(this.matchFilters.bind(this)));\n resources =\tresources.filter((_v, index) => filteredResources[index]);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if(nextProcessor) await nextProcessor(resources, listPostProcessors, div, context + (this.searchCount.get(context) || ''));\n },\n async filterList(context: string): Promise<void> {\n this.searchCount.set(context, this.searchCount.get(context) + 1);\n if (!this.resource) return;\n this.empty();\n await this.populate();\n },\n async matchValue(subject, query): Promise<boolean> {\n if (subject == null && query.value === '') return true; // filter not set and subject not existing -> ignore filter\n if (subject == null) return false; // property does not exist on resource\n // Filter on a container\n if (query.list) {\n if(query.value.length === 0) return true;\n for(const v of query.value) {\n const q = {\n type: query.type,\n value: v,\n }\n if(await this.matchValue(subject, q)) return true;\n }\n return false;\n }\n if (subject.isContainer?.()) {\n let ret = Promise.resolve(query.value === ''); // if no query, return a match\n for (const value of subject['ldp:contains']) {\n ret = await ret || await this.matchValue(value, query)\n }\n return ret;\n }\n return compare[query.type](subject, query.value);\n },\n async matchFilter(resource: object, filter: string, query: any): Promise<boolean> {\n let fields: string[] = [];\n if (this.isSet(filter)) fields = this.getSet(filter);\n else if (this.isSearchField(filter)) fields = this.getSearchField(filter);\n\n // search on 1 field\n if (fields.length == 0)\n return this.matchValue(await resource[filter], query);\n\n // search on multiple fields\n return fields.reduce( // return true if it matches at least one of the fields\n async (initial, field) => await initial || await this.matchFilter(resource, field, query),\n Promise.resolve(false),\n );\n },\n async matchFilters(resource: object): Promise<boolean> {\n //return true if all filters values are contained in the corresponding field of the resource\n return Object.keys(this.filters).reduce(\n async (initial, filter) =>\n await initial && await this.matchFilter(resource, filter, this.filters[filter]),\n Promise.resolve(true)\n );\n },\n async getValuesOfField(field: string) {\n const arrayOfDataObjects = this.resource['ldp:contains'];\n const arrayOfDataIds: string[] = [];\n for (const obj of arrayOfDataObjects) {\n // for each element, if it's an object, catch all elements in 'ldp:contains' key\n const nextArrayOfObjects = await obj[field];\n if (!nextArrayOfObjects) continue;\n\n if (typeof nextArrayOfObjects !== \"object\") {\n console.warn(`The format value of ${field} is not suitable with auto-range-[field] attribute`);\n continue;\n }\n\n const nextArrayOfIds = nextArrayOfObjects['ldp:contains'];\n for (const obj of nextArrayOfIds) {\n // catch each element id\n arrayOfDataIds.push(obj['@id']);\n }\n if (nextArrayOfObjects['@type'] !== 'ldp:Container') {\n // if no element in 'ldp:contains', catch object id\n arrayOfDataIds.push(nextArrayOfObjects['@id']);\n }\n }\n return arrayOfDataIds;\n },\n async createFilter(context: string): Promise<void> {\n const filteredBy = this.filteredBy;\n if (filteredBy != null) {\n this.searchForm = document.getElementById(filteredBy)\n if (!this.searchForm) throw `#${filteredBy} is not in DOM`;\n } else {\n this.searchForm = document.createElement(`solid-form-search`);\n }\n this.searchForm.component.attach(this);\n this.searchForm.addEventListener('formChange', () => {\n this.filterList(context);\n });\n this.searchForm.toggleAttribute('naked', true);\n\n if (filteredBy) return;\n\n //pass attributes to search form\n const searchAttributes = Array.from((this.element as Element).attributes)\n .filter(attr => attr['name'].startsWith('search-'))\n .map(attr => ({\n name: attr['name'].replace('search-', ''),\n value: attr['value'],\n }));\n\n searchAttributes.forEach(({name, value}) => {\n this.searchForm.setAttribute(name, value);\n });\n\n this.element.insertBefore(this.searchForm, this.element.firstChild);\n await this.searchForm.component.populate();\n },\n // Search fields\n isSearchField(field: string) {\n return this.searchForm.hasAttribute('search-' + field);\n },\n getSearchField(field: string): string[] {\n return parseFieldsString(this.searchForm.getAttribute('search-' + field));\n },\n}\n\nexport {\n FilterMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["grouperMixin.ts"],"names":["GrouperMixin","name","use","attributes","groupBy","type","String","default","groupWidget","groupClass","attached","listPostProcessors","push","groupResources","bind","resources","div","context","nextProcessor","shift","groups","resource","valueGroup","parents","Object","keys","map","g","group","parent","renderGroup","groupName","groupElt","element","querySelector","document","createElement","setAttribute","component","render","appendChild"],"mappings":"AAAA,MAAMA,YAAY,GAAG;AACnBC,EAAAA,IAAI,EAAE,eADa;AAEnBC,EAAAA,GAAG,EAAE,EAFc;AAGnBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,OAAO,EAAE;AACPC,MAAAA,IAAI,EAAEC,MADC;AAEPC,MAAAA,OAAO,EAAE;AAFF,KADC;AAKVC,IAAAA,WAAW,EAAE;AACXH,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE;A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AM,CAACQ,KAAD,CAAN,CAAcb,SADsB,EACX;AACzB,SAAC,GAAGJ,kBAAJ,CAFoC,EAEX;AACzBkB,QAAAA,MAHoC,EAG5B;AACRZ,QAAAA,OAAO,GAAG,GAAV,GAAgBW,KAJoB,CAAnB;AAMpB;AACF,KAnBD,MAmBO;AACL,UAAIV,aAAJ,EAAmB,MAAMA,aAAa,CACpCH,SADoC,EAEpCJ,kBAFoC,EAGpCK,GAHoC,EAIpCC,OAJoC,CAAnB;AAMpB;AACF,GAjDkB;;AAkDnB;AACF;AACA;AACA;AACEa,EAAAA,WAAW,CAACC,SAAD,EAAoBf,GAApB,EAAsC;AAC/C,QAAIgB,QAAQ,GAAG,KAAKC,OAAL,CAAaC,aAAb,WAA8B,KAAK1B,WAAnC,sBAAyDuB,SAAzD,SAAf;;AACA,QAAI,CAACC,QAAL,EAAe;AACbA,MAAAA,QAAQ,GAAGG,QAAQ,CAACC,aAAT,CAAuB,KAAK5B,WAA5B,CAAX;AACAwB,MAAAA,QAAQ,CAACK,YAAT,CAAsB,OAAtB,EAA+BN,SAA/B;AACA,UAAI,KAAKtB,UAAT,EAAqBuB,QAAQ,CAACK,YAAT,CAAsB,OAAtB,EAA+B,KAAK5B,UAApC;AACrB,UAAIuB,QAAQ,CAACM,SAAb,EAAwBN,QAAQ,CAACM,SAAT,CAAmBC,MAAnB,GAJX,CAIwC;;AACrDvB,MAAAA,GAAG,CAACwB,WAAJ,CAAgBR,QAAhB,EALa,CAKc;AAC5B;;AACD,WAAOA,QAAQ,CAACE,aAAT,CAAuB,gBAAvB,KAA4CF,QAAnD,CAT+C,CASc;AAC9D;;AAhEkB,CAArB;AAmEA,SACEhC,YADF","sourcesContent":["const GrouperMixin = {\n name: 'grouper-mixin',\n use: [],\n attributes: {\n groupBy: {\n type: String,\n default: null,\n },\n groupWidget: {\n type: String,\n default: 'solid-group-default'\n },\n groupClass: {\n type: String,\n default: ''\n }\n },\n attached() {\n this.listPostProcessors.push(this.groupResources.bind(this));\n },\n async groupResources(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string) {\n const nextProcessor = listPostProcessors.shift();\n if (this.groupBy) {\n let groups = {};\n for (let resource of resources) {\n const valueGroup = await resource[this.groupBy];\n if (valueGroup == null) continue;\n if (!groups[valueGroup]) groups[valueGroup] = { resources: [] }; // if no group yet, we create one...\n groups[valueGroup].resources.push(resource) // ...and push corresponding resource into it\n }\n\n // For each group, get group widget and call next processors\n const parents = Object.keys(groups).map(g => ({ group: g, parent: this.renderGroup(g, div) }));\n for (let { group, parent } of parents) {\n if (nextProcessor) await nextProcessor(\n groups[group].resources, // give only resources from group\n [...listPostProcessors], // copy post processors\n parent, // parent is group widget\n context + \"_\" + group\n );\n }\n } else {\n if (nextProcessor) await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n }\n },\n /**\n * Create a group widget or find if it already exists\n * @param groupName\n */\n renderGroup(groupName: string, div: HTMLElement) {\n let groupElt = this.element.querySelector(`${this.groupWidget}[value=\"${groupName}\"]`);\n if (!groupElt) {\n groupElt = document.createElement(this.groupWidget);\n groupElt.setAttribute('value', groupName);\n if (this.groupClass) groupElt.setAttribute('class', this.groupClass);\n if (groupElt.component) groupElt.component.render(); // Force the rendering of the widget\n div.appendChild(groupElt); // and append it to the parent div\n }\n return groupElt.querySelector('[data-content]') || groupElt; // return the node where to insert content\n }\n}\n\nexport {\n GrouperMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["highlighterMixin.ts"],"names":["HighlighterMixin","name","use","attached","listPostProcessors","push","hightlightCallback","bind","resources","div","context","attr","element","attributes","startsWith","field","split","Promise","all","map","resource","sortingKey","proxy","sortHighlighted","value","nextProcessor","shift","index","res","entries","splice"],"mappings":"AAAA,MAAMA,gBAAgB,GAAG;AACvBC,EAAAA,IAAI,EAAE,mBADiB;AAEvBC,EAAAA,GAAG,EAAE,EAFkB;;AAGvBC,EAAAA,QAAQ,GAAS;AACf,SAAKC,kBAAL,C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EAAzB,EAA8C;AAC5C,UAAID,GAAG,CAACb,KAAD,CAAH,IAAca,GAAG,CAACb,KAAD,CAAH,IAAcS,KAAhC,EAAuC;AACrC;AACAhB,QAAAA,SAAS,CAACsB,MAAV,CAAiB,CAAjB,EAAoB,CAApB,EAAuBtB,SAAS,CAACsB,MAAV,CAAiBH,KAAjB,EAAwB,CAAxB,EAA2B,CAA3B,CAAvB,EAFqC,CAEkB;AACxD;AACF;;AACD,WAAOnB,SAAP;AACD;;AA/BsB,CAAzB;AAkCA,SACER,gBADF","sourcesContent":["const HighlighterMixin = {\n name: 'highlighter-mixin',\n use: [],\n attached(): void {\n this.listPostProcessors.push(this.hightlightCallback.bind(this));\n },\n async hightlightCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n for (let attr of this.element.attributes) {\n if (attr.name.startsWith('highlight-')) {\n const field = attr.name.split('highlight-')[1];\n resources = await Promise.all(resources.map(async (resource) => ({\n sortingKey: await resource[field], // fetch sorting value\n proxy: resource // and keep proxy\n })));\n resources = this.sortHighlighted(resources, \"sortingKey\", attr.value); // highlight element\n resources = resources.map(resource => (<any>resource).proxy); // and re-transform in arra of resources\n }\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);\n },\n\n sortHighlighted(resources, field, value) {\n for (let [index, res] of resources.entries()) {\n if (res[field] && res[field] == value) {\n // put the current element at the beginning of the array\n resources.splice(0, 0, resources.splice(index, 1)[0]); // TODO : test with sort\n }\n }\n return resources\n }\n}\n\nexport {\n HighlighterMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["interfaces.ts"],"names":["WidgetType"],"mappings":"AAAA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,KAAAA,U","sourcesContent":["export enum WidgetType {\n CUSTOM = \"custom\",\n USER = \"user\",\n NATIVE = \"native\",\n}\n\nexport interface WidgetInterface {\n tagName: String\n type: WidgetType\n}\n\nexport interface Resource {\n '@id': string\n clientContext: object\n isContainer: Function\n isFullResource: Function\n properties: string[]\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["listMixin.ts"],"names":["html","render","preHTML","ifDefined","ListMixin","name","use","attributes","emptyWidget","type","String","default","emptyValue","initialState","listPostProcessors","renderCallbacks","created","appendSingleElt","parent","appendChildElt","resource","setElementAttribute","attr","containerAttribute","resourceAttribute","element","removeAttribute","setAttribute","populate","div","isContainer","push","renderDOM","bind","handleEmptyWidget","nextProcessor","shift","dataSrc","renderCallback","template","resources","context","emptyWidgetTemplate","emptyWrapper","document","createElement","appendChild","length"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,IAAT,EAAeC,MAAf,QAA6B,UAA7B;AACA,SAASC,OAAT,QAAwB,qBAAxB;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,MAAMC,SAAS,GAAG;AAChBC,EAAAA,IAAI,EAAE,YADU;AAEhBC,EAAAA,GAAG,EAAE,EAFW;AAGhBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,WAAW,EAAE;AACXC,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE;AAFE,KADH;AAKVC,IAAAA,UAAU,EAAE;AACVH,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE;AAFC;AALF,GAHI;AAahBE,EAAAA,YAAY,EAAE;AACZ;AACAC,IAAAA,kBAAkB,EAAE,EAFR;AAGZ;AACAC,IAAAA,eAAe,EAAE;AAJL,GAbE;;AAmBhBC,EAAAA,OAAO,GAAG;AACR,SAAKF,kBAAL,GAA0B,EAA1B;AACA,SAAKC,eAAL,GAAuB,EAAvB;AACD,GAtBe;;AAuBhBE,EAAAA,eAAe,CAACC,MAAD,EAA4B;AACzC,SAAKC,cAAL,CAAoB,KAAKC,QAAL,CAAc,KAAd,CA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aAAJ,EACE,MAAMA,aAAa,CACjBK,SADiB,EAEjB1B,kBAFiB,EAGjBe,GAHiB,EAIjBY,OAJiB,CAAnB;AAMH;;AApIe,CAAlB;AAuIA,SAASrC,SAAT","sourcesContent":["import { html, render } from 'lit-html';\nimport { preHTML } from '../libs/lit-helpers';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst ListMixin = {\n name: 'list-mixin',\n use: [],\n attributes: {\n emptyWidget: {\n type: String,\n default: null,\n },\n emptyValue: {\n type: String,\n default: '',\n },\n },\n initialState: {\n // Processors functions to execute on the list before rendering\n listPostProcessors: [],\n // Rendering to execute after all the processors have been executed\n renderCallbacks: [],\n },\n created() {\n this.listPostProcessors = [];\n this.renderCallbacks = [];\n },\n appendSingleElt(parent: HTMLElement): void {\n this.appendChildElt(this.resource['@id'], parent);\n },\n setElementAttribute(attr: 'resource' | 'container') {\n const containerAttribute = \"solid-container\";\n const resourceAttribute = \"solid-resource\";\n if (attr === \"resource\") {\n this.element.removeAttribute(containerAttribute);\n this.element.setAttribute(resourceAttribute, \"\");\n } else {\n this.element.removeAttribute(resourceAttribute);\n this.element.setAttribute(containerAttribute, \"\")\n }\n },\n async populate(): Promise<void> {\n const div = this.div;\n if (!this.resource) return;\n\n // Not a container but a single resource\n if (!this.resource.isContainer()) {\n this.setElementAttribute(\"resource\");\n this.appendSingleElt(div);\n return;\n }\n\n this.setElementAttribute(\"container\");\n const listPostProcessors = [...this.listPostProcessors];\n this.renderCallbacks = [];\n listPostProcessors.push(this.renderDOM.bind(this));\n listPostProcessors.push(this.handleEmptyWidget.bind(this));\n\n // Execute the first post-processor of the list\n const nextProcessor = listPostProcessors.shift();\n await nextProcessor(\n this.resource['ldp:contains'],\n listPostProcessors,\n div,\n this.dataSrc,\n );\n\n // Execute the render callbacks\n for (const renderCallback of this.renderCallbacks) {\n // Render the template in the given parent element\n render(renderCallback.template, renderCallback.parent);\n }\n },\n\n /**\n * Render resources in the DOM\n * @param resources\n * @param listPostProcessors\n * @param div\n * @param context\n */\n async renderDOM(\n resources: object[],\n listPostProcessors: Function[],\n div: HTMLElement,\n context: string,\n ) {\n // Create child components\n for (let resource of resources) {\n if (!resource) continue;\n this.appendChildElt(resource['@id'], div);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor)\n await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n },\n\n /**\n * Show empty widget if no resources in the list\n * @param resources\n * @param listPostProcessors\n * @param div\n * @param context\n */\n async handleEmptyWidget(\n resources: object[],\n listPostProcessors: Function[],\n div: HTMLElement,\n context: string,\n ) {\n if (this.emptyWidget) {\n const emptyWidgetTemplate = preHTML`\n <${this.emptyWidget} value=${ifDefined(this.emptyValue)}></${this.emptyWidget}>\n `\n if (!this.emptyWrapper) {\n this.emptyWrapper = document.createElement('span')\n this.element.appendChild(this.emptyWrapper)\n }\n \n render(resources.length > 0 ? html`` : emptyWidgetTemplate, this.emptyWrapper);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor)\n await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n },\n};\n\nexport { ListMixin };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["nextMixin.ts"],"names":["NextMixin","name","use","attributes","next","type","String","default","goToNext","resource","element","dispatchEvent","CustomEvent","bubbles","detail","route"],"mappings":"AAEA,MAAMA,SAAS,GAAG;AAChBC,EAAAA,IAAI,EAAE,YADU;AAEhBC,EAAAA,GAAG,EAAE,EAFW;AAGhBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,IAAI,EAAE;AACJC,MAAAA,IAAI,EAAEC,MADF;AAEJC,MAAAA,OAAO,EAAC;AAFJ;AADI,GAHI;;AAUhB;AACAC,EAAAA,QAAQ,CAACC,QAAD,EAA2B;AACjC,QAAI,KAAKL,IAAT,EAAe;AACb,WAAKM,OAAL,CAAaC,aAAb,CACE,IAAIC,WAAJ,CAAgB,mBAAhB,EAAqC;AACnCC,QAAAA,OAAO,EAAE,IAD0B;AAEnCC,QAAAA,MAAM,EAAE;AAAEC,UAAAA,KAAK,EAAE,KAAKX,IAAd;AAAoBK,UAAAA,QAAQ,EAAEA;AAA9B;AAF2B,OAArC,CADF;AAMD;AACF;;AApBe,CAAlB;AAuBA,SACET,SADF","sourcesContent":["import type { Resource } from \"./interfaces.js\";\n\nconst NextMixin = {\n name: 'next-mixin',\n use: [],\n attributes: {\n next: {\n type: String,\n default:''\n },\n },\n\n // Here \"even.target\" points to the content of the widgets of the children of solid-display\n goToNext(resource: Resource): void {\n if (this.next) {\n this.element.dispatchEvent(\n new CustomEvent('requestNavigation', {\n bubbles: true,\n detail: { route: this.next, resource: resource },\n }),\n );\n }\n }\n}\n\nexport {\n NextMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["paginateMixin.ts"],"names":["html","PaginateMixin","name","use","attributes","paginateBy","type","Number","default","paginateLoop","String","initialState","currentPage","created","attached","listPostProcessors","push","paginateCallback","bind","resources","div","context","parentDiv","initParentPaginationDiv","renderCallbacks","template","renderPaginationNav","getPageCount","length","parent","firstElementIndex","getCurrentPage","slice","nextProcessor","shift","getNavElement","insertNode","parentNode","querySelector","nav","document","createElement","setAttribute","appendChild","setCurrentPage","page","pageCount","shouldLoop","empty","populate","size","Math","max","ceil","toggleAttribute"],"mappings":";;;;;;;;;;;;AAAA,SAASA,IAAT,QAAqC,UAArC;AAEA,MAAMC,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,gBADc;AAEpBC,EAAAA,GAAG,EAAE,EAFe;AAGpBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,UAAU,EAAE;AACVC,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE;AAFC,KADF;AAKVC,IAAAA,YAAY,EAAE;AACZH,MAAAA,IAAI,EAAEI,MADM;AAEZF,MAAAA,OAAO,EAAE;AAFG;AALJ,GAHQ;AAapBG,EAAAA,YAAY,EAAE;AAC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;AACpB,WAAO,KAAKtC,YAAL,KAAsB,IAA7B;AACD,GAvEmB;;AAwEpB;AACF;AACA;AACA;AACA;AACEiB,EAAAA,mBAAmB,CAACoB,SAAD,EAAoBzB,OAApB,EAAqCD,GAArC,EAAuE;AACxF,SAAKe,aAAL,CAAmBf,GAAnB,EAAwBkC,eAAxB,CAAwC,QAAxC,EAAkDR,SAAS,IAAI,CAA/D;AACA,UAAMlC,WAAW,GAAG,KAAKmB,cAAL,CAAoBV,OAApB,CAApB;AAEA,WAAOrB,IAAP,oBAGgB,CAAC,KAAK+C,UAAL,EAAD,IAAsBnC,WAAW,IAAI,CAHrD,EAIa,MAAM,KAAKgC,cAAL,CAAoBhC,WAAW,GAAG,CAAlC,EAAqCS,OAArC,EAA8CyB,SAA9C,CAJnB,EAQgB,CAAC,KAAKC,UAAL,EAAD,IAAsBnC,WAAW,IAAIkC,SARrD,EASc,MAAM,KAAKF,cAAL,CAAoBhC,WAAW,GAAG,CAAlC,EAAqCS,OAArC,EAA8CyB,SAA9C,CATpB,EAY8BlC,WAZ9B,EAY4EF,MAAM,CAACoC,SAAD,CAZlF;AAeD;;AAhGmB,CAAtB;AAmGA,SACE7C,aADF","sourcesContent":["import { html, TemplateResult } from \"lit-html\";\n\nconst PaginateMixin = {\n name: 'paginate-mixin',\n use: [],\n attributes: {\n paginateBy: {\n type: Number,\n default: 0\n },\n paginateLoop: {\n type: String,\n default: null\n }\n },\n initialState: {\n currentPage: [],\n },\n created() {\n this.currentPage = [];\n },\n attached(): void {\n this.listPostProcessors.push(this.paginateCallback.bind(this));\n },\n async paginateCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string) {\n if (this.paginateBy > 0) {\n if (!this.currentPage[context]) this.currentPage[context] = 1;\n const parentDiv = this.initParentPaginationDiv(div, context);\n this.renderCallbacks.push({\n template: this.renderPaginationNav(this.getPageCount(resources.length),context,div),\n parent: parentDiv\n });\n\n const firstElementIndex = (this.getCurrentPage(context) - 1) * this.paginateBy;\n resources = resources.slice(firstElementIndex, firstElementIndex + this.paginateBy);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor) await nextProcessor(resources, listPostProcessors, div,context);\n },\n getNavElement(div: HTMLElement) {\n const insertNode = div.parentNode || div;\n return insertNode.querySelector(`nav[data-id=\"nav\"]`);\n },\n /**\n * Find nav element or create it if not existing\n * @param div - insert nav next to this div\n */\n initParentPaginationDiv(div: HTMLElement) {\n let nav = this.getNavElement(div);\n if (!nav) {\n nav = document.createElement('nav');\n nav.setAttribute('data-id', 'nav');\n const insertNode = div.parentNode || div;\n insertNode.appendChild(nav);\n }\n return nav;\n },\n getCurrentPage(context: string) {\n return this.currentPage[context];\n },\n setCurrentPage(page: number, context: string, pageCount: number): void {\n if (page < 1) page = !this.shouldLoop() ? 1 : pageCount;\n if (page > pageCount) page = !this.shouldLoop() ? pageCount : 1;\n this.currentPage[context] = page;\n this.empty();\n this.populate();\n },\n getPageCount(size: number): number {\n return Math.max(1, Math.ceil(size / this.paginateBy));\n },\n shouldLoop(): boolean {\n return this.paginateLoop !== null;\n },\n /**\n * Create pagination template\n * @param pageCount\n * @param context\n */\n renderPaginationNav(pageCount: number, context: string, div: HTMLElement): TemplateResult {\n this.getNavElement(div).toggleAttribute('hidden', pageCount <= 1);\n const currentPage = this.getCurrentPage(context);\n\n return html`\n <button\n data-id=\"prev\"\n ?disabled=${!this.shouldLoop() && currentPage <= 1}\n @click=${() => this.setCurrentPage(currentPage - 1, context, pageCount)}\n >←</button>\n <button\n data-id=\"next\"\n ?disabled=${!this.shouldLoop() && currentPage >= pageCount}\n @click=${ () => this.setCurrentPage(currentPage + 1, context, pageCount)}\n >→</button>\n <span>\n <span data-id=\"current\">${currentPage}</span> / <span data-id=\"count\">${String(pageCount)}</span>\n </span>\n `;\n },\n}\n\nexport {\n PaginateMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["requiredMixin.ts"],"names":["RequiredMixin","name","use","attached","listPostProcessors","push","requiredResources","bind","resources","div","context","displays","requiredFields","Array","from","element","attributes","filter","attr","startsWith","map","replace","length","resource","hasProps","field","nextProcessor","shift"],"mappings":"AAAA,MAAMA,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,gBADc;AAEpBC,EAAAA,GAAG,EAAE,EAFe;;AAGpBC,EAAAA,QAAQ,GAAS;AACf,SAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,KAAKC,iBAAL,CAAuBC,IAAvB,CAA4B,IAA5B,CAA7B;AACD,GALmB;;AAMpB,QAAMD,iBAAN,CAAwBE,SAAxB,EAA6CJ,kBAA7C,EAA6EK,GAA7E,EAA+FC,OAA/F,EAA+H;AAC7H,UAAMC,QAAe,GAAG,EAAxB;AACA,UAAMC,cAAc,GAAGC,KAAK,CAACC,IAAN,CAAY,KAAKC,OAAN,CAA0BC,UAArC,EAAiDC,MAAjD,CAAwDC,IAAI,IAAIA,IAAI,CAACjB,IAAL,CAAUkB,UAAV,CAAqB,WAArB,CAAhE,EACpBC,GADoB,CAChBF,IAAI,IAAIA,IAAI,CAAC,MAAD,CAAJ,CAAaG,OAAb,CAAqB,WAArB,EAAkC,EAAlC,CADQ,CAAvB;;AAGA,QAAIT,cAAc,CAACU,MAAnB,EAA2B;AACzB,WAAK,IAAIC,QAAT,IAAqBf,SAArB,EAAgC;AAC9B,YAAIgB,QAAQ,GAAG,IAAf;;AACA,aAAI,IAAIC,KAAR,IAAiBb,cAAjB,EAAiC;AAC/B,cAAI,OAAMW,QAAQ,CAACE,KAAD,CAAd,KAAyB,IAAzB,IAAiC,OAAMF,QAAQ,CAACE,KAAD,CAAd,KAAyB,EAA9D,EAAkE;AAChED,YAAAA,QAAQ,GAAG,KAAX;AACA;AACD;AACF;;AACD,YAAIA,QAAJ,EAAcb,QAAQ,CAACN,IAAT,CAAckB,QAAd;AACf;AACF;;AACD,UAAMG,aAAa,GAAGtB,kBAAkB,CAACuB,KAAnB,EAAtB;AACA,QAAID,aAAJ,EAAmB,MAAMA,aAAa,CAACd,cAAc,CAACU,MAAf,GAAwBX,QAAxB,GAAmCH,SAApC,EAA+CJ,kBAA/C,EAAmEK,GAAnE,EAAwEC,OAAxE,CAAnB;AACpB;;AAzBmB,CAAtB;AA4BA,SACEV,aADF","sourcesContent":["const RequiredMixin = {\n name: 'required-mixin',\n use: [],\n attached(): void {\n this.listPostProcessors.push(this.requiredResources.bind(this));\n },\n async requiredResources(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n const displays: any[] = [];\n const requiredFields = Array.from((this.element as Element).attributes).filter(attr => attr.name.startsWith('required-'))\n .map(attr => attr['name'].replace('required-', ''));\n\n if (requiredFields.length) {\n for (let resource of resources) {\n let hasProps = true;\n for(let field of requiredFields) {\n if (await resource[field] == null || await resource[field] == \"\") {\n hasProps = false;\n continue\n }\n }\n if (hasProps) displays.push(resource);\n }\n }\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor) await nextProcessor(requiredFields.length ? displays : resources, listPostProcessors, div, context);\n }\n}\n\nexport {\n RequiredMixin\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["sorterMixin.ts"],"names":["SorterMixin","name","use","attributes","orderBy","type","String","default","orderAsc","orderDesc","orderByRandom","sortedBy","callback","newValue","sortForm","getAttribute","populate","initialState","randomOrder","attached","listPostProcessors","push","orderCallback","bind","created","sorterList","resource","empty","linkSorterForm","addEventListener","resources","div","context","sortingKey","orderValueToSort","document","getElementById","component","value","field","console","warn","orderField","order","orderToSort","Promise","all","map","proxy","sort","sortValuesByKey","r","isRandomSorted","shuffleResources","nextProcessor","shift","key","asc","a","b","varA","toUpperCase","varB","comparison","array","currentIndex","length","temporaryValue","randomIndex","Array","keys","Math","floor","random","i"],"mappings":"AAAA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,IAAI,EAAE,cADY;AAElBC,EAAAA,GAAG,EAAE,EAFa;AAGlBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,O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jD,WAAL,CAAiB6B,GAAjB,CAAsB2B,CAAD,IAAeV,KAAK,CAACU,CAAD,CAAzC,CAAP,CAd0C,CAcY;AACvD;;AAlIiB,CAApB;AAqIA,SACE1E,WADF","sourcesContent":["const SorterMixin = {\n name: 'sorter-mixin',\n use: [],\n attributes: {\n orderBy: {\n type: String,\n default: null\n },\n orderAsc: {\n type: String,\n default: null\n },\n orderDesc: {\n type: String,\n default: null\n },\n orderByRandom: {\n type: String,\n default: null\n },\n sortedBy: {\n type:String,\n default: null,\n callback(newValue: string) {\n // if we change search form, re-populate\n if (newValue && this.sortForm && newValue !== this.sortForm.getAttribute('id')) {\n this.sortForm = null;\n this.populate();\n }\n }\n }\n },\n initialState: {\n randomOrder: null\n },\n attached(): void {\n this.listPostProcessors.push(this.orderCallback.bind(this));\n },\n created(): void {\n this.randomOrder = [];\n },\n async sorterList(): Promise<void> {\n if (!this.resource) return;\n this.empty();\n await this.populate();\n },\n linkSorterForm() {\n this.sortForm.addEventListener('formChange', () => {\n this.sorterList();\n });\n },\n\n async orderCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string) { \n if (this.orderBy) this.orderAsc = this.orderBy; // retrocompatibility. remove in 0.15\n let sortingKey = '';\n let orderValueToSort = '';\n\n // if order-asc or order-desc attribute\n if (this.orderAsc || this.orderDesc) {\n sortingKey = this.orderAsc || this.orderDesc;\n }\n // if sorted-by attribute (solid-form-search data used)\n else if (this.sortedBy) {\n const sortedBy = this.sortedBy;\n if (sortedBy != null) {\n if (!this.sortForm) {\n this.sortForm = document.getElementById(sortedBy);\n if (!this.sortForm) throw `#${sortedBy} is not in DOM`; \n this.linkSorterForm();\n }\n if (!this.sortForm.component.value.field) {\n console.warn('The attribute field does not exist')\n } else { \n sortingKey = this.sortForm.component.value.field['value'];\n }\n const orderField = this.sortForm.component.value.order;\n orderValueToSort = orderField && orderField.value ? orderField.value : 'asc';\n }\n }\n // sorting data according to the defined value of sortingKey\n if (sortingKey) {\n let orderToSort = true; // set 'asc' by default\n if (this.orderDesc || orderValueToSort == \"desc\") orderToSort = false;\n resources = (await Promise.all(resources.map(async (resource) => ({\n sortingKey: await resource[sortingKey], // fetch sorting value\n proxy: resource // and keep proxy\n }))))\n .sort(this.sortValuesByKey(\"sortingKey\", orderToSort)) // sort this array\n .map(r => r.proxy) // re-create array\n }\n // if order-by-random attribute\n else if (this.isRandomSorted()) {\n resources = this.shuffleResources(resources); // shuffle resources\n }\n\n const nextProcessor = listPostProcessors.shift();\n if(nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);\n },\n isRandomSorted(): boolean {\n return this.orderByRandom !== null;\n },\n sortValuesByKey(key: string, asc: boolean): Function {\n return function (a: object, b: object): number {\n if (!a[key]) return 1;\n if (!b[key]) return -1;\n\n const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key];\n const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key];\n let comparison = 0;\n if (varA > varB) comparison = asc ? 1 : -1;\n else if (varA < varB) comparison = asc ? -1 : 1;\n\n return comparison;\n }\n },\n shuffleResources(array: object[]): object[] {\n let currentIndex = array.length;\n let temporaryValue: object;\n let randomIndex: number;\n if (this.randomOrder.length !== array.length) { // if no random order existing\n this.randomOrder = [ ...Array(array.length).keys() ]; // generate array of indexes\n while (0 !== currentIndex) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = this.randomOrder[currentIndex];\n this.randomOrder[currentIndex] = this.randomOrder[randomIndex];\n this.randomOrder[randomIndex] = temporaryValue;\n }\n }\n return this.randomOrder.map((i: number) => array[i]); // rebuild array with random order\n }\n}\n\nexport {\n SorterMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["storeMixin.ts"],"names":["store","AttributeBinderMixin","ContextMixin","StoreMixin","name","use","attributes","noRender","type","String","default","callback","value","fetchData","dataSrc","loaderId","nestedField","initialState","resourceId","subscription","created","element","closest","detached","PubSub","unsubscribe","resource","get","loader","document","getElementById","empty","getData","context","nestedResource","updateNavigateSubscription","subscribe","updateDOM","bind","toggleLoaderHidden","toggle","toggleAttribute","replaceAttributesData","populate","setTimeout","dispatchEvent","CustomEvent","detail","update"],"mappings":"AAAA,SAASA,KAAT,QAAsB,qBAAtB;AACA,SAASC,oBAAT,QAAqC,wBAArC;AAEA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,MAAMC,UAAU,GAAG;AACjBC,EAAAA,IAAI,EAAE,aADW;AAEjBC,EAAAA,GAAG,EAAE,CAACJ,oBAAD,EAAuBC,YAAvB,CAFY;AAGjBI,EAAAA,UAAU,EAAE;AACVC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,IAAI,EAAEC,MADE;AAERC,MAAAA,OAAO,EAAE,IAFD;AAGRC,MAAAA,QAAQ,EAAE,UAAUC,KAAV,EAA0B;AAClC,YAAIA,KAAK,KAAK,IAAd,EAAoB,KAAKC,SAAL,CAAe,KAAKC,OAApB;AACrB;AALO,KADA;AAQVA,IAAAA,OAAO,EAAE;AACPN,MAAAA,IAAI,EAAEC,MADC;AAEPC,MAAAA,OAAO,EAAE,IAFF;AAGPC,MAAAA,QAAQ,EAAE,gBAAgBC,KAAhB,EAA+B;AACvC,YAAI,KAAKL,QAAL,KAAkB,IAAtB,EAA4B,MAAM,KAAKM,SAAL,CAAeD,KAAf,CAAN;AAC7B;AALM,KARC;AAeVG,IAAAA,QAAQ,EAAE;AACRP,MAAAA,IAAI,EAAEC,MADE;AAERC,MAAAA,OAAO,EAAE;AAFD,KAfA;AAmBVM,IAAAA,WAAW,EAAE;AACXR,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE;AAFE;AAnBH,GAHK;AA2BjBO,EAAAA,YAAY,EAAE;AACZC,IAAAA,UAAU,EAAE,IADA;AAEZC,IAAAA,YAAY,EAAE;AAFF,GA3BG;;AA+BjBC,EAAAA,OAAO,GAAG;AACR,QAAI,KAAKC,OAAL,CAAaC,OAAb,CAAqB,aAArB,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;AACA,UAAMtC,KAAK,CAACgC,OAAN,CAAc,KAAKd,UAAnB,EAA+B,KAAKe,OAApC,CAAN;AACA,SAAKI,SAAL;AACD,GA7DgB;;AA8DjBE,EAAAA,kBAAkB,CAACC,MAAD,EAAwB;AACxC,QAAI,KAAKZ,MAAT,EAAiB,KAAKA,MAAL,CAAYa,eAAZ,CAA4B,QAA5B,EAAsCD,MAAtC;AAClB,GAhEgB;;AAiEjBL,EAAAA,0BAA0B,GAAG,CAAG,CAjEf;;AAkEjB,QAAME,SAAN,GAAiC;AAC/B,SAAKE,kBAAL,CAAwB,KAAxB,EAD+B,CACC;;AAChC,SAAKR,KAAL;AACA,UAAM,KAAKW,qBAAL,EAAN;AACA,UAAM,KAAKC,QAAL,EAAN;AACAC,IAAAA,UAAU,CAAC,MAAQ;AACjB,SAAKvB,OAAL,CAAawB,aAAb,CAA2B,IAAIC,WAAJ,CAAgB,UAAhB,EAA4B;AAAEC,MAAAA,MAAM,EAAE;AAAErB,QAAAA,QAAQ,EAAE;AAAC,iBAAO,KAAKZ;AAAb;AAAZ;AAAV,KAA5B,CAA3B,CADQ,CAAV;AAGA,SAAKyB,kBAAL,CAAwB,IAAxB;AACD,GA3EgB;;AA4EjBR,EAAAA,KAAK,GAAQ,CACZ,CA7EgB;;AA8EjBiB,EAAAA,MAAM,GAAG;AACP,QAAI,KAAKzC,QAAL,KAAkB,IAAtB,EAA4B,KAAK8B,SAAL;AAC7B;;AAhFgB,CAAnB;AAmFA,SACElC,UADF","sourcesContent":["import { store } from '../libs/store/store';\nimport { AttributeBinderMixin } from './attributeBinderMixin';\nimport type { Resource } from './interfaces';\nimport { ContextMixin } from './contextMixin';\n\nconst StoreMixin = {\n name: 'store-mixin',\n use: [AttributeBinderMixin, ContextMixin],\n attributes: {\n noRender: {\n type: String,\n default: null,\n callback: function (value: boolean) {\n if (value === null) this.fetchData(this.dataSrc);\n }\n },\n dataSrc: {\n type: String,\n default: null,\n callback: async function (value: string) {\n if (this.noRender === null) await this.fetchData(value);\n },\n },\n loaderId: {\n type: String,\n default: ''\n },\n nestedField: {\n type: String,\n default: null\n },\n },\n initialState: {\n resourceId: null,\n subscription: null,\n },\n created() {\n if (this.element.closest('[no-render]')) this.noRender = ''; // if embedded in no-render, apply no-render to himself\n },\n detached() {\n if (this.subscription) PubSub.unsubscribe(this.subscription);\n },\n get resource(): Resource|null{\n return this.resourceId ? store.get(this.resourceId) : null;\n },\n get loader(): HTMLElement | null {\n return this.loaderId ? document.getElementById(this.loaderId) : null;\n },\n async fetchData(value: string) {\n this.empty();\n if (this.subscription) PubSub.unsubscribe(this.subscription);\n if (!value || value == \"undefined\") return;\n\n this.resourceId = value;\n\n if (this.nestedField) {\n const resource = await store.getData(value, this.context);\n const nestedResource = resource ? await resource[this.nestedField] : null;\n this.resourceId = nestedResource ? nestedResource['@id'] : null;\n if (!this.resourceId) throw `Error: the key \"${this.nestedField}\" does not exist on the resource`\n }\n this.updateNavigateSubscription();\n\n this.subscription = PubSub.subscribe(this.resourceId, this.updateDOM.bind(this));\n await store.getData(this.resourceId, this.context);\n this.updateDOM();\n },\n toggleLoaderHidden(toggle: boolean): void {\n if (this.loader) this.loader.toggleAttribute('hidden', toggle);\n },\n updateNavigateSubscription() { },\n async updateDOM(): Promise<void> {\n this.toggleLoaderHidden(false); // brings a loader out if the attribute is set\n this.empty();\n await this.replaceAttributesData();\n await this.populate();\n setTimeout(() => ( // Brings the dispatchEvent at the end of the queue\n this.element.dispatchEvent(new CustomEvent('populate', { detail: { resource: {\"@id\": this.dataSrc} } })))\n );\n this.toggleLoaderHidden(true);\n },\n empty():void {\n },\n update() {\n if (this.noRender === null) this.updateDOM();\n }\n};\n\nexport {\n StoreMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["translationMixin.ts"],"names":["store","TranslationMixin","name","use","initialState","translationData","created","getLang","getTranslationModule","langCode","translationsModules","en","fr","console","warn","module","default","languageStorage","_getLanguage","window","fetchTranslationPromise","und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;;AA2CvB;AACF;AACA;AACA;AACA;AACEC,EAAAA,CAAC,CAACC,OAAD,EAAkB;AACjB,WAAO,KAAKrB,eAAL,CAAqBqB,OAArB,KAAiC,EAAxC;AACD;;AAlDsB,CAAzB;AAqDA,SACEzB,gBADF","sourcesContent":["import { store } from \"../libs/store/store\";\n\nconst TranslationMixin = {\n name: 'translation-mixin',\n use: [],\n initialState: {\n translationData:{}\n },\n created() {\n this.getLang();\n },\n /**\n * Returns the translation module\n * @param langCode - string: language needed in 2 char\n * @returns - object: {key: translation}\n */\n async getTranslationModule(langCode: string) {\n const translationsModules = { // define modules in a static way, snowpack does not support dynamic strings here\n en: () => import('../locales/en.json'),\n fr: () => import('../locales/fr.json'),\n };\n if (!translationsModules[langCode]) { // set default to EN if the file does not exist\n console.warn(`${langCode}.json translation file may not exist, English is setted by default`);\n langCode = 'en';\n }\n const module = await translationsModules[langCode]();\n return module.default;\n },\n /**\n * Loads the right translation file and reload the component\n */\n getLang() {\n const languageStorage = store._getLanguage();\n if(languageStorage) {\n if (window.fetchTranslationPromise === undefined) { // if translation data are not already fetched\n window.fetchTranslationPromise = this.getTranslationModule(languageStorage);\n }\n window.fetchTranslationPromise.then(res => {\n if (res) {\n this.translationData = res; // stock data in object passed to traduction method below\n this.update(); // update the rendering in components and widgets\n }\n })\n }\n },\n /**\n * Returns translation for a given key\n * @param tradKey - string: key\n * @returns - string: translation\n */\n t(tradKey: string) {\n return this.translationData[tradKey] || '';\n }\n}\n\nexport {\n TranslationMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["validationMixin.ts"],"names":["dialogPolyfill","html","ifDefined","uniqID","TranslationMixin","preHTML","ValidationMixin","name","use","attributes","confirmationMessage","type","String","default","confirmationType","confirmationSubmitText","confirmationCancelText","confirmationSubmitClass","undefined","confirmationCancelClass","confirmationWidget","created","dialogID","showModal","dialog","document","getElementById","registerDialog","performAction","element","hasAttribute","console","warn","confirm","t","validateModal","getModalDialog","qu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,SAAS,CAAC,KAAKe,uBAAN,CAVzB,EAYQ,KAAKF,sBAAL,IAA+B,KAAKmB,CAAL,CAAO,wBAAP,CAZvC,EAeiBG,UAfjB,EAgBgBnC,SAAS,CAAC,KAAKiB,uBAAN,CAhBzB,EAkBQ,KAAKH,sBAAL,IAA+B,KAAKkB,CAAL,CAAO,wBAAP,CAlBvC;AAuBD,KAjCD,MAiCO,OAAO,EAAP;AACR;;AAtFqB,CAAxB;AAyFA,SACE5B,eADF","sourcesContent":["import dialogPolyfill from 'dialog-polyfill'\nimport { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { uniqID } from '../libs/helpers';\nimport { TranslationMixin } from './translationMixin';\nimport { preHTML } from '../libs/lit-helpers';\n\nconst ValidationMixin = {\n name: 'validation-mixin',\n use: [TranslationMixin],\n attributes: {\n confirmationMessage: {\n type: String,\n default: null\n },\n confirmationType: {\n type: String,\n default: null\n },\n confirmationSubmitText: {\n type: String,\n default: null\n },\n confirmationCancelText: {\n type: String,\n default: null\n },\n confirmationSubmitClass: {\n type: String,\n default: undefined\n },\n confirmationCancelClass: {\n type: String,\n default: undefined\n },\n confirmationWidget: {\n type: String,\n default: undefined\n }\n },\n created() {\n this.dialogID = uniqID();\n },\n showModal() {\n var dialog: any = document.getElementById(this.dialogID);\n dialogPolyfill.registerDialog(dialog);\n return dialog.showModal();\n },\n performAction() {\n // Console warning if conf-type attr not filled AND conf-message filled\n if (this.element.hasAttribute('confirmation-message') && !this.confirmationType) console.warn('confirmation-type attribute is missing.');\n // Data directly submitted OR confirm dialog modal displayed\n if ((!this.confirmationType) || (this.confirmationType == \"confirm\" && confirm(this.confirmationMessage || this.t(\"validation.message\")))) this.validateModal();\n // Customisable dialog modal opened\n if (this.confirmationType == \"dialog\") {\n this.showModal();\n }\n },\n getModalDialog() {\n if (this.confirmationType == 'dialog') {\n const quitDialog = () => {\n var dialog: any = document.getElementById(this.dialogID);\n if (dialog == null) return;\n dialog.close();\n }\n const confirmChoice = () => {\n this.validateModal();\n quitDialog();\n }\n return html`\n <dialog id=\"${this.dialogID}\">\n ${this.confirmationWidget ? preHTML`\n <${this.confirmationWidget} value=${this.resourceId}></${this.confirmationWidget}>\n ` : html`\n <p>${this.confirmationMessage || this.t(\"validation.message\")}</p>\n `}\n <div>\n <button\n @click=${confirmChoice} \n class=${ifDefined(this.confirmationSubmitClass)}\n >\n ${this.confirmationSubmitText || this.t(\"validation.submit-text\")}\n </button>\n <button\n @click=${quitDialog}\n class=${ifDefined(this.confirmationCancelClass)}\n >\n ${this.confirmationCancelText || this.t(\"validation.cancel-text\")}\n </button>\n </div>\n </dialog>\n `\n } else return '';\n },\n}\n\nexport {\n ValidationMixin\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["widgetMixin.ts"],"names":["spread","preHTML","parseFieldsString","findClosingBracketMatchIndex","newWidgetFactory","WidgetType","html","render","ifDefined","WidgetMixin","name","use","attributes","fields","type","String","default","undefined","initialState","nameWidgets","_div","created","attached","dataSrc","resource","noRender","populate","parentElement","div","document","createElement","element","appendChild","value","widgets","map","querySelector","getFields","attr","isContainer","res","console","error","Error","prop","properties","startsWith","push","getAction","field","action","getAttribute","editable","hasAttribute","getSetRegexp","RegExp","getSet","setString","match","firstSetBracket","indexOf","length","lastSetBracket","set","substring","isSet","foundSets","isString","fetchValue","getValue","escapedField","getEscapedField","resourceValue","empty","widgetFromTagName","tagName","CUSTOM","USER","customElements","get","NATIVE","getWidget","widget","defaultWidget","defaultSetWidget","multiple","attribute","defaultMultipleWidget","addToAttributes","lookForAttr","setAttrKey","widgetAttributes","attrs","multipleAttributes","defaultAttributes","addableAttributes","Array","from","filter","a","replace","resourceId","createWidgetTemplate","transformAttributes","createString","createSet","currentResource","widgetMeta","widgetTemplate","class","defineAttribute","setAttribute","setWidget","setAttributes","initializing","Object","keys","component","setFields","hasOnlyEmpty","valueSet","widgetsTemplate","Promise","all","template","slice"],"mappings":";;;;;;;;;;;;;;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AAiB,GAAjB,IAAwBG,KAAK,CAAC4E,KAAN,CAAY,CAAZ,EAAe5E,KAAK,CAACY,MAArB,CAAxB,GAAuDZ,KAA9D;AACD;;AA3WiB,CAApB;AA8WA,SACExC,WADF","sourcesContent":["import { spread, preHTML } from '../libs/lit-helpers';\nimport { parseFieldsString, findClosingBracketMatchIndex } from '../libs/helpers';\nimport { newWidgetFactory } from '../new-widgets/new-widget-factory';\nimport { WidgetInterface, WidgetType, Resource } from './interfaces';\nimport { html, render, TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst WidgetMixin = {\n name: 'widget-mixin',\n use: [],\n attributes: {\n fields: {\n type: String,\n default: undefined,\n }\n },\n initialState: {\n nameWidgets: null,\n _div: null\n },\n created(): void {\n this.nameWidgets = [];\n },\n attached(): void {\n if (!this.dataSrc && !this.resource && this.noRender === null) this.populate();\n },\n get parentElement(): string {\n return 'div';\n },\n get div(): HTMLElement {\n if (this._div) return this._div;\n this._div = document.createElement(this.parentElement);\n this.element.appendChild(this._div);\n return this._div;\n },\n set div(value) {\n this._div = value\n },\n get widgets() {\n return this.nameWidgets.map((name: string) => this.element.querySelector(`[name=\"${name}\"]`));\n },\n /**\n * Return field list of the component\n */\n async getFields(): Promise<string[]>{ // TODO : improve code\n const attr = this.fields;\n if (attr === '') return [];\n if (attr) return parseFieldsString(attr);\n\n let resource = this.resource as Resource;\n if (resource && resource.isContainer()) { // If container, keep the 1rst resource\n for (let res of resource['ldp:contains']) {\n resource = res;\n break;\n }\n }\n\n if (!this.dataSrc) console.error(new Error('You must provide a \"fields\" attribute'));\n if(!resource) return [];\n\n let fields: string[] = [];\n for (const prop of resource.properties) {\n if ((!prop.startsWith('@') && !(prop === \"permissions\")) && await resource[prop]) fields.push(prop);\n }\n return fields;\n },\n /**\n * return attribute if \"field\" is an action\n * @param field - string\n */\n getAction(field: string): string {\n const action = this.element.getAttribute('action-' + field);\n return action;\n },\n /**\n * return true if \"field\" is editable\n * @param field - string\n */\n editable(field: string): string {\n return this.element.hasAttribute('editable-' + field);\n },\n /**\n * Return regexp to check if \"field\" is a set\n * @param field - string\n */\n getSetRegexp(field: string) {\n return new RegExp(`(^|\\\\,|\\\\(|\\\\s)\\\\s*${field}\\\\s*\\\\(`, 'g')\n },\n /**\n * Return fields contained in set \"field\"\n * @param field - string\n */\n getSet(field: string): string[] {\n const setString = this.fields.match(this.getSetRegexp(field));\n if (!setString) return [];\n const firstSetBracket = this.fields.indexOf(setString[0]) + (setString[0].length) - 1;\n const lastSetBracket = findClosingBracketMatchIndex(this.fields, firstSetBracket);\n const set = this.fields.substring(firstSetBracket + 1, lastSetBracket);\n return parseFieldsString(set);\n },\n /**\n * Return true if \"field\" is a set\n * @param field - string\n */\n isSet(field: string): boolean {\n if (!this.fields) return false;\n let foundSets = this.fields.match(this.getSetRegexp(field));\n return foundSets ? foundSets.length > 0 : false;\n },\n isString(field: string): boolean {\n return field.startsWith('\\'') || field.startsWith('\\\"');\n },\n /**\n * Return the value of \"resource\" for predicate \"field\"\n * @param field - string\n * @param resource - Resource\n */\n async fetchValue(field: string, resource: Resource) {\n return resource && !resource.isContainer() ? await resource[field] : undefined;\n },\n /**\n * Return the value of the field\n * @param field - field\n */\n async getValue(field: string, resource: Resource) {\n const escapedField = this.getEscapedField(field);\n if (this.getAction(escapedField)) {\n return this.getAction(escapedField);\n }\n if (this.element.hasAttribute('value-' + field)) {\n return this.element.getAttribute('value-' + field);\n }\n let resourceValue = await this.fetchValue(field, resource);\n\n // Empty value\n if (resourceValue === undefined || resourceValue === '' || resourceValue === null) // If null or empty, return field default value\n return this.element.hasAttribute('default-' + field) ?\n this.element.getAttribute('default-' + field) : '';\n\n return resourceValue;\n },\n empty(): void {},\n /**\n * Return a widget from a tagName, and create it if necessary\n * @param tagName - string\n */\n widgetFromTagName(tagName: string) {\n let type = tagName.startsWith('solid') ? WidgetType.CUSTOM : WidgetType.USER;\n if (!customElements.get(tagName)) { // component does not exist\n if (tagName.startsWith('solid')) newWidgetFactory(tagName); // solid- -> create it\n else type = WidgetType.NATIVE; // or use a native tag\n }\n return { tagName, type }; // return tagName\n },\n /**\n * Return widget for field \"field\"\n * @param field - string\n * @param isSet - boolean\n */\n getWidget(field: string, isSet: boolean = false): WidgetInterface {\n const widget = this.element.getAttribute('widget-' + field);\n\n if (widget) return this.widgetFromTagName(widget);\n if (this.getAction(field)) return this.widgetFromTagName('solid-action');\n\n return !isSet ? this.widgetFromTagName(this.defaultWidget) : this.widgetFromTagName(this.defaultSetWidget);\n },\n /**\n * Return multiple widget if \"field\" is a multiple, false if it's not\n * @param field - string\n */\n multiple(field: string): WidgetInterface|null {\n const attribute = 'multiple-' + field;\n if (!this.element.hasAttribute(attribute)) return null;\n const widget = this.element.getAttribute(attribute) || this.defaultMultipleWidget;\n return this.widgetFromTagName(widget);\n },\n /**\n * If attribute \"lookForAttr\" is set on element, add \"attrKey\" to the \"attributes\" list\n * @param lookForAttr - string\n * @param setAttrKey - string\n * @param attributes - object\n */\n addToAttributes(lookForAttr: string, setAttrKey: string, attributes: object) {\n const attribute = this.element.getAttribute(lookForAttr);\n if (attribute == null) return;\n attributes[setAttrKey] = attribute;\n },\n /**\n * Return all the attributes of widget \"field\"\n * @param field - string\n * @param resource - Resource\n */\n widgetAttributes(field: string, resource: Resource): object {\n const attrs = { name: field };\n const escapedField = this.getEscapedField(field);\n\n // transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]\n const multipleAttributes = [\n 'fields',\n 'label',\n 'widget',\n 'add-label',\n 'remove-label',\n 'next', \n 'empty-widget'\n ];\n for (let attr of multipleAttributes) this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs)\n\n // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]\n const defaultAttributes = [\n 'range',\n 'enum',\n 'label',\n 'placeholder',\n 'class',\n /* 'widget', */,\n 'required',\n 'editable',\n 'autocomplete',\n 'upload-url',\n 'option-label',\n 'option-value',\n 'order-by', // deprecated. Remove in 0.15\n 'each-label',\n 'order-asc',\n 'order-desc',\n 'min',\n 'max',\n 'pattern',\n 'title',\n 'start-value',\n 'end-value',\n 'alt',\n 'step',\n 'maxlength',\n 'minlength',\n 'search-text',\n 'search-placeholder',\n ];\n for (let attr of defaultAttributes) this.addToAttributes(`${attr}-${escapedField}`, attr, attrs)\n\n const addableAttributes: Attr[] = (Array.from(this.element.attributes) as Attr[]).filter((a: Attr) => a.name.startsWith(`addable-${escapedField}`));\n for (let attr of addableAttributes) this.addToAttributes(attr.name, attr.name.replace(`addable-${escapedField}`, 'addable'), attrs)\n\n const resourceId = resource ? resource!['@id'] : null;\n if (this.multiple(escapedField)) attrs['widget'] = this.getWidget(escapedField).tagName;\n if (this.getAction(escapedField) && resourceId) attrs['src'] = this.element.getAttribute('src-' + escapedField) || resourceId;\n if (this.editable(escapedField) && resourceId) attrs['value-id'] = resourceId;\n\n return attrs;\n },\n /**\n * Creates and return a widget for field + add it to the widget list\n * @param field - string\n */\n async createWidgetTemplate(field: string, resource = null, transformAttributes = false): Promise<TemplateResult> {\n if (this.isString(field)) return this.createString(field); // field is a static string\n if (this.isSet(field)) return await this.createSet(field);\n\n const currentResource = resource || this.resource;\n let attributes = this.widgetAttributes(field, currentResource);\n const escapedField = this.getEscapedField(field);\n const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);\n let tagName = widgetMeta.tagName;\n let widgetTemplate = html``;\n\n // Set attributes\n let value = await this.getValue(field, currentResource);\n if (widgetMeta.type === WidgetType.NATIVE) { // native widget (ie: h1)\n widgetTemplate = preHTML`\n <${tagName}\n name=\"${ifDefined(attributes.name)}\"\n class=\"${ifDefined(attributes.class)}\"\n >${value}</${tagName}>\n `;\n } else { // custom widget (ie: solid-display-value)\n // Check if value is defined, and if the default widget is needed\n if ((value === null || value === '') && this.element.hasAttribute('default-widget-' + field)) {\n tagName = this.element.getAttribute('default-widget-' + field);\n }\n // Set attributes to the widget\n // setAttribute set a string. Make sure null values are empty\n if (value === null || value === undefined) attributes.value = '';\n if (widgetMeta.type === WidgetType.USER && value['@id']) { // if value is a resource and solid-widget used, set data-src\n attributes['data-src'] = value['@id'];\n } else { // otherwise, set value attribute\n attributes['value'] = value;\n }\n\n // Subscribe widgets if they show a resource\n if (value && value['@id']) attributes['auto-subscribe'] = value['@id'];\n\n // Transform store://XXX attributes\n if (transformAttributes) attributes = await this.transformAttributes(attributes, currentResource);\n\n widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n }\n\n this.nameWidgets.push(field);\n return widgetTemplate;\n },\n defineAttribute(widget: HTMLElement, attribute: string, value: any) {\n if (widget.getAttribute(attribute) !== value) { // if attribute is different than previous one\n widget.setAttribute(attribute, value); // set it\n }\n },\n /**\n * Create a set and add fields to it\n * @param field - string\n */\n async createSet(field: string): Promise<TemplateResult> {\n const setWidget = this.getWidget(field, true);\n\n // Get set attributes\n const attrs = { name: field };\n const setAttributes = [\n 'class',\n 'label'\n ];\n for (let attr of setAttributes) this.addToAttributes(`${attr}-${field}`, attr, attrs);\n\n // Create widget if not already existing\n let widget = this.element.querySelector(`${setWidget.tagName}[name=\"${field}\"]`);\n let initializing = false; // used to render widget only first time\n if (!widget) {\n widget = document.createElement(setWidget.tagName);\n initializing = true;\n }\n for (let name of Object.keys(attrs)) {\n this.defineAttribute(widget, name, attrs[name], setWidget.type);\n }\n if (widget.component && initializing) widget.component.render();\n let setFields = this.getSet(field);\n // Catch widget for the set if all these fields are empty\n if (this.element.hasAttribute('empty-' + field)) {\n let hasOnlyEmpty = true;\n for(let field of setFields) {\n let value: string = await this.getValue(field, this.resource);\n if (value !== '') { // if one not empty\n hasOnlyEmpty = false;\n continue; // break loop\n }\n };\n if(hasOnlyEmpty) { // if only empty values, return empty-widget\n const attributes = this.widgetAttributes(field, this.resource);\n const tagName = this.element.getAttribute(`empty-${field}`);\n const valueSet = this.element.getAttribute(`empty-${field}-value`);\n if (valueSet) attributes.value = valueSet;\n return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n };\n }\n\n // Render template\n const widgetsTemplate = await Promise.all(setFields.map((field: string) => this.createWidgetTemplate(field)));\n const template = html`${widgetsTemplate}`;\n render(template, widget.querySelector('[data-content]') || widget);\n return widget;\n },\n createString(value: string): TemplateResult {\n return html`\n <span>${value.slice(1, -1).replace(/\\\\(['\"])/g, '$1')}</span>\n `;\n },\n /**\n * Returns field name without starting \"@\"\n * @param field\n */\n getEscapedField(field: string): string {\n return field.startsWith('@') ? field.slice(1, field.length) : field;\n }\n}\n\nexport {\n WidgetMixin\n}"]}
|