From d37074908210a9695aeba6188ddcfa3d32f59209 Mon Sep 17 00:00:00 2001 From: ijungleboy Date: Tue, 21 Jun 2022 17:00:14 +0200 Subject: [PATCH 01/52] version bump 14.04 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 37deec8ba..a569c7b3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "2sxc-ui", - "version": "14.03.00", + "version": "14.04.00", "description": "2sxc UI - the JS UI of 2sxc", "scripts": { "release-all": "npm run js2sxc && npm run inpage && npm run snippets && npm run quickdialog && npm run turn-on", From 644ee4d9702a68c8908a1b1c31a8aee3ee109002 Mon Sep 17 00:00:00 2001 From: ijungleboy Date: Wed, 22 Jun 2022 22:14:00 +0200 Subject: [PATCH 02/52] minor fix toolbar settings not all preserved --- .../toolbar-config-loader-v10.ts | 3 +- projects/inpage/src/toolbar/config/index.ts | 14 +- .../toolbar/config/toolbar-button-settings.ts | 11 ++ .../src/toolbar/config/toolbar-settings.ts | 140 +++++++++--------- .../inpage/src/toolbar/rules/rule-params.ts | 5 +- projects/inpage/src/toolbar/rules/rule.ts | 11 +- 6 files changed, 96 insertions(+), 88 deletions(-) create mode 100644 projects/inpage/src/toolbar/config/toolbar-button-settings.ts diff --git a/projects/inpage/src/toolbar/config-loaders/toolbar-config-loader-v10.ts b/projects/inpage/src/toolbar/config-loaders/toolbar-config-loader-v10.ts index 958085682..a5d99b1d2 100644 --- a/projects/inpage/src/toolbar/config-loaders/toolbar-config-loader-v10.ts +++ b/projects/inpage/src/toolbar/config-loaders/toolbar-config-loader-v10.ts @@ -30,10 +30,9 @@ export class ToolbarConfigLoaderV10 extends HasLog { // We should use the `ui` parameter, as it's UI rules, but because previously // it used the `params` - we must support both :( const settingRule = this.rules.getSettings(); - let settingsUiRule = settingRule?.ui as unknown as Partial; + let settingsUiRule = settingRule?.ui as Partial; if (Object.keys(settingsUiRule || {}).length === 0) settingsUiRule = settingRule?.params as Partial; - // settingsUiRule = { ...settingRule?.params, ...settingRule?.ui } as unknown as Partial; const settings = new ToolbarSettings(settingsUiRule); // #2 load either the default toolbar or the one specified diff --git a/projects/inpage/src/toolbar/config/index.ts b/projects/inpage/src/toolbar/config/index.ts index 6fd3b4cc8..6784c8f18 100644 --- a/projects/inpage/src/toolbar/config/index.ts +++ b/projects/inpage/src/toolbar/config/index.ts @@ -1,11 +1,11 @@ +/** @internal */ export * from './button-command'; -export * from './button-command'; +/** @internal */ export * from './button'; +/** @internal */ export * from './button-safe'; -export * from './button'; -export * from './button-safe'; +/** @internal */ export * from './button-group'; -export * from './button-group'; +/** @internal */ export * from './toolbar'; -export * from './toolbar'; - -export * from './toolbar-settings'; +/** @internal */ export * from './toolbar-settings'; +/** @internal */ export * from './toolbar-button-settings'; \ No newline at end of file diff --git a/projects/inpage/src/toolbar/config/toolbar-button-settings.ts b/projects/inpage/src/toolbar/config/toolbar-button-settings.ts new file mode 100644 index 000000000..0299754c3 --- /dev/null +++ b/projects/inpage/src/toolbar/config/toolbar-button-settings.ts @@ -0,0 +1,11 @@ +import { TypeValue } from '../../core'; + +export interface ToolbarButtonSettings { + icon?: string, + class?: string, + color?: string, + show?: boolean, + code?: string, + title?: string, + [key: string]: TypeValue, +} \ No newline at end of file diff --git a/projects/inpage/src/toolbar/config/toolbar-settings.ts b/projects/inpage/src/toolbar/config/toolbar-settings.ts index 1ea24e377..148a23f29 100644 --- a/projects/inpage/src/toolbar/config/toolbar-settings.ts +++ b/projects/inpage/src/toolbar/config/toolbar-settings.ts @@ -43,75 +43,77 @@ export type TypeFollow = 'default' | 'none' | typeof TOOLBAR_FOLLOW_INITIAL | ty * @internal */ export class ToolbarSettings { - /** Automatically add the '...' more button to the toolbar */ - autoAddMore: TypeAutoAddMore = autoAddMoreDefault; - - /** Hover placement of the toolbar */ - hover: TypeHover = hoverDefault; - - /** Show behavior (always, hover, ...) */ - show: TypeShow = TOOLBAR_SHOW_HOVER; - - /** Follow behavior - if the toolbar should scroll with the page or remain where it was hovered */ - follow: TypeFollow = followDefault; - - /** - * Old term, keep for compatibility. Please use `.class` instead - * @obsolete - */ - classes: string = ''; - - /** - * Term for the class for simplicity and consistency with button styling - * New 10.27 - */ - class: string = ''; - - /** - * color configuration which applies to all buttons - * use "colorname", "#xxyyzz" or "color1,color2" to specify the colors - * New in 10.27 - */ - color?: string = ''; - - /** - * modifiers for the buttons - * Should never be set from the page, but the toolbar initializer will set this - * New in 10.27 - */ - _rules?: RuleManager; - - constructor(defaults: Partial) { // } { autoAddMore?: TypeAutoAddMore, hover?: TypeHover, show?: TypeShow, follow?: TypeFollow }) { - if (defaults != null) { - if (defaults.autoAddMore) this.autoAddMore = defaults.autoAddMore; - if (defaults.hover) this.hover = defaults.hover; - if (defaults.show) this.show = defaults.show; - if (defaults.follow) this.follow = defaults.follow; - } - // Swap the real follow-default to be "none" - if (this.follow === followDefault) this.follow = 'none'; - } - - - /** - * removes autoAddMore and classes if are null or empty, to keep same behaviour like in v1 - * - * Note 2dm: not sure why we're doing this, but it seems like we only need this to merge - * various objects, so we probably want to make sure the in-html-toolbar doesn't accidentally - * contain null-items we don't want passed on - * @param toolbarSettings - */ - static dropEmptyProperties(toolbarSettings: ToolbarSettings): Partial { - const partialSettings = {...toolbarSettings}; - if (!partialSettings.autoAddMore) delete partialSettings.autoAddMore; - if (!partialSettings.classes) delete partialSettings.classes; - return partialSettings; - } - - static getDefaults = () => new ToolbarSettings({ autoAddMore: 'end', hover: 'right', show: 'hover', follow: 'default' }); - - /** Setup for situations where an empty toolbar is needed, without any data or configuration */ - static getForEmpty = () => new ToolbarSettings({ autoAddMore: 'start', hover: 'left', show: 'hover', follow: 'default' }); + /** Automatically add the '...' more button to the toolbar */ + autoAddMore: TypeAutoAddMore = autoAddMoreDefault; + + /** Hover placement of the toolbar */ + hover: TypeHover = hoverDefault; + + /** Show behavior (always, hover, ...) */ + show: TypeShow = TOOLBAR_SHOW_HOVER; + + /** Follow behavior - if the toolbar should scroll with the page or remain where it was hovered */ + follow: TypeFollow = followDefault; + + /** + * Old term, keep for compatibility. Please use `.class` instead + * @obsolete + */ + classes: string = ''; + + /** + * Term for the class for simplicity and consistency with button styling + * New 10.27 + */ + class: string = ''; + + /** + * color configuration which applies to all buttons + * use "colorname", "#xxyyzz" or "color1,color2" to specify the colors + * New in 10.27 + */ + color?: string = ''; + + /** + * modifiers for the buttons + * Should never be set from the page, but the toolbar initializer will set this + * New in 10.27 + */ + _rules?: RuleManager; + + constructor(defaults: Partial) { + + // Copy all properties of the defaults IF this object also has that property + if (defaults != null) + Object.keys(this).forEach(k => { + let kd = k as keyof typeof defaults; + if (defaults[kd]) (this as any)[k] = defaults[kd]; + }); + + // Swap the real follow-default to be "none" + if (this.follow === followDefault) this.follow = 'none'; + } + + + /** + * removes autoAddMore and classes if are null or empty, to keep same behaviour like in v1 + * + * Note 2dm: not sure why we're doing this, but it seems like we only need this to merge + * various objects, so we probably want to make sure the in-html-toolbar doesn't accidentally + * contain null-items we don't want passed on + * @param toolbarSettings + */ + static dropEmptyProperties(toolbarSettings: ToolbarSettings): Partial { + const partialSettings = {...toolbarSettings}; + if (!partialSettings.autoAddMore) delete partialSettings.autoAddMore; + if (!partialSettings.classes) delete partialSettings.classes; + return partialSettings; + } + + static getDefaults = () => new ToolbarSettings({ autoAddMore: 'end', hover: 'right', show: 'hover', follow: 'default' }); + + /** Setup for situations where an empty toolbar is needed, without any data or configuration */ + static getForEmpty = () => new ToolbarSettings({ autoAddMore: 'start', hover: 'left', show: 'hover', follow: 'default' }); } diff --git a/projects/inpage/src/toolbar/rules/rule-params.ts b/projects/inpage/src/toolbar/rules/rule-params.ts index 76df3e27f..3040a7f72 100644 --- a/projects/inpage/src/toolbar/rules/rule-params.ts +++ b/projects/inpage/src/toolbar/rules/rule-params.ts @@ -16,6 +16,9 @@ export type RuleParams = Record & { /** this is how the metadata-param comes in - as a 'for=someId' - this node will be removed afterwards */ for?: string; - /** This is the metadata node as it will be used as a real parameter */ + /** + * This is the metadata node as it will be used as a real parameter + * @internal + */ metadata?: CommandParamsMetadata; }; diff --git a/projects/inpage/src/toolbar/rules/rule.ts b/projects/inpage/src/toolbar/rules/rule.ts index 59f361a90..3daed11b1 100644 --- a/projects/inpage/src/toolbar/rules/rule.ts +++ b/projects/inpage/src/toolbar/rules/rule.ts @@ -1,6 +1,7 @@ import { Operations as Operators, RuleConstants as RC, RuleParams, RuleParamsHelper } from '.'; import { HasLog, Log } from '../../core'; import { TypeValue } from '../../plumbing'; +import { ToolbarButtonSettings, ToolbarSettings } from '../config'; import { TemplateConstants } from '../templates'; import { BuildSteps } from './build-steps'; import { ProcessedParams } from './rule-params-helper'; @@ -44,15 +45,7 @@ export class BuildRule extends HasLog { * Button Rules - determines what a button should do / not do * Note: can also be Partial */ - ui: { - icon?: string, - class?: string, - color?: string, - show?: boolean, - code?: string, - title?: string, - [key: string]: TypeValue, - } = {}; + ui: ToolbarButtonSettings & Partial = {}; /** ATM unused url-part after the hash - will probably be needed in future */ // private hash: Dictionary = {}; From ec58dbdfb7199333c7cbb2f766791bd2b68fafc0 Mon Sep 17 00:00:00 2001 From: maaaximum Date: Thu, 23 Jun 2022 10:54:47 +0200 Subject: [PATCH 03/52] Squashed commit of the following: commit 18ab4a28802284e91fd9f9b0ac9ab694e959502f Author: maaaximum Date: Thu Jun 23 10:44:35 2022 +0200 added api-extractor, added exports --- projects/$2sxc/src/cms/item-identifiers.ts | 2 +- projects/$2sxc/src/cms/run-params.ts | 1 + projects/$2sxc/src/environment/index.ts | 1 + projects/$2sxc/src/index.ts | 1 + projects/$2sxc/src/sxc-global/index.ts | 3 +- projects/$2sxc/src/sxc/index.ts | 6 + projects/core/logging/insights.ts | 6 +- projects/core/plumbing/type-value.ts | 2 +- projects/sxc-typings/api-extractor.json | 376 ++++ .../sxc-typings/dist/$2sxc/src/Stats.d.ts | 5 +- .../sxc-typings/dist/$2sxc/src/_/window.d.ts | 11 + .../dist/$2sxc/src/cms/command-names.d.ts | 10 + .../dist/$2sxc/src/cms/command-params.d.ts | 38 +- .../dist/$2sxc/src/cms/item-identifiers.d.ts | 74 +- .../dist/$2sxc/src/cms/run-params.d.ts | 1 + .../dist/$2sxc/src/constants/index.d.ts | 29 +- .../dist/$2sxc/src/data/metadata-for.d.ts | 4 + .../src/environment/env-loader-dnn-sf.d.ts | 18 +- .../src/environment/env-loader-dynamic.d.ts | 24 +- .../src/environment/env-loader-meta.d.ts | 26 +- .../src/environment/environment-specs.d.ts | 5 + .../dist/$2sxc/src/environment/index.d.ts | 1 + .../environment/sxc-global-environment.d.ts | 20 + .../sxc-typings/dist/$2sxc/src/index.d.ts | 1 + .../src/sxc-global/context-identifier.d.ts | 29 + .../dist/$2sxc/src/sxc-global/index.d.ts | 1 + .../src/sxc-global/sxc-global-bootstrap.d.ts | 7 +- .../src/sxc-global/sxc-global-debug.d.ts | 13 +- .../$2sxc/src/sxc-global/sxc-global-get.d.ts | 11 +- .../$2sxc/src/sxc-global/sxc-global-http.d.ts | 21 +- .../src/sxc-global/sxc-global-manage.d.ts | 14 +- .../dist/$2sxc/src/sxc-global/sxc-global.d.ts | 28 +- .../src/sxc/data/sxc-data-service-base.d.ts | 19 +- .../dist/$2sxc/src/sxc/data/sxc-data.d.ts | 21 + .../dist/$2sxc/src/sxc/data/sxc-query.d.ts | 17 + .../sxc-typings/dist/$2sxc/src/sxc/index.d.ts | 6 + .../dist/$2sxc/src/sxc/sxc-cms.d.ts | 3 + .../dist/$2sxc/src/sxc/sxc-manage.d.ts | 13 +- .../dist/$2sxc/src/sxc/sxc-part.d.ts | 24 +- .../sxc-typings/dist/$2sxc/src/sxc/sxc.d.ts | 80 + .../$2sxc/src/sxc/web-api/ajax-promise.d.ts | 22 +- .../$2sxc/src/sxc/web-api/ajax-settings.d.ts | 14 +- .../$2sxc/src/sxc/web-api/sxc-web-api.d.ts | 48 + .../dist/$2sxc/src/tools/obj2url.d.ts | 19 +- .../dist/$2sxc/src/tools/total-popup.d.ts | 9 +- .../dist/$2sxc/src/tools/url-params.d.ts | 16 + .../idialog-frame-element.d.ts | 11 +- .../inpage-quick-dialog/iiframe-bridge.d.ts | 19 +- .../iquick-dialog-config.d.ts | 16 +- .../quick-dialog-params.d.ts | 31 +- .../dist/core/constants/index.d.ts | 31 +- .../sxc-typings/dist/core/logging/Log.d.ts | 108 +- .../sxc-typings/dist/core/logging/entry.d.ts | 29 + .../dist/core/logging/has-log.d.ts | 25 + .../dist/core/logging/insights.d.ts | 21 +- .../dist/core/logging/log-call.d.ts | 20 +- .../dist/core/logging/log-entry-options.d.ts | 8 +- .../dist/core/plumbing/no-jquery.d.ts | 32 +- .../sxc-typings/dist/core/plumbing/obj.d.ts | 13 +- .../dist/core/plumbing/type-value.d.ts | 2 +- .../sxc-typings/dist/core/plumbing/url.d.ts | 3 +- .../dist/inpage/src/bootstrap/bootstrap.d.ts | 36 +- .../inpage/src/cms/run-params-helpers.d.ts | 43 +- .../src/cms/run-params-with-workflows.d.ts | 13 +- .../dist/inpage/src/cms/sxc-global-cms.d.ts | 29 + .../inpage/src/commands/command-code.d.ts | 6 +- .../src/commands/command-link-generator.d.ts | 54 + .../dist/inpage/src/commands/command.d.ts | 33 +- .../command/command-content-type.d.ts | 5 + .../commands/command/command-metadata.d.ts | 13 +- .../command/content-list-action-params.d.ts | 16 +- .../command/content-list-actions.d.ts | 44 + .../inpage/src/commands/command/index.d.ts | 34 +- .../src/commands/command/shared-logic.d.ts | 19 +- .../commands/command/workflow-commands.d.ts | 10 +- .../dist/inpage/src/commands/commands.d.ts | 22 +- .../src/commands/engine/cms-engine.d.ts | 27 + .../inpage/src/constants/content-block.d.ts | 21 +- .../dist/inpage/src/constants/debug.d.ts | 10 +- .../inpage/src/constants/dialog-paths.d.ts | 8 +- .../dist/inpage/src/constants/ids.d.ts | 20 +- .../dist/inpage/src/constants/index.d.ts | 72 +- .../dist/inpage/src/constants/toolbar.d.ts | 21 +- .../contentBlock/content-block-editor.d.ts | 44 +- .../dist/inpage/src/contentBlock/render.d.ts | 43 + .../bundles/context-bundle-button.d.ts | 32 +- .../bundles/context-bundle-content.d.ts | 17 +- .../bundles/context-bundle-instance.d.ts | 22 +- .../bundles/context-bundle-toolbar.d.ts | 14 +- .../html-attribute/edit-context-root.d.ts | 16 +- .../html-attribute/parts/content-block.d.ts | 21 +- .../html-attribute/parts/content-group.d.ts | 25 +- .../html-attribute/parts/environment.d.ts | 16 +- .../context/html-attribute/parts/error.d.ts | 7 +- .../html-attribute/parts/language.d.ts | 9 +- .../parts/parameters-entity.d.ts | 8 +- .../src/context/html-attribute/parts/ui.d.ts | 8 +- .../context/html-attribute/parts/user.d.ts | 8 +- .../inpage/src/context/parts/context-app.d.ts | 27 +- .../context/parts/context-content-block.d.ts | 18 +- .../src/context/parts/context-instance.d.ts | 17 +- .../src/context/parts/context-item.d.ts | 10 +- .../src/context/parts/context-page.d.ts | 11 +- .../src/context/parts/context-system.d.ts | 10 +- .../src/context/parts/context-tenant.d.ts | 9 +- .../inpage/src/context/parts/context-ui.d.ts | 11 +- .../src/context/parts/context-user.d.ts | 14 +- .../dist/inpage/src/core/index.d.ts | 5 +- .../entity-manipulation/item-commands.d.ts | 9 +- .../dist/inpage/src/html/dom-tools.d.ts | 21 +- .../dist/inpage/src/i18n/2sxc.translate.d.ts | 7 +- .../dist/inpage/src/i18n/index.d.ts | 12 + .../dist/inpage/src/i18n/translator.d.ts | 30 + .../sxc-typings/dist/inpage/src/index.d.ts | 4 + .../inpage/src/interfaces/window-in-page.d.ts | 15 +- .../dist/inpage/src/manage/edit-manager.d.ts | 47 +- .../inpage/src/manage/instance-config.d.ts | 16 +- .../inpage/src/manage/ng-dialog-params.d.ts | 24 +- .../src/manage/session-state-handler.d.ts | 14 +- .../inpage/src/manage/sxc-global-manage.d.ts | 24 +- .../dist/inpage/src/plumbing/TypeTbD.d.ts | 20 +- .../src/quick-dialog/iframe-bridge.d.ts | 44 +- .../src/quick-dialog/quick-dialog-config.d.ts | 23 +- .../quick-dialog/quick-dialog-container.d.ts | 37 +- .../inpage/src/quick-dialog/quick-dialog.d.ts | 47 +- .../dist/inpage/src/quick-dialog/state.d.ts | 10 +- .../src/quick-edit/context-for-lists.d.ts | 15 +- .../inpage/src/quick-edit/modifier-base.d.ts | 13 +- .../modifier-content-block-internal.d.ts | 37 +- .../quick-edit/modifier-content-block.d.ts | 28 +- .../modifier-dnn-module-internal.d.ts | 28 +- .../src/quick-edit/modifier-dnn-module.d.ts | 14 +- .../src/quick-edit/position-coordinates.d.ts | 12 +- .../inpage/src/quick-edit/positioning.d.ts | 26 + .../src/quick-edit/quick-e-clipboard.d.ts | 41 +- .../src/quick-edit/quick-e-configuration.d.ts | 4 + .../src/quick-edit/quick-e-overlays.d.ts | 19 +- .../dist/inpage/src/quick-edit/quick-e.d.ts | 55 +- .../dist/inpage/src/quick-edit/selection.d.ts | 15 +- .../src/quick-edit/selectors-instance.d.ts | 22 + .../dist/inpage/src/sxc/sxc-cms-real.d.ts | 21 +- .../inpage/src/sxc/sxc-global-with-cms.d.ts | 11 + .../dist/inpage/src/sxc/sxc-tools.d.ts | 32 +- .../dist/inpage/src/system/2sxc.system.d.ts | 7 +- .../config-loaders/button-config-loader.d.ts | 40 +- .../config-loaders/command-config-loader.d.ts | 18 +- .../config-formats/in-page-button-group.d.ts | 8 +- .../config-formats/in-page-button.d.ts | 39 +- .../config-formats/in-page-command.d.ts | 39 +- .../config-formats/toolbar-wip.d.ts | 31 +- .../config-loaders/group-config-loader.d.ts | 43 +- .../toolbar-config-loader-v09.d.ts | 43 +- .../toolbar-config-loader-v10.d.ts | 16 +- .../config-loaders/toolbar-config-loader.d.ts | 29 +- .../src/toolbar/config/button-command.d.ts | 14 +- .../src/toolbar/config/button-group.d.ts | 20 +- .../src/toolbar/config/button-safe.d.ts | 39 +- .../inpage/src/toolbar/config/button.d.ts | 64 + .../src/toolbar/config/toolbar-settings.d.ts | 82 + .../inpage/src/toolbar/config/toolbar.d.ts | 24 +- .../toolbar-finder-and-initializer.d.ts | 52 +- .../initialize/toolbar-init-config.d.ts | 31 +- .../src/toolbar/render/render-button.d.ts | 15 +- .../src/toolbar/render/render-groups.d.ts | 12 +- .../src/toolbar/render/render-part-base.d.ts | 16 +- .../src/toolbar/render/toolbar-renderer.d.ts | 22 +- .../inpage/src/toolbar/rules/build-steps.d.ts | 11 +- .../src/toolbar/rules/rule-constants.d.ts | 9 +- .../src/toolbar/rules/rule-manager.d.ts | 29 +- .../src/toolbar/rules/rule-operators.d.ts | 11 +- .../src/toolbar/rules/rule-params-helper.d.ts | 27 +- .../inpage/src/toolbar/rules/rule-params.d.ts | 17 +- .../dist/inpage/src/toolbar/rules/rule.d.ts | 57 +- .../tag-toolbars/tag-toolbar-manager.d.ts | 35 +- .../src/toolbar/tag-toolbars/tag-toolbar.d.ts | 53 +- .../src/toolbar/templates/constants.d.ts | 15 +- .../toolbar/templates/list-with-cursor.d.ts | 10 +- .../toolbar/templates/template-default.d.ts | 6 +- .../toolbar/templates/template-editor.d.ts | 21 +- .../src/toolbar/templates/template-empty.d.ts | 6 +- .../toolbar/templates/template-sublist.d.ts | 6 +- .../templates/toolbar-template-group.d.ts | 14 +- .../templates/toolbar-template-manager.d.ts | 26 +- .../toolbar/templates/toolbar-template.d.ts | 21 +- .../src/toolbar/toolbar-event-arguments.d.ts | 16 +- .../inpage/src/toolbar/toolbar-lifecycle.d.ts | 17 +- .../inpage/src/toolbar/toolbar-manager.d.ts | 23 +- .../src/workflow/toolbar-with-workflow.d.ts | 13 +- .../workflow/toolbar-workflow-manager.d.ts | 41 +- .../inpage/src/workflow/workflow-helper.d.ts | 34 +- .../workflow-step-code-arguments.d.ts | 21 + .../src/workflow/workflow-step-helper.d.ts | 8 +- .../dist/inpage/src/workflow/workflow.d.ts | 17 +- projects/sxc-typings/index-alpha.d.ts | 1184 +++++++++++ projects/sxc-typings/index-beta.d.ts | 1184 +++++++++++ projects/sxc-typings/index-public.d.ts | 1184 +++++++++++ projects/sxc-typings/index-untrimmed.d.ts | 1877 +++++++++++++++++ projects/sxc-typings/index.d.ts | 2 +- projects/sxc-typings/package-lock.json | 374 +++- projects/sxc-typings/package.json | 4 +- projects/sxc-typings/tsconfig.json | 1 - projects/sxc-typings/tsdoc-metadata.json | 11 + 202 files changed, 10156 insertions(+), 177 deletions(-) create mode 100644 projects/sxc-typings/api-extractor.json create mode 100644 projects/sxc-typings/index-alpha.d.ts create mode 100644 projects/sxc-typings/index-beta.d.ts create mode 100644 projects/sxc-typings/index-public.d.ts create mode 100644 projects/sxc-typings/index-untrimmed.d.ts create mode 100644 projects/sxc-typings/tsdoc-metadata.json diff --git a/projects/$2sxc/src/cms/item-identifiers.ts b/projects/$2sxc/src/cms/item-identifiers.ts index 7f871f47a..6a52cc5b2 100644 --- a/projects/$2sxc/src/cms/item-identifiers.ts +++ b/projects/$2sxc/src/cms/item-identifiers.ts @@ -8,7 +8,7 @@ import { TypeValue } from '../../../inpage/src/plumbing'; * Shared properties of all item identifiers * @internal */ -interface ItemIdentifierShared { +export interface ItemIdentifierShared { EntityId?: number; Prefill?: Record; } diff --git a/projects/$2sxc/src/cms/run-params.ts b/projects/$2sxc/src/cms/run-params.ts index bf0da2aee..c0250f533 100644 --- a/projects/$2sxc/src/cms/run-params.ts +++ b/projects/$2sxc/src/cms/run-params.ts @@ -17,6 +17,7 @@ export interface RunParams { /** * The command params, like contentType, entityId etc. * Optional for many actions, but can themselves also contain the property `action`, in which case action can be ommited. + * @internal */ params?: CommandParams; diff --git a/projects/$2sxc/src/environment/index.ts b/projects/$2sxc/src/environment/index.ts index 4079fb7f1..ed5add297 100644 --- a/projects/$2sxc/src/environment/index.ts +++ b/projects/$2sxc/src/environment/index.ts @@ -1,3 +1,4 @@ export * from './environment-specs'; export * from './sxc-global-environment'; +export * from './env-loader-meta' \ No newline at end of file diff --git a/projects/$2sxc/src/index.ts b/projects/$2sxc/src/index.ts index 20a420da7..5fb9e4741 100644 --- a/projects/$2sxc/src/index.ts +++ b/projects/$2sxc/src/index.ts @@ -17,6 +17,7 @@ export * from './Stats'; export * from './environment'; +export * from './cms'; export * from './sxc'; export * from './sxc-global'; diff --git a/projects/$2sxc/src/sxc-global/index.ts b/projects/$2sxc/src/sxc-global/index.ts index fc5520cd3..8ffef52b8 100644 --- a/projects/$2sxc/src/sxc-global/index.ts +++ b/projects/$2sxc/src/sxc-global/index.ts @@ -3,4 +3,5 @@ export * from './context-identifier'; export * from './sxc-global'; export * from './sxc-global-debug'; export * from './sxc-global-bootstrap'; -export * from './sxc-global-manage'; \ No newline at end of file +export * from './sxc-global-manage'; +export * from './sxc-global-http' \ No newline at end of file diff --git a/projects/$2sxc/src/sxc/index.ts b/projects/$2sxc/src/sxc/index.ts index 4dac4a989..8e667df21 100644 --- a/projects/$2sxc/src/sxc/index.ts +++ b/projects/$2sxc/src/sxc/index.ts @@ -4,3 +4,9 @@ export * from './sxc-manage'; export * from './web-api/sxc-web-api'; export * from './web-api/ajax-promise'; export * from './web-api/ajax-settings'; +export * from './sxc-cms' +export * from './data/sxc-data' +export * from './data/sxc-query' +export * from './web-api/sxc-web-api-deprecated' +export * from './data/sxc-data-service-base' +export * from './sxc-part' \ No newline at end of file diff --git a/projects/core/logging/insights.ts b/projects/core/logging/insights.ts index 9e355e937..396a8eeeb 100644 --- a/projects/core/logging/insights.ts +++ b/projects/core/logging/insights.ts @@ -2,14 +2,14 @@ import { HasLog, Log } from '.'; declare const window: Window; -type LogList = Array<{ key: string, log: Log}>; +export type LogList = Array<{ key: string, log: Log}>; const msgIntro = 'This is the $2sxc JS Insights - see https://r.2sxc.org/insights \n' + 'Add ?debug=true to the url to log more data. \n' + 'Copy/paste code lines below to see details. \n' + '----------------------------------------------------------------------\n'; -class InsightsSingleton extends HasLog { +export class InsightsSingleton extends HasLog { constructor() { super('Sys.Insght'); @@ -76,7 +76,7 @@ class InsightsSingleton extends HasLog { } // tslint:disable-next-line: max-classes-per-file -class InsightsLogSet { +export class InsightsLogSet { logs: LogList = []; constructor(public name: string) {} } diff --git a/projects/core/plumbing/type-value.ts b/projects/core/plumbing/type-value.ts index e1790f167..5c6cba56a 100644 --- a/projects/core/plumbing/type-value.ts +++ b/projects/core/plumbing/type-value.ts @@ -1,6 +1,6 @@ /* * An overall type to ensure that something can be a value but not an object - * @internal + * @internal */ export type TypeValue = boolean | string | number | Date; diff --git a/projects/sxc-typings/api-extractor.json b/projects/sxc-typings/api-extractor.json new file mode 100644 index 000000000..822b40c5c --- /dev/null +++ b/projects/sxc-typings/api-extractor.json @@ -0,0 +1,376 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "./shared/api-extractor-base.json" + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "./index.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we can specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + */ + "bundledPackages": [], + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + // "tsconfigFilePath": "/tsconfig.json", + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": false + + /** + * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce + * a full file path. + * + * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: ".api.md" + */ + // "reportFileName": ".api.md", + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportFolder": "/temp/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportTempFolder": "/temp/" + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": false + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": true, + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + "untrimmedFilePath": "./index-untrimmed.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release. + * This file will include only declarations that are marked as "@public", "@beta", or "@alpha". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + "alphaTrimmedFilePath": "./index-alpha.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + "betaTrimmedFilePath": "./index-beta.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + "publicTrimmedFilePath": "./index-public.d.ts", + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + // "enabled": true, + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + // "newlineKind": "crlf", + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "warning" + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + } + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "warning" + // "addToApiReportFile": false + } + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "warning" + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } +} diff --git a/projects/sxc-typings/dist/$2sxc/src/Stats.d.ts b/projects/sxc-typings/dist/$2sxc/src/Stats.d.ts index cb0ff5c3b..62fec58d2 100644 --- a/projects/sxc-typings/dist/$2sxc/src/Stats.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/Stats.d.ts @@ -1 +1,4 @@ -export {}; +/** @internal */ +export declare class Stats { + watchDomChanges: number; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/_/window.d.ts b/projects/sxc-typings/dist/$2sxc/src/_/window.d.ts index b0c432ca4..c17f83eba 100644 --- a/projects/sxc-typings/dist/$2sxc/src/_/window.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/_/window.d.ts @@ -1,3 +1,4 @@ +/// import { SxcGlobal } from '../sxc-global'; /** * export interface WindowInternal extends @@ -8,5 +9,15 @@ declare global { * The global $2sxc object / function to generate Sxc instances */ $2sxc: SxcGlobal; + /** @internal */ + $: JQueryStatic & DnnJQueryExtensions; } } +/** @internal */ +interface DnnJQueryExtensions { + /** the generator for the DNN ServicesFramework */ + dnnSF: (id?: number) => any; + /** The DNN Services Framework */ + ServicesFramework: (id: number) => any; +} +export {}; diff --git a/projects/sxc-typings/dist/$2sxc/src/cms/command-names.d.ts b/projects/sxc-typings/dist/$2sxc/src/cms/command-names.d.ts index 6e9f8fb84..6ea72e10d 100644 --- a/projects/sxc-typings/dist/$2sxc/src/cms/command-names.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/cms/command-names.d.ts @@ -102,6 +102,11 @@ export declare enum CommandNames { * (auto-detected from context) */ edit = "edit", + /** + * `image` opens the edit-dialog for the metadata of the current image + * @internal - may be removed soon + */ + image = "image", /** * `insights-server` opens the insights logs page *
πŸ” Toolbar shows this automatically to elevated admins. @@ -161,6 +166,11 @@ export declare enum CommandNames { * (auto-detected from context) */ new = "new", + /** + * `new` sets new mode used in parameters + * @internal - must move, this shouldn't be here as it's not a command! + */ + newMode = "new", /** * `publish` tells the system to update a content-items status to published. If there was a published and a draft before, the draft will replace the previous item *
πŸ”˜ Appears automatically if the item is in draft mode / not published. diff --git a/projects/sxc-typings/dist/$2sxc/src/cms/command-params.d.ts b/projects/sxc-typings/dist/$2sxc/src/cms/command-params.d.ts index aea350e70..238355de9 100644 --- a/projects/sxc-typings/dist/$2sxc/src/cms/command-params.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/cms/command-params.d.ts @@ -1,6 +1,40 @@ +import { CommandNames, ItemIdentifierGroup, ItemIdentifierSimple, CommandParamsMetadata } from '.'; +import { TypeValue } from '../../../inpage/src/plumbing'; /** - * Stub interface for typescript definitions to because of export. - * Real implementation is more complex but not published. + * Command parameters are handed over to a command for execution + * @internal */ export interface CommandParams { + /** The action is used in scenarios where the command name must be included */ + action?: CommandNames; + items?: Array; + mode?: string; + contentType?: string; + contentTypeName?: string; + pipelineId?: number; + filters?: string; + dialog?: string; + sortOrder?: number; + entityId?: number; + /** The guid - for people creating custom toolbars before 10.27 or automatically added since 10.27 */ + entityGuid?: string; + /** The manually added title from before 10.27 - automatically enabled the delete-button */ + entityTitle?: string; + title?: string; + useModuleList?: boolean; + metadata?: CommandParamsMetadata; + isPublished?: boolean; + prefill?: Record; + /** Custom Code in the previous V9 standard */ + customCode?: string; + /** Custom Code function name only in the new V10.27 standard */ + call?: string; + /** New in 10.27 - list of apps for the quick dialog */ + apps?: string; + /** Experimental in 10.27 */ + parent?: string; + /** Experimental in 10.27 */ + fields?: string; + /** for template edit dialog */ + isshared?: boolean; } diff --git a/projects/sxc-typings/dist/$2sxc/src/cms/item-identifiers.d.ts b/projects/sxc-typings/dist/$2sxc/src/cms/item-identifiers.d.ts index cb0ff5c3b..ba672c52f 100644 --- a/projects/sxc-typings/dist/$2sxc/src/cms/item-identifiers.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/cms/item-identifiers.d.ts @@ -1 +1,73 @@ -export {}; +import { CommandParamsMetadata } from '.'; +import { TypeValue } from '../../../inpage/src/plumbing'; +/** + * Shared properties of all item identifiers + * @internal + */ +export interface ItemIdentifierShared { + EntityId?: number; + Prefill?: Record; +} +/** + * Simple identifier, which is id/type-name + * @internal + */ +export interface ItemIdentifierSimple { + EntityId: number; + ContentTypeName?: string; + Metadata?: CommandParamsMetadata; + Prefill?: Record; +} +/** + * Simple identifier, which is id/type-name + * @internal + * WAIT with publishing, we'll probably change the duplicate-entity to a bool instead of an id + */ +export interface ItemIdentifierCopy extends ItemIdentifierShared { + DuplicateEntity: number; + ContentTypeName?: string; +} +/** + * Group identifier + * @internal + * TODO: KEEP INTERNAL, PROBABLY RENAME "Part" to "Field" or something in the whole chain + * TODO: MAY BE replaced completely with ItemIdentifierInField, as it has the same purpose + */ +export interface ItemIdentifierParent { + /** The parent entity GUID - in these cases usually the ContentBlock */ + Guid: string; + /** The part of the parent it's in, kind of the "Field" - should be renamed to Field ASAP */ + Part?: string; + /** The index position within that field/part */ + Index: number; + /** Whether to add the item - alternative is just to leave it, if it already existed */ + Add: boolean; +} +/** + * Experimental in 10.27 + * @internal + */ +export interface ItemIdentifierInField extends ItemIdentifierSimple { + Parent?: string; + Field?: string; + Add?: boolean; +} +/** + * Template Identifier for telling the code-editor about this template + * @internal + */ +export interface TemplateIdentifier { + /** The entity Id of the View-configuration which points to the template file */ + EntityId: number; + /** The template edition (kind of a path) - to ensure code-editor can find the right one */ + Edition?: string; + /** The template path */ + Path?: string; +} +/** + * Complex identifier using a group + * @internal + */ +export interface ItemIdentifierGroup extends ItemIdentifierShared { + Group: ItemIdentifierParent; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/cms/run-params.d.ts b/projects/sxc-typings/dist/$2sxc/src/cms/run-params.d.ts index dfda81a93..006c6efef 100644 --- a/projects/sxc-typings/dist/$2sxc/src/cms/run-params.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/cms/run-params.d.ts @@ -14,6 +14,7 @@ export interface RunParams { /** * The command params, like contentType, entityId etc. * Optional for many actions, but can themselves also contain the property `action`, in which case action can be ommited. + * @internal */ params?: CommandParams; /** diff --git a/projects/sxc-typings/dist/$2sxc/src/constants/index.d.ts b/projects/sxc-typings/dist/$2sxc/src/constants/index.d.ts index cb0ff5c3b..d9ec1f752 100644 --- a/projects/sxc-typings/dist/$2sxc/src/constants/index.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/constants/index.d.ts @@ -1 +1,28 @@ -export {}; +/** + * This is a placeholder in the settings, which must be replaced with "2sxc" or another term for other dnn extensions + * @internal + */ +export declare const ApiExtensionPlaceholder = "e.x.t"; +/** + * The special header meta tag containing settings for 2sxc + * @internal + */ +export declare const MetaHeaderJsApi = "_jsApi"; +/** + * The fallback path to the UI + * @internal + */ +export declare const DnnUiRoot = "/desktopmodules/tosic_sexycontent/"; +/** + * @internal + */ +export declare const PlatformOqtane = "oqtane"; +/** + * @internal + */ +export declare const PlatformDnn = "dnn"; +/** + * The fallback AntiForgery token header name (as in Dnn) + * @internal + */ +export declare const AntiForgeryTokenHeaderNameDnn = "RequestVerificationToken"; diff --git a/projects/sxc-typings/dist/$2sxc/src/data/metadata-for.d.ts b/projects/sxc-typings/dist/$2sxc/src/data/metadata-for.d.ts index 56d70e8c2..02153a5d8 100644 --- a/projects/sxc-typings/dist/$2sxc/src/data/metadata-for.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/data/metadata-for.d.ts @@ -31,4 +31,8 @@ export interface MetadataFor { * @memberof MetadataFor */ Guid?: string; + /** + * @internal + */ + Singleton?: boolean; } diff --git a/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dnn-sf.d.ts b/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dnn-sf.d.ts index cb0ff5c3b..5df2b8045 100644 --- a/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dnn-sf.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dnn-sf.d.ts @@ -1 +1,17 @@ -export {}; +import { SxcGlobalEnvironment } from '.'; +import { HasLog } from '../../../core'; +/** + * This helps load environment information from DNN ServicesFramework - it's a fallback in case the other mechanisms fail + * @internal + */ +export declare class EnvironmentDnnSfLoader extends HasLog { + env: SxcGlobalEnvironment; + constructor(env: SxcGlobalEnvironment); + /** + * This will assume the new parameter injection failed and it will attempt to fallback + * it's for backward compatibility, in case something is using $2sxc and doesn't provide the new + * implementation + */ + dnnSfFallback(): void; + private dnnSfLoadWhenDocumentReady; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dynamic.d.ts b/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dynamic.d.ts index cb0ff5c3b..a6f821bd7 100644 --- a/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dynamic.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-dynamic.d.ts @@ -1 +1,23 @@ -export {}; +import { Log } from '../../../core'; +import { EnvironmentMetaLoader } from './env-loader-meta'; +/** + * Special loader for dynamic pages like Oqtane, where content can change at runtime + * @internal + */ +export declare class EnvironmentLoaderDynamic { + private mainLoader; + log: Log; + constructor(mainLoader: EnvironmentMetaLoader); + /** + * Watch for changes in our special meta header, to update the variables. + * Important for Oqtane, which changes the page on the fly without reloading. + */ + startMetaTagObserver(attribute: string): void; + private observer; + /** + * Load RequestVerificationToken from the hidden form-field in Oqtane + */ + startInputRvtObserver(): void; + private inputRvtObserver; + private loadRvtFromHiddenInput; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-meta.d.ts b/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-meta.d.ts index cb0ff5c3b..a55b197a2 100644 --- a/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-meta.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/environment/env-loader-meta.d.ts @@ -1 +1,25 @@ -export {}; +import { EnvironmentSpecs } from '..'; +import { SxcGlobalEnvironment } from '.'; +import { HasLog, Log } from '../../../core'; +/** + * This loads environment information from the meta-header tag. + * Because of timing issues, it will try multiple times + * @internal + */ +export declare class EnvironmentMetaLoader extends HasLog { + env: SxcGlobalEnvironment; + retries: number; + log: Log; + private dynamicPageHelper; + constructor(env: SxcGlobalEnvironment); + loadMetaFromHeader(forceFallback?: boolean): void; + updateEnv(newJsInfo: EnvironmentSpecs): void; + getMetaContent(): string; + getJsApiMetaTag(): Element; + /** + * Watch for changes in our special meta header, to update the variables. + * Important for Oqtane, which changes the page on the fly without reloading. + */ + startMetaTagObserver(): void; + private observer; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/environment/environment-specs.d.ts b/projects/sxc-typings/dist/$2sxc/src/environment/environment-specs.d.ts index 6ba732847..74465d99e 100644 --- a/projects/sxc-typings/dist/$2sxc/src/environment/environment-specs.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/environment/environment-specs.d.ts @@ -14,6 +14,11 @@ export interface EnvironmentSpecs { rvtHeader: string; /** Request verification token value */ rvt: string; + /** + * The root path for the UI + * @internal + */ + uiRoot: string; /** The platform code like 'dnn' or 'oqt' */ platform: string; } diff --git a/projects/sxc-typings/dist/$2sxc/src/environment/index.d.ts b/projects/sxc-typings/dist/$2sxc/src/environment/index.d.ts index 90896bb0b..5fe2a316d 100644 --- a/projects/sxc-typings/dist/$2sxc/src/environment/index.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/environment/index.d.ts @@ -1,2 +1,3 @@ export * from './environment-specs'; export * from './sxc-global-environment'; +export * from './env-loader-meta'; diff --git a/projects/sxc-typings/dist/$2sxc/src/environment/sxc-global-environment.d.ts b/projects/sxc-typings/dist/$2sxc/src/environment/sxc-global-environment.d.ts index c74cb30f0..cfae897a6 100644 --- a/projects/sxc-typings/dist/$2sxc/src/environment/sxc-global-environment.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/environment/sxc-global-environment.d.ts @@ -1,9 +1,12 @@ import { EnvironmentSpecs } from '..'; +import { EnvironmentMetaLoader } from './env-loader-meta'; import { HasLog } from '../../../core'; /** * Provides environment information to $2sxc - usually page-id, api-root and stuff like that */ export declare class SxcGlobalEnvironment extends HasLog { + /** @internal */ + private header; /** * Flag to determine if the environment information is available. */ @@ -12,6 +15,10 @@ export declare class SxcGlobalEnvironment extends HasLog { * Where the environment information came from. */ source: string; + /** @internal */ + metaLoader: EnvironmentMetaLoader; + /** @internal */ + constructor(); /** * Manually load a new EnvironmentSpecs in cases where the page cannot provide them. * This is only used in scenarios outside of Dnn / Oqtane, you will usually not need this. @@ -19,10 +26,16 @@ export declare class SxcGlobalEnvironment extends HasLog { * @param source _optional_ name where the data came from */ load(envSpecs: EnvironmentSpecs, source?: string): void; + /** @internal */ + private replacedRvt; + /** @internal */ + updateRvt(newRvt: string): void; /** * The API endpoint url from the environment */ api(): string; + /** @internal */ + appApi(): string; /** * The current page ID - often needed in API calls */ @@ -35,8 +48,15 @@ export declare class SxcGlobalEnvironment extends HasLog { * The request-verification token for internal WebAPI calls */ rvt(): string; + /** + * The uiRoot path + * @internal + */ + uiRoot(): string; /** * The platform code like 'oqt' or 'dnn' in case the JS needs to know the difference */ platform(): string; + /** @internal */ + private ensureReadyOrThrow; } diff --git a/projects/sxc-typings/dist/$2sxc/src/index.d.ts b/projects/sxc-typings/dist/$2sxc/src/index.d.ts index f6b73cfb3..391fffe6b 100644 --- a/projects/sxc-typings/dist/$2sxc/src/index.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/index.d.ts @@ -4,5 +4,6 @@ export * from './tools'; export * from './constants'; export * from './Stats'; export * from './environment'; +export * from './cms'; export * from './sxc'; export * from './sxc-global'; diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/context-identifier.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/context-identifier.d.ts index 235dc4b16..0df87fe6c 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/context-identifier.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/context-identifier.d.ts @@ -22,4 +22,33 @@ export declare class ContextIdentifier { * @optional */ moduleId?: number; + /** + * Exclude pageId and moduleId headers in web requests + * @internal + */ + _ignoreHeaders?: boolean; + /** + * Marks the context as complete, so it won't merge in anything else + * WIP #CustomContext ATM for the updated edit-ui + * @internal + */ + complete?: boolean; + /** + * WIP #CustomContext not really used yet + * @internal + */ + blockId?: number; + /** + * Type Guard to determine if an object is a ContextIdentifier + * @param original + * @returns + * @internal + */ + static is(original: unknown): original is ContextIdentifier; + /** + * Internal + * @param ctx + * @internal + */ + static ensureCompleteOrThrow(ctx: ContextIdentifier): ContextIdentifier; } diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/index.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/index.d.ts index ee34002f5..7a575ae91 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/index.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/index.d.ts @@ -3,3 +3,4 @@ export * from './sxc-global'; export * from './sxc-global-debug'; export * from './sxc-global-bootstrap'; export * from './sxc-global-manage'; +export * from './sxc-global-http'; diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-bootstrap.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-bootstrap.d.ts index cb0ff5c3b..fbcc6d364 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-bootstrap.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-bootstrap.d.ts @@ -1 +1,6 @@ -export {}; +import { SxcGlobal } from '..'; +/** + * Build a SXC Controller for the page. Should only ever be executed once + * @internal + */ +export declare function buildSxcRoot(): SxcGlobal; diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-debug.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-debug.d.ts index cb0ff5c3b..f799d0bd7 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-debug.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-debug.d.ts @@ -1 +1,12 @@ -export {}; +/** @internal */ +export declare class SxcGlobalDebug { + /** + * The load-debug state (provided by the url with debug=true) + */ + load: boolean; + /** + * Cache breaker string, contans the version number of 2sxc if one is provided with sxcver=... + */ + uncache: string; + constructor(); +} diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-get.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-get.d.ts index cb0ff5c3b..c19ff9934 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-get.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-get.d.ts @@ -1 +1,10 @@ -export {}; +import { Sxc } from '..'; +import { ContextIdentifier } from './context-identifier'; +/** + * returns a 2sxc-instance of the id or html-tag passed in + * @param id + * @param cbid + * @returns {} + * @internal + */ +export declare function $2sxcGet(id: number | ContextIdentifier | HTMLElement | Sxc, cbid?: number): Sxc; diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-http.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-http.d.ts index b5e32e5b3..70b556af2 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-http.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-http.d.ts @@ -1,10 +1,12 @@ import { HasLog } from '../../../core'; -import { ContextIdentifier } from '..'; +import { ContextIdentifier, SxcGlobalEnvironment } from '..'; /** * Global HTTP Service for information and helpers on `$2sxc.http` */ export declare class SxcGlobalHttp extends HasLog { private env; + /** @internal */ + constructor(env: SxcGlobalEnvironment); /** * All the headers which are needed in an ajax call. * @returns Dictionary / Record of headers @@ -33,6 +35,23 @@ export declare class SxcGlobalHttp extends HasLog { * @returns Dictionary / Record of headers */ headers(id: number, cbid: number, ctx: ContextIdentifier): Record; + /** + * Get the API-Root path for a specific extension/endpoint + * @param endpointName + * @returns {string} + * @memberof Http + * @internal Not relevant for 2sxc, only used if calling platform endpoints + */ + apiRoot(endpointName: string): string; + /** + * Get the API-Root path for Apps + * new in v12 + * @param {string} endpointName + * @returns {string} + * @memberof SxcHttp + * @internal + */ + appApiRoot(): string; /** * Convert short urls like `app/auto/api/Posts/All` to the full URL needed. * Will ignore urls which clearly already are the full url. diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-manage.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-manage.d.ts index cb0ff5c3b..b4a06b32e 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-manage.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global-manage.d.ts @@ -1 +1,13 @@ -export {}; +import { Sxc } from '..'; +/** + * @internal + */ +export interface SxcGlobalManage { + /** + * Init the manage-object on a just-created sxc-instance + * we must keep signature of initInstance in sync with the 2sxc.api.js + * @param sxc + */ + initInstance(sxc: Sxc): void; + _toolbarManager: any; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global.d.ts index 7b77520b9..40038fa81 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc-global/sxc-global.d.ts @@ -1,8 +1,9 @@ import { UrlParams } from '../tools'; import { SxcGlobalEnvironment } from '../environment'; -import { Log } from '../../../core'; -import { ContextIdentifier, Sxc } from '..'; +import { Insights, Log } from '../../../core'; +import { ContextIdentifier, SxcGlobalDebug, Stats, Sxc, TotalPopup } from '..'; import { SxcGlobalHttp } from './sxc-global-http'; +import { SxcGlobalManage } from './sxc-global-manage'; /** * This is the root global `window.$2sxc` function / object. * @@ -56,6 +57,22 @@ export interface SxcGlobal { * @since v14.01 */ get(sxc: Sxc): Sxc; + /** @internal */ + _controllers: { + [id: string]: Sxc; + }; + /** @internal */ + beta: any; + /** @internal */ + _manage: SxcGlobalManage; + /** @internal */ + _translateInit: any; + /** + * 2022-06-01 2dm - I believe this is not used, probably remove + * @internal */ + debug: SxcGlobalDebug; + /** @internal */ + stats: Stats; /** * system information, mainly for checking which version of 2sxc is running * note: it's not always updated reliably, but it helps when debugging @@ -84,6 +101,8 @@ export interface SxcGlobal { * @param length amount of lines to show - in some cases will default to 25 */ insights(partName: string, index?: number, start?: number, length?: number): void; + /** @internal */ + _insights: typeof Insights; /** * Internal logger to better see what's happening */ @@ -94,4 +113,9 @@ export interface SxcGlobal { * @memberof SxcRoot */ urlParams: UrlParams; + /** + * A helper to create full-screen popups + * @internal + */ + totalPopup: TotalPopup; } diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data-service-base.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data-service-base.d.ts index cb0ff5c3b..8ae752cce 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data-service-base.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data-service-base.d.ts @@ -1 +1,18 @@ -export {}; +import { Sxc } from '..'; +import { SxcPart } from '../sxc-part'; +import { SxcWebApi } from '../web-api/sxc-web-api'; +/** +* Base class doing common checks +* @internal +*/ +export declare class SxcDataServiceBase extends SxcPart { + readonly name: string; + protected readonly webApi: SxcWebApi; + /** + * Creates an instance of SxcData. + * @param {Sxc} sxc + * @param {string} name the content-type name + * @memberof SxcData + */ + constructor(sxc: Sxc, name: string, nameInError: string); +} diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data.d.ts index e10903789..d7e3460d2 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-data.d.ts @@ -1,3 +1,4 @@ +import { Sxc } from '..'; import { MetadataFor } from '../../data/metadata-for'; import { SxcDataServiceBase } from './sxc-data-service-base'; /** @@ -5,6 +6,14 @@ import { SxcDataServiceBase } from './sxc-data-service-base'; */ export declare class SxcData extends SxcDataServiceBase { readonly name: string; + /** + * Creates an instance of SxcData. + * @param {Sxc} sxc + * @param {string} name the content-type name + * @memberof SxcData + * @internal + */ + constructor(sxc: Sxc, name: string); /** * Get all items of this type. */ @@ -13,6 +22,18 @@ export declare class SxcData extends SxcDataServiceBase { * Get the specific item with the ID. It will return null if not found */ getOne(id: number): Promise | null; + /** Future + * @internal + */ + private getMany; + /** + * Get all or one data entity from the backend + * @param id optional id as number or string - if not provided, will get all + * @param params optional parameters - ATM not usefuly but we plan to support more filters etc. + * @returns an array with 1 or n entities in the simple JSON format + * @internal + */ + private getInternal; /** * Create a new entity with the values supplied * @param values a simple object containing the values to create diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-query.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-query.d.ts index 460b389c4..a6bac1012 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-query.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/data/sxc-query.d.ts @@ -1,9 +1,18 @@ +import { Sxc } from '..'; import { SxcDataServiceBase } from './sxc-data-service-base'; /** * Instance Query Service */ export declare class SxcQuery extends SxcDataServiceBase { readonly name: string; + /** + * Creates an instance of SxcQuery. + * @param {Sxc} sxc + * @param {string} name + * @memberof SxcQuery + * @internal + */ + constructor(sxc: Sxc, name: string); getAll(): Promise; getAll(urlParams: string | Record): Promise; getAll(urlParams: string | Record, data: string | Record): Promise; @@ -21,4 +30,12 @@ export declare class SxcQuery extends SxcDataServiceBase { getStreams(streams: string): Promise; getStreams(streams: string, urlParams: string | Record): Promise; getStreams(streams: string, urlParams: string | Record, data: string | Record): Promise; + /** + * Get all or one data entity from the backend + * @param id optional id as number or string - if not provided, will get all + * @param params optional parameters - ATM not usefuly but we plan to support more filters etc. + * @returns an array with 1 or n entities in the simple JSON format + * @internal + */ + private getInternal; } diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/index.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/index.d.ts index 5d480078b..836aa4f7a 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/index.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/index.d.ts @@ -3,3 +3,9 @@ export * from './sxc-manage'; export * from './web-api/sxc-web-api'; export * from './web-api/ajax-promise'; export * from './web-api/ajax-settings'; +export * from './sxc-cms'; +export * from './data/sxc-data'; +export * from './data/sxc-query'; +export * from './web-api/sxc-web-api-deprecated'; +export * from './data/sxc-data-service-base'; +export * from './sxc-part'; diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-cms.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-cms.d.ts index 24e2e499d..16b92abcf 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-cms.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-cms.d.ts @@ -1,11 +1,14 @@ import { SxcPart } from './sxc-part'; import { RunParams } from '../cms/run-params'; +import { Sxc } from '.'; /** * This is in charge of sxc.cms on the instance level. * ATM it just has the run command. * In future, it may also have dedicated command like `layout` etc. */ export declare class SxcCms extends SxcPart { + /** @internal */ + constructor(sxc: Sxc); /** * Run a command on this sxc-instance. * Requires edit mode to be on, which would enable the edit-JS parts. diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-manage.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-manage.d.ts index cb0ff5c3b..cd785f103 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-manage.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-manage.d.ts @@ -1 +1,12 @@ -export {}; +/** @internal */ +export interface SxcManage { + /** + * The context contains information about the Sxc Instance, like module-id, etc. + */ + context: any; + /** + * This checks / reports whether the API is in edit mode. + * Used to enabled/disable various features + */ + _isEditMode(): boolean; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-part.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-part.d.ts index cb0ff5c3b..b1004acee 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-part.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc-part.d.ts @@ -1 +1,23 @@ -export {}; +import { Sxc } from '..'; +/** +* Base class for anything attached to an sxc-instance +* @internal +*/ +export declare class SxcPart { + /** @internal */ + sxc: Sxc; + /** @internal */ + partName: string; + /** + * Creates an instance of SxcData. + * @param {Sxc} sxc + * @param {string} partName name of the part + * @memberof SxcData + * @internal + */ + constructor( + /** @internal */ + sxc: Sxc, + /** @internal */ + partName: string); +} diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc.d.ts index f64b1c46e..b0820de86 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/sxc.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/sxc.d.ts @@ -1,7 +1,10 @@ +import { ContextIdentifier } from '../sxc-global/context-identifier'; import { SxcWebApi } from './web-api/sxc-web-api'; import { HasLog } from '../../../core'; +import { SxcManage } from './sxc-manage'; import { SxcData } from './data/sxc-data'; import { SxcQuery } from './data/sxc-query'; +import { SxcGlobal } from '..'; import { SxcCms } from './sxc-cms'; /** * The typical sxc-instance object for a specific DNN module or content-block @@ -14,6 +17,23 @@ export declare class Sxc extends HasLog { * this is an advanced concept you usually don't care about, otherwise you should research it */ cbid: number; + /** + * the id/key of this instance in the cache for reset + * @internal + */ + cacheKey: string; + /** + * The environment information, important for http-calls + * @internal + */ + readonly root: SxcGlobal; + /** + * Custom context information provided by the constructor - will replace auto-context detection + * @internal + */ + ctx?: ContextIdentifier; + /** @internal */ + private _isSxcInstance; /** * Web API calls for this instance. * This is the pure call APIs system. @@ -22,10 +42,47 @@ export declare class Sxc extends HasLog { * @memberof Sxc */ webApi: SxcWebApi; + /** + * manage object which provides access to additional content-management features + * it only exists if 2sxc is in edit mode (otherwise the JS are not included for these features) + * @memberof SxcInstance + * @internal + */ + manage: SxcManage; /** * CMS operations on this sxc-instance, such as opening the edit dialog etc. */ cms: SxcCms; + /** @internal */ + constructor( + /** the sxc-instance ID, which is usually the DNN Module Id */ + id: number, + /** + * content-block ID, which is either the module ID, or the content-block definition entity ID + * this is an advanced concept you usually don't care about, otherwise you should research it + */ + cbid: number, + /** + * the id/key of this instance in the cache for reset + * @internal + */ + cacheKey: string, + /** + * The environment information, important for http-calls + * @internal + */ + root: SxcGlobal, + /** + * Custom context information provided by the constructor - will replace auto-context detection + * @internal + */ + ctx?: ContextIdentifier); + /** + * TypeGuard for TypeScript to verify this is a SxcInstance + * @param thing + * @internal + */ + static is(thing: unknown): thing is Sxc; /** * Get a data service for a specific content-type. * @@ -41,9 +98,32 @@ export declare class Sxc extends HasLog { * @memberof SxcInstance */ query(query: string): SxcQuery; + /** + * converts a short api-call path like "/app/Blog/query/xyz" to the DNN full path + * which varies from installation to installation like "/desktopmodules/api/2sxc/app/..." + * @deprecated use http.apiUrl instead + * @param virtualPath + * @returns mapped path + * @internal + */ + resolveServiceUrl(virtualPath: string): string; + /** + * Show a nice error with more infos around 2sxc + * @param result + * @returns + * @internal + */ + showDetailedHttpError(result: any): any; /** * Test if the current code is in edit-mode and additional javascripts have been loaded to make it work * @returns true if we are in edit-mode */ isEditMode(): boolean; + /** + * + * @param resetCache + * @returns + * @internal + */ + recreate(resetCache: boolean): Sxc; } diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-promise.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-promise.d.ts index cb0ff5c3b..ff7a0cf20 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-promise.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-promise.d.ts @@ -1 +1,21 @@ -export {}; +/// +import { Sxc, SxcWebApi } from '..'; +import { AjaxSettings } from './ajax-settings'; +/** @internal */ +export declare class AjaxPromise { + private api; + private sxc; + constructor(api: SxcWebApi, sxc: Sxc); + /** + * Make a jQuery style promise request + * @param {AjaxSettings} settings + * @returns {JQueryPromise} + * @memberof AjaxPromise + */ + makePromise(settings: AjaxSettings): JQueryPromise; + /** + * Generate the correct WebApi url + * @param settings the settings as they would be in jQuery + */ + private getActionUrl; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-settings.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-settings.d.ts index cb0ff5c3b..5f30c05f2 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-settings.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/ajax-settings.d.ts @@ -1 +1,13 @@ -export {}; +/// +/** @internal */ +export interface AjaxSettings extends JQueryAjaxSettings { + /** Override the endpoint, which is usually '2sxc' */ + endpoint?: string; + /** Controller name, for controller/action calls */ + controller?: string; + /** action name, for controller/action calls */ + action?: string; + /** The params to be used in the url for the request */ + params?: any; + preventAutoFail?: boolean; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/sxc-web-api.d.ts b/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/sxc-web-api.d.ts index 13b721eb6..783165cf9 100644 --- a/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/sxc-web-api.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/sxc/web-api/sxc-web-api.d.ts @@ -1,3 +1,7 @@ +/// +import { Sxc } from '../sxc'; +import { SxcGlobalEnvironment } from '../../environment'; +import { AjaxSettings } from './ajax-settings'; import { SxcWebApiDeprecated } from './sxc-web-api-deprecated'; /** * helper API to run ajax / REST calls to the server @@ -6,6 +10,48 @@ import { SxcWebApiDeprecated } from './sxc-web-api-deprecated'; */ export declare class SxcWebApi implements SxcWebApiDeprecated { private readonly sxc; + /** + * @type {SxcGlobalEnvironment} + * @memberof SxcWebApi + * @internal + */ + readonly env: SxcGlobalEnvironment; + /** + * + * @param sxc + * @internal + */ + constructor(sxc: Sxc); + /** + * **Deprecated** - docs in the separate interface + * @deprecated use fetchJson instead + * @internal + */ + get(settingsOrUrl: string | AjaxSettings, params?: any, data?: any, preventAutoFail?: boolean): JQueryPromise; + /** + * **Deprecated** - docs in the separate interface + * @deprecated use fetchJson instead + * @internal + */ + post(settingsOrUrl: string | AjaxSettings, params?: any, data?: any, preventAutoFail?: boolean): JQueryPromise; + /** + * **Deprecated** - docs in the separate interface + * @deprecated use fetchJson instead + * @internal + */ + delete(settingsOrUrl: string | AjaxSettings, params?: any, data?: any, preventAutoFail?: boolean): JQueryPromise; + /** + * **Deprecated** - docs in the separate interface + * @deprecated use fetchJson instead + * @internal + */ + put(settingsOrUrl: string | AjaxSettings, params?: any, data?: any, preventAutoFail?: boolean): JQueryPromise; + /** + * **Deprecated** - docs in the separate interface + * @deprecated use fetchJson instead + * @internal + */ + request(settings: string | AjaxSettings, params: any, data: any, preventAutoFail: boolean, method: string): JQueryPromise; /** * Will retrieve data from the backend using a standard fetch. * @param url a full url or short-hand like `controller/method?params` `app/auto/api/controller/method?params`. Note that params would also be specified on the url. @@ -20,6 +66,8 @@ export declare class SxcWebApi implements SxcWebApiDeprecated { * maybe: webApi.fetchRaw({url: ..., params: { ...}, body: { ...}, method: 'GET' }) */ fetchRaw(url: string, data?: string | Record, method?: string): Promise; + /** @internal */ + fetch(url: string, data?: string | Record, method?: string): Promise; /** * Will retrieve data from the backend using a standard fetch and give you an object. * @param url a full url or short-hand like `controller/method?params` `app/auto/api/controller/method?params`. Note that params would also be specified on the url. diff --git a/projects/sxc-typings/dist/$2sxc/src/tools/obj2url.d.ts b/projects/sxc-typings/dist/$2sxc/src/tools/obj2url.d.ts index cb0ff5c3b..65028a197 100644 --- a/projects/sxc-typings/dist/$2sxc/src/tools/obj2url.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/tools/obj2url.d.ts @@ -1 +1,18 @@ -export {}; +/** + * Custom converter to pass objects into a URL and back. + * @internal + */ +export declare class ToolUrlObjects { + toUrl(obj: any, encode?: boolean): string; + toObj(value: string, decode?: boolean, debug?: boolean): unknown; + /** + * Converts an object to a compact notation with dots. + * Recursive, as it needs to also handle sub-objects + * @param obj + * @param key + * @param depth + * @returns + */ + private toUrlRecursive; + back(val: string, decode: boolean): Record; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/tools/total-popup.d.ts b/projects/sxc-typings/dist/$2sxc/src/tools/total-popup.d.ts index cb0ff5c3b..7cd109f47 100644 --- a/projects/sxc-typings/dist/$2sxc/src/tools/total-popup.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/tools/total-popup.d.ts @@ -1 +1,8 @@ -export {}; +/** @internal */ +export declare class TotalPopup { + frame: any; + callback: any; + open(url: string, callback: () => void): void; + close(): void; + closeThis(): void; +} diff --git a/projects/sxc-typings/dist/$2sxc/src/tools/url-params.d.ts b/projects/sxc-typings/dist/$2sxc/src/tools/url-params.d.ts index 6be7037ea..be7d65c4c 100644 --- a/projects/sxc-typings/dist/$2sxc/src/tools/url-params.d.ts +++ b/projects/sxc-typings/dist/$2sxc/src/tools/url-params.d.ts @@ -22,4 +22,20 @@ export declare class UrlParams { * @returns */ isDebug(): boolean; + /** + * Convert an object to be used in a URL. + * Uses a custom, brief syntax which can change at any time. + * So to unwrap, always use the toObj method. + * @param obj + * @returns + * @internal + */ + toUrl(obj: any): string; + /** + * Convert a url which was created by toUrl back to an object. + * @param url + * @returns + * @internal + */ + toObj(url: string): unknown; } diff --git a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/idialog-frame-element.d.ts b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/idialog-frame-element.d.ts index cb0ff5c3b..756998b09 100644 --- a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/idialog-frame-element.d.ts +++ b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/idialog-frame-element.d.ts @@ -1 +1,10 @@ -export {}; +import { IIFrameBridge } from './iiframe-bridge'; +/** + * @internal + */ +export interface IDialogFrameElement extends HTMLIFrameElement { + /** The bridge object which can handle commands from the other side */ + bridge: IIFrameBridge; + /** store previous height for changing again later on */ + previousHeight: number; +} diff --git a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iiframe-bridge.d.ts b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iiframe-bridge.d.ts index cb0ff5c3b..d9fee203a 100644 --- a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iiframe-bridge.d.ts +++ b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iiframe-bridge.d.ts @@ -1 +1,18 @@ -export {}; +import { IQuickDialogConfig } from './iquick-dialog-config'; +/** + * Connection object between inpage and quick-edit dialog for messaging back and forth + * @internal + */ +export interface IIFrameBridge { + getAdditionalDashboardConfig(): IQuickDialogConfig; + hide(): void; + run(verb: string): void; + showMessage(message: string): void; + reloadAndReInit(): Promise; + setTemplate(templateId: number, templateName: string, closeDialog: boolean): Promise; + /** + * the cancel callback to close this dialog cancelling changes + */ + cancel(): void; + changed: boolean; +} diff --git a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iquick-dialog-config.d.ts b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iquick-dialog-config.d.ts index cb0ff5c3b..4796558bd 100644 --- a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iquick-dialog-config.d.ts +++ b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/iquick-dialog-config.d.ts @@ -1 +1,15 @@ -export {}; +/** + * configuration for quick-dialog, so it can adjust the UI + * @internal + */ +export interface IQuickDialogConfig { + appId: number; + isContent: boolean; + isInnerContent: boolean; + hasContent: boolean; + isList: boolean; + templateId: number; + contentTypeId: string; + supportsAjax: boolean; + debug: boolean; +} diff --git a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/quick-dialog-params.d.ts b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/quick-dialog-params.d.ts index cb0ff5c3b..ce5675d68 100644 --- a/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/quick-dialog-params.d.ts +++ b/projects/sxc-typings/dist/connect-parts/inpage-quick-dialog/quick-dialog-params.d.ts @@ -1 +1,30 @@ -export {}; +/** + * These are all the url params the UI needs to function + * @internal + */ +export declare const urlParams: { + pageId: string; + /** + * request verification token header name + */ + requestVerificationTokenHeader: string; + /** + * request verification token value + */ + requestVerificationToken: string; + api: string; + /** + * Context: App we're on. + * This is often 0 (zero) as initially it's not known. + */ + appId: string; + /** + * Selection of what apps should be shown by the dialog + * this is an optional parameter + */ + apps: string; + /** Context: Module we're on */ + moduleId: string; + /** Context: ContentBlock we're on */ + contentBlockId: string; +}; diff --git a/projects/sxc-typings/dist/core/constants/index.d.ts b/projects/sxc-typings/dist/core/constants/index.d.ts index cb0ff5c3b..a2bbd4fbb 100644 --- a/projects/sxc-typings/dist/core/constants/index.d.ts +++ b/projects/sxc-typings/dist/core/constants/index.d.ts @@ -1 +1,30 @@ -export {}; +/** @internal */ +export declare const ToSxcName = "2sxc"; +/** @internal */ +export declare const SxcVersion: string; +/** @internal */ +export declare const SxcApiUrlRoot = "desktopmodules/2sxc/api/"; +/** @internal */ +export declare const HeaderNames: { + ContentBlockId: string; + ModuleId: string; + TabId: string; + PageId: string; +}; +/** @internal */ +export declare const ApiUrlRoots: string[]; +/** @internal */ +export declare const AppApiMarker = "app"; +/** @internal */ +export declare const AppApiMap: { + 'app-api': string; + 'app-query': string; + 'app-content': string; +}; +/** + * This is a marker for an ID which is not defined + * This is for situations where a 0 or even a negative number + * could be real numbers, so this number is so big, it should never be a real ID + * @internal + */ +export declare const NumberNotDefinedHuge = 274200000000; diff --git a/projects/sxc-typings/dist/core/logging/Log.d.ts b/projects/sxc-typings/dist/core/logging/Log.d.ts index 49e722a5f..8a3457911 100644 --- a/projects/sxc-typings/dist/core/logging/Log.d.ts +++ b/projects/sxc-typings/dist/core/logging/Log.d.ts @@ -1,4 +1,4 @@ -import { LogEntry } from '.'; +import { LogEntry, LogCall } from '.'; /** * A log object which will collect log entries for another ojbect * @export @@ -9,10 +9,52 @@ export declare class Log { * List of all entries added to this log */ entries: LogEntry[]; + /** @internal */ + private depth; + /** @internal */ + private callDepths; + /** @internal */ + startTime: number; /** * Maximum amount of entries to add - to prevent memory hoging */ maxEntries: number; + /** + * Create a logger and optionally attach it to a parent logger + * @param string name this logger should use + * @param Log optional parrent logger to attach to + * @param string optional initial message to log + * @internal + */ + constructor(name: string, parent?: Log, initialMessage?: string); + /** @internal */ + liveDump: boolean; + /** @internal */ + _parentHasLiveDump: boolean; + /** @internal */ + keepData: boolean; + /** @internal */ + _parentHasKeepData: boolean; + /** + * Full identifier of this log-object, with full hierarchy + * @internal + */ + fullIdentifier: () => string; + /** + * give this logger a new name + * usually happens in constructor, but in rare cases + * it's called manually + * @param name + * @internal + */ + rename(name: string): void; + /** + * link this log to a parent + * usually happens in constructor, but in rare cases + * this must be called manually + * @internal + */ + linkLog: (parent: Log) => void; /** * Add a simple message to the log * @param {string} message @@ -26,8 +68,72 @@ export declare class Log { * log.add(`description ${() => parameter}`); */ add(message: (() => string) | string, data?: unknown): string; + /** @internal */ + addData(message: (() => string) | string, data: unknown): void; + /** @internal */ + logData(): boolean; + /** @internal */ + _prepareEntry(message: (() => string) | string, data?: unknown): LogEntry; + /** @internal */ + private _prepareMessage; + /** @internal */ + call(name: string, callParams?: string, message?: string, data?: { + [key: string]: unknown; + }): LogCall; + /** @internal */ + _callDepthAdd(name: string): void; + /** @internal */ + _callDepthRemove(name: string): void; + /** + * helper to create a text-output of the log info + * @param separator + * @param start + * @param end + * @internal + */ + dump(one?: LogEntry, separator?: string): void; + /** @internal */ + dumpList(start?: number, length?: number): void; + /** @internal */ + private dumpOne; + /** + * add an entry-object to this logger + * this is often called by sub-loggers to add to parent + * @param entry + * @internal + */ + _addEntry(entry: LogEntry): void; + /** + * helper to generate a random 2-char ID + * @param stringLength + * @internal + */ + private randomString; + /** + * parent logger - important if loggers are chained + * @internal + */ + private parent; + /** + * scope of this logger - to easily see which ones + * are about the same topic + * @internal + */ + private scope; /** * The name of this log, for scenarios where multiple loggers are mixed */ name: string; + /** + * Unique 2-character ID of this specific log object + * @internal + */ + private id; + /** @internal */ + private idCache; + /** + * Unique identifier of this log object, with name and ID + * @internal + */ + private identifier; } diff --git a/projects/sxc-typings/dist/core/logging/entry.d.ts b/projects/sxc-typings/dist/core/logging/entry.d.ts index abb45a4ad..8e5ba185a 100644 --- a/projects/sxc-typings/dist/core/logging/entry.d.ts +++ b/projects/sxc-typings/dist/core/logging/entry.d.ts @@ -1,10 +1,39 @@ +import { Log } from '.'; /** * A log entry item * @export * @interface LogEntry */ export declare class LogEntry { + /** @internal */ + private log; message: string; + /** @internal */ + depth: number; /** A timestamp for this entry to better see sequences of things happening */ time: number; + /** + * The result of an operation - treated differently in the output + * @internal + */ + result: string; + /** + * Data which is logged - if data-logging is enabled + * @internal + */ + get data(): unknown; + /** @internal */ + set data(data: unknown); + /** @internal */ + private _data?; + /** @internal */ + source: () => string; + /** @internal */ + constructor( + /** @internal */ + log: Log, message: string, + /** @internal */ + depth: number, + /** A timestamp for this entry to better see sequences of things happening */ + time: number, data?: unknown); } diff --git a/projects/sxc-typings/dist/core/logging/has-log.d.ts b/projects/sxc-typings/dist/core/logging/has-log.d.ts index 4caa0e361..4f6568886 100644 --- a/projects/sxc-typings/dist/core/logging/has-log.d.ts +++ b/projects/sxc-typings/dist/core/logging/has-log.d.ts @@ -1,7 +1,32 @@ +import { Log } from '.'; /** * Any object that has an own log object * @export * @interface HasLog */ export declare abstract class HasLog { + /** @internal */ + private parentLog?; + /** + * The logger for this object + * @type {Log} + * @memberof HasLog + * @internal usually not relevant and could make docs confusing + */ + log: Log; + /** + * initialize the logger + * ideally it has a parent-logger to attach to + * @param logName name to show in the logger + * @param parentLog parent-logger to attach to + * @param initialMessage optional start-message to log + * @internal + */ + constructor(logName: string, + /** @internal */ + parentLog?: Log, initialMessage?: string); + /** @internal */ + initLog: (name: string, parentLog?: Log, initialMessage?: string) => void; + /** @internal */ + private initLogInternal; } diff --git a/projects/sxc-typings/dist/core/logging/insights.d.ts b/projects/sxc-typings/dist/core/logging/insights.d.ts index cb0ff5c3b..3cc46b887 100644 --- a/projects/sxc-typings/dist/core/logging/insights.d.ts +++ b/projects/sxc-typings/dist/core/logging/insights.d.ts @@ -1 +1,20 @@ -export {}; +import { HasLog, Log } from '.'; +export declare type LogList = Array<{ + key: string; + log: Log; +}>; +export declare class InsightsSingleton extends HasLog { + constructor(); + history: { + [key: string]: InsightsLogSet; + }; + add(setName: string, logName: string, log: Log): void; + show(partName: string, index?: number, start?: number, length?: number): void; +} +export declare class InsightsLogSet { + name: string; + logs: LogList; + constructor(name: string); +} +/** @internal */ +export declare const Insights: InsightsSingleton; diff --git a/projects/sxc-typings/dist/core/logging/log-call.d.ts b/projects/sxc-typings/dist/core/logging/log-call.d.ts index cb0ff5c3b..25f96216c 100644 --- a/projects/sxc-typings/dist/core/logging/log-call.d.ts +++ b/projects/sxc-typings/dist/core/logging/log-call.d.ts @@ -1 +1,19 @@ -export {}; +import { LogEntry, Log, LogEntryOptions as LEO } from '.'; +/** @internal */ +export declare class LogCall { + log: Log; + name: string; + /** The initial entry created - important for later attaching the final result of the call */ + initialEntry: LogEntry; + constructor(log: Log, name: string, callParams?: string, message?: string, data?: { + [key: string]: unknown; + }); + private lastMessage; + add(message: string, data?: unknown, behavior?: LEO): void; + onlyAddIfNew(message: string, behavior?: LEO): void; + /** Add data - but only if data logging is enabled */ + data(message: string, data: unknown): void; + done(message?: string, behavior?: LEO): void; + return(result: T, message?: string, behavior?: LEO): T; + private processExtraBehavior; +} diff --git a/projects/sxc-typings/dist/core/logging/log-entry-options.d.ts b/projects/sxc-typings/dist/core/logging/log-entry-options.d.ts index cb0ff5c3b..56cdad48e 100644 --- a/projects/sxc-typings/dist/core/logging/log-entry-options.d.ts +++ b/projects/sxc-typings/dist/core/logging/log-entry-options.d.ts @@ -1 +1,7 @@ -export {}; +/** @internal */ +export declare enum LogEntryOptions { + log = "log", + warn = "warn", + error = "error", + throw = "throw" +} diff --git a/projects/sxc-typings/dist/core/plumbing/no-jquery.d.ts b/projects/sxc-typings/dist/core/plumbing/no-jquery.d.ts index cb0ff5c3b..72a831e90 100644 --- a/projects/sxc-typings/dist/core/plumbing/no-jquery.d.ts +++ b/projects/sxc-typings/dist/core/plumbing/no-jquery.d.ts @@ -1 +1,31 @@ -export {}; +/** @internal */ +export declare class NoJQ { + /** https://api.jquery.com/ready/ */ + static ready(callback: () => void): void; + /** https://api.jquery.com/jquery.param/ */ + static param(obj: any): string; + /** Build DOM elements from string */ + static domFromString(string: string): HTMLElement[]; + /** https://api.jquery.com/offset/ */ + static offset(element: HTMLElement): { + left: number; + top: number; + }; + /** https://api.jquery.com/width/ */ + static width(element: HTMLElement): number; + /** https://api.jquery.com/height/ */ + static height(element: HTMLElement): number; + /** https://api.jquery.com/outerWidth/ */ + static outerWidth(element: HTMLElement): number; + /** https://api.jquery.com/empty/ */ + static empty(element: HTMLElement): void; + /** https://api.jquery.com/replacewith/ */ + static replaceWith(toBeReplaced: HTMLElement, newElement: HTMLElement, runScripts: boolean): void; + /** https://api.jquery.com/append/ */ + static append(parent: HTMLElement, newElements: HTMLElement[], runScripts: boolean): void; +} +/** @internal */ +export declare class AssetsLoader { + /** Asynchronously runs external and inline scripts in series */ + static runScripts(scripts: HTMLScriptElement[], callback: () => void): void; +} diff --git a/projects/sxc-typings/dist/core/plumbing/obj.d.ts b/projects/sxc-typings/dist/core/plumbing/obj.d.ts index cb0ff5c3b..47b0719dc 100644 --- a/projects/sxc-typings/dist/core/plumbing/obj.d.ts +++ b/projects/sxc-typings/dist/core/plumbing/obj.d.ts @@ -1 +1,12 @@ -export {}; +/** + * Object manipulator helpers + * @internal + */ +export declare class Obj { + /** + * This is the same as Object.assign, but type-safe. + * Use it as a replacetment for Object.Assign(this, ... ) in constructors + */ + static TypeSafeAssign(...args: T[]): void; + static DeepClone(original: T, ignoreCircular?: boolean): T; +} diff --git a/projects/sxc-typings/dist/core/plumbing/type-value.d.ts b/projects/sxc-typings/dist/core/plumbing/type-value.d.ts index cb0ff5c3b..e74d01bac 100644 --- a/projects/sxc-typings/dist/core/plumbing/type-value.d.ts +++ b/projects/sxc-typings/dist/core/plumbing/type-value.d.ts @@ -1 +1 @@ -export {}; +export declare type TypeValue = boolean | string | number | Date; diff --git a/projects/sxc-typings/dist/core/plumbing/url.d.ts b/projects/sxc-typings/dist/core/plumbing/url.d.ts index cb0ff5c3b..db0853f05 100644 --- a/projects/sxc-typings/dist/core/plumbing/url.d.ts +++ b/projects/sxc-typings/dist/core/plumbing/url.d.ts @@ -1 +1,2 @@ -export {}; +/** @internal */ +export declare function urlClean(original: string): string; diff --git a/projects/sxc-typings/dist/inpage/src/bootstrap/bootstrap.d.ts b/projects/sxc-typings/dist/inpage/src/bootstrap/bootstrap.d.ts index cb0ff5c3b..187b801ff 100644 --- a/projects/sxc-typings/dist/inpage/src/bootstrap/bootstrap.d.ts +++ b/projects/sxc-typings/dist/inpage/src/bootstrap/bootstrap.d.ts @@ -1 +1,35 @@ -export {}; +import { Sxc } from '../../../$2sxc/src'; +import { HasLog } from '../core'; +/** + * This contains everything necessary to bootstrap the edit mode. + * It must be initialized and started at the end in the x-bootstrap code, + * to ensure everything is already ready and loaded + * @internal + */ +export declare class BootstrapInPage extends HasLog { + constructor(); + private initializedInstances; + private openedTemplatePickerOnce; + private diagCancelStateOnStart; + initialize(): void; + /** + * Scan all instances and initialize them + * @param isFirstRun should be true only on the very initial call + */ + private initAllInstances; + /** + * create an observer instance and start observing + */ + private watchDomChanges; + /** + * Show the template picker if + * - template picker has not yet been opened + * - dialog has not been cancelled + * - only one uninitialized module on page + * @returns + */ + private tryShowTemplatePicker; + private initInstance; + private showGlassesButtonIfUninitialized; + isInitialized(sxci: Sxc): boolean; +} diff --git a/projects/sxc-typings/dist/inpage/src/cms/run-params-helpers.d.ts b/projects/sxc-typings/dist/inpage/src/cms/run-params-helpers.d.ts index cb0ff5c3b..1da279b16 100644 --- a/projects/sxc-typings/dist/inpage/src/cms/run-params-helpers.d.ts +++ b/projects/sxc-typings/dist/inpage/src/cms/run-params-helpers.d.ts @@ -1 +1,42 @@ -export {}; +import { CommandParams } from '../commands'; +import { HasLog, Log } from '../core'; +import { RunParamsWithContext } from '../../../$2sxc/src/cms'; +/** + * Helper class to process parameters given to the Cms.Run statement + * Important because certain params may sometimes be full objects, and sometimes just a name. + * In addition, even if we have more than the name, we must ensure that defaults are also included + * + * @export + * @class RunParameters + * @internal + */ +export declare class RunParamsHelpers extends HasLog { + constructor(parentLog?: Log); + /** + * name or settings adapter to settings + * @param nameOrSettings + * @returns settings + */ + getParamsFromNameOrParams(nameOrSettings: string | CommandParams): CommandParams; + /** + * Take a settings-name or partial settings object, + * and return a full settings object with all defaults from + * the command definition + * @param params + */ + expandParamsWithDefaults(params: CommandParams): CommandParams; + /** + * Checks if the run params are complete, as would be used in the $2sxc.cms.run + * @internal + */ + static is$sxcRunParams(o: unknown): o is RunParamsWithContext; + /** + * Checks if it's at least an instance run param - having at least `action` or `params` + * @internal + */ + private static isRunParamsInstance; + /** + * @internal + */ + static ensureRunParamsInstanceOrError(runParams: RunParamsWithContext): void; +} diff --git a/projects/sxc-typings/dist/inpage/src/cms/run-params-with-workflows.d.ts b/projects/sxc-typings/dist/inpage/src/cms/run-params-with-workflows.d.ts index cb0ff5c3b..dbe473684 100644 --- a/projects/sxc-typings/dist/inpage/src/cms/run-params-with-workflows.d.ts +++ b/projects/sxc-typings/dist/inpage/src/cms/run-params-with-workflows.d.ts @@ -1 +1,12 @@ -export {}; +import { RunParams } from '../../../$2sxc/src/cms'; +import { WorkflowStep } from '../workflow'; +/** + * Special internal interface to give workflows a more specific type + * @internal + */ +export interface RunParamsWithWorkflows extends RunParams { + /** + * Workflows work the same way as with a toolbar, except that they are added here and not registered on init + */ + workflows?: WorkflowStep | WorkflowStep[]; +} diff --git a/projects/sxc-typings/dist/inpage/src/cms/sxc-global-cms.d.ts b/projects/sxc-typings/dist/inpage/src/cms/sxc-global-cms.d.ts index 87a101512..7d6f3090d 100644 --- a/projects/sxc-typings/dist/inpage/src/cms/sxc-global-cms.d.ts +++ b/projects/sxc-typings/dist/inpage/src/cms/sxc-global-cms.d.ts @@ -1,4 +1,5 @@ import { CommandParams, RunParamsWithContext } from '../../../$2sxc/src/cms'; +import { ContextBundleInstance } from '../context/bundles/context-bundle-instance'; import { HasLog } from '../core'; /** * Global Content-Management System on the $2sxc.cms. @@ -6,6 +7,19 @@ import { HasLog } from '../core'; * It is only available if the page is in edit mode / the page feature `2sxc.JsCms` has been activated. */ export declare class SxcGlobalCms extends HasLog { + /** + * @internal + */ + autoDump: boolean; + /** + * @internal + */ + constructor(); + /** + * reset / clear the log + * @internal + */ + resetLog(): void; /** * Run a command within a specific context - mostly for internal use. * @param runParams The complete run params with a context @@ -37,4 +51,19 @@ export declare class SxcGlobalCms extends HasLog { * @returns A promise which triggers when the command has completed. */ run(tag: HTMLElement, commandParams: CommandParams, event?: MouseEvent): Promise; + /** + * Run a command within a specific context. + * @param context The context - either an HTML tag which determines a module/instance, or an Sxc instance + * @param nameOrSettings + * @param eventOrSettings + * @param event Optional mouse-event which allows the command to do some optimizations for that case - like a mouse-click + * @returns A promise which triggers when the command has completed. + * @internal + */ + runInternal(context: ContextBundleInstance | HTMLElement | RunParamsWithContext, nameOrSettings?: string | CommandParams, eventOrSettings?: CommandParams | MouseEvent, event?: MouseEvent): Promise; + /** + * reset/clear the log if alwaysResetLog is true + * @internal + */ + private do; } diff --git a/projects/sxc-typings/dist/inpage/src/commands/command-code.d.ts b/projects/sxc-typings/dist/inpage/src/commands/command-code.d.ts index cb0ff5c3b..99ba7327f 100644 --- a/projects/sxc-typings/dist/inpage/src/commands/command-code.d.ts +++ b/projects/sxc-typings/dist/inpage/src/commands/command-code.d.ts @@ -1 +1,5 @@ -export {}; +import { ContextComplete } from '../context'; +/** + * @internal + */ +export declare type CommandCode = (context: ContextComplete, event: MouseEvent) => Promise; diff --git a/projects/sxc-typings/dist/inpage/src/commands/command-link-generator.d.ts b/projects/sxc-typings/dist/inpage/src/commands/command-link-generator.d.ts index cb0ff5c3b..10b497cf9 100644 --- a/projects/sxc-typings/dist/inpage/src/commands/command-link-generator.d.ts +++ b/projects/sxc-typings/dist/inpage/src/commands/command-link-generator.d.ts @@ -1 +1,55 @@ +import { ItemIdentifierCopy, ItemIdentifierGroup, ItemIdentifierSimple, TemplateIdentifier } from '../../../$2sxc/src/cms'; +import { ContextComplete } from '../context/bundles/context-bundle-button'; +import { HasLog, Log } from '../core'; +import { TypeValue } from '../plumbing'; +/** + * This is responsible for taking a context with command and everything + * then building the link for opening the correct dialogs + * @internal + */ +export declare class CommandLinkGenerator extends HasLog { + readonly context: ContextComplete; + items: Array; + readonly urlParams: UrlItemParams; + private readonly debugUrlParam; + constructor(context: ContextComplete, parentLog: Log); + /** + * Generate items for editing/changing or simple item depending on the scenario. + */ + private buildItemsList; + /** + * build the link, combining specific params with global ones and put all in the url + */ + getLink(): string; + /** + * Determine the url to open a dialog, based on the settings which UI version to use + */ + private getDialogUrl; + private addItem; + /** + * this will tell the command to edit a item from the sorted list in the group, + * optionally together with the presentation item + */ + private addContentGroupItems; + /** + * this adds an item of the content-group, based on the group GUID and the sequence number + */ + private addContentGroupItem; + /** + * EXPERIMENTAL in 10.27, if a parent is specified, use that + * this will tell the command to edit a item which also belongs to a list + * this is relevant when adding new items + */ + private addItemInList; + /** + * find the part name for both the API to give the right item (when using groups) and for i18n + */ + private findPartName; +} +interface UrlItemParams { + prefill?: Record; + items?: string; + contentTypeName?: string; + filters?: string; +} export {}; diff --git a/projects/sxc-typings/dist/inpage/src/commands/command.d.ts b/projects/sxc-typings/dist/inpage/src/commands/command.d.ts index cb0ff5c3b..023a306cd 100644 --- a/projects/sxc-typings/dist/inpage/src/commands/command.d.ts +++ b/projects/sxc-typings/dist/inpage/src/commands/command.d.ts @@ -1 +1,32 @@ -export {}; +import { Button } from '../toolbar/config/button'; +/** + * @internal + */ +export declare class Command { + name: string; + constructor(name: string); + /** the defaults are important for new buttons that just know this command */ + buttonDefaults: Partial