@cloudscape-design/components 3.0.734 → 3.0.735
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
|
@@ -11,7 +11,7 @@ export class AppLayoutWidgetController {
|
|
|
11
11
|
if (forcedPrimary) {
|
|
12
12
|
return forcedPrimary;
|
|
13
13
|
}
|
|
14
|
-
for (const registration of __classPrivateFieldGet(this, _AppLayoutWidgetController_registrations, "f").slice()
|
|
14
|
+
for (const registration of __classPrivateFieldGet(this, _AppLayoutWidgetController_registrations, "f").slice()) {
|
|
15
15
|
if (registration.forceType !== 'secondary') {
|
|
16
16
|
return registration;
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-layout-widget.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/app-layout-widget.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAkCtC,MAAM,OAAO,yBAAyB;IAAtC;QACE,mDAAqD,EAAE,EAAC;QAExD,iDAAe,GAAG,EAAE;YAClB,MAAM,aAAa,GAAG,uBAAA,IAAI,gDAAe,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;YACrG,IAAI,aAAa,EAAE;gBACjB,OAAO,aAAa,CAAC;aACtB;YACD,KAAK,MAAM,YAAY,IAAI,uBAAA,IAAI,gDAAe,CAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"app-layout-widget.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/app-layout-widget.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAkCtC,MAAM,OAAO,yBAAyB;IAAtC;QACE,mDAAqD,EAAE,EAAC;QAExD,iDA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yright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\n\ninterface PrimaryRegistration<Props> {\n type: 'primary';\n discoveredProps: Array<Props>;\n}\n\ninterface SecondaryRegistration<Props> {\n type: 'secondary';\n update: (props: Props) => void;\n}\n\nexport type RegistrationState<Props> = PrimaryRegistration<Props> | SecondaryRegistration<Props>;\nexport type RegistrationType = RegistrationState<unknown>['type'];\n\ntype RegistrationChangeHandler<Props> = (\n registration: PrimaryRegistration<Props> | SecondaryRegistration<Props>\n) => void;\n\ninterface RegistrationInternal<Props> {\n forceType: RegistrationType | undefined;\n props: Props;\n secondaryInstance: SecondaryRegistration<Props>;\n onChange: (registration: PrimaryRegistration<Props> | SecondaryRegistration<Props>) => void;\n}\n\nexport interface AppLayoutWidgetApiInternal<Props = unknown> {\n register(\n forceDeduplicationType: RegistrationType | undefined,\n onPropsChange: RegistrationChangeHandler<Props>\n ): () => void;\n getStateForTesting(): { registrations: Array<RegistrationInternal<Props>> };\n}\n\nexport class AppLayoutWidgetController<Props = unknown> {\n #registrations: Array<RegistrationInternal<Props>> = [];\n\n #findPrimary = () => {\n const forcedPrimary = this.#registrations.find(registration => registration.forceType === 'primary');\n if (forcedPrimary) {\n return forcedPrimary;\n }\n for (const registration of this.#registrations.slice()) {\n if (registration.forceType !== 'secondary') {\n return registration;\n }\n }\n return undefined;\n };\n\n #update = () => {\n const primary = this.#findPrimary();\n const discoveredProps = this.#registrations\n .filter(registration => registration !== primary)\n .map(registration => registration.props);\n for (const registration of this.#registrations) {\n if (registration === primary) {\n registration.onChange({\n type: 'primary',\n discoveredProps,\n });\n } else {\n registration.onChange(registration.secondaryInstance);\n }\n }\n };\n\n #scheduleUpdate = debounce(() => this.#update(), 0);\n\n register = (\n forceType: RegistrationType | undefined,\n onRegistrationChange: RegistrationChangeHandler<Props>\n ): (() => void) => {\n const hasForcedPrimary = this.#registrations.some(instance => instance.forceType === 'primary');\n if (forceType === 'primary' && hasForcedPrimary) {\n throw new Error('Double primary registration attempt');\n }\n\n const registration: RegistrationInternal<Props> = {\n forceType,\n onChange: onRegistrationChange,\n props: {} as Props,\n secondaryInstance: {\n type: 'secondary',\n update: props => {\n registration.props = props;\n this.#scheduleUpdate();\n },\n },\n };\n this.#registrations.push(registration);\n\n this.#update();\n\n return () => {\n this.#registrations.splice(this.#registrations.indexOf(registration), 1);\n this.#scheduleUpdate();\n };\n };\n\n getStateForTesting = () => {\n return {\n registrations: this.#registrations,\n };\n };\n\n installInternal = (\n internalApi: Partial<AppLayoutWidgetApiInternal<Props>> = {}\n ): AppLayoutWidgetApiInternal<Props> => {\n internalApi.register ??= this.register;\n internalApi.getStateForTesting ??= this.getStateForTesting;\n return internalApi as AppLayoutWidgetApiInternal<Props>;\n };\n}\n"]}
|
package/package.json
CHANGED