From 81a2b7d42fd5a216467e55ba7d7e5c1b83f9b253 Mon Sep 17 00:00:00 2001 From: Francesco Longo Date: Wed, 27 May 2026 15:46:50 +0200 Subject: [PATCH 1/9] feat: Global theming APIs --- .../global-theme-iframes-inner.page.tsx | 22 ++++ pages/theming/global-theme-iframes.page.tsx | 51 ++++++++ .../__integ__/global-theme-iframes.test.ts | 105 ++++++++++++++++ src/theming/__tests__/index.test.ts | 114 +++++++++++++++++- src/theming/index.ts | 72 +++++++++++ 5 files changed, 363 insertions(+), 1 deletion(-) create mode 100644 pages/theming/global-theme-iframes-inner.page.tsx create mode 100644 pages/theming/global-theme-iframes.page.tsx create mode 100644 src/theming/__integ__/global-theme-iframes.test.ts diff --git a/pages/theming/global-theme-iframes-inner.page.tsx b/pages/theming/global-theme-iframes-inner.page.tsx new file mode 100644 index 0000000000..e84b4ba7d5 --- /dev/null +++ b/pages/theming/global-theme-iframes-inner.page.tsx @@ -0,0 +1,22 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import React, { useEffect } from 'react'; + +import { preset } from '~components/internal/generated/theming'; +import { applyGlobalTheme } from '~components/theming'; + +const colorProperty = preset.propertiesMap.colorTextAccent; + +export default function GlobalThemeIframesContentPage() { + useEffect(() => { + applyGlobalTheme(); + }, []); + + return ( +
+ + Themed text + +
+ ); +} diff --git a/pages/theming/global-theme-iframes.page.tsx b/pages/theming/global-theme-iframes.page.tsx new file mode 100644 index 0000000000..2083c0db36 --- /dev/null +++ b/pages/theming/global-theme-iframes.page.tsx @@ -0,0 +1,51 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import React, { useState } from 'react'; + +import { setGlobalTheme, Theme } from '~components/theming'; + +const themeA: Theme = { + tokens: { + colorTextAccent: '#ff0000', + }, +}; + +const themeB: Theme = { + tokens: { + colorTextAccent: '#0000ff', + }, +}; + +export default function GlobalThemeIframesPage() { + const [themeApplied, setThemeApplied] = useState(null); + + return ( +
+

Global Theme with Iframes

+ + {themeApplied ?? 'none'} + + + + +