From c429a97e486876dcbb10e8c8d5b29d3ab1ea6856 Mon Sep 17 00:00:00 2001 From: Zaydek Michels-Gualtieri Date: Mon, 16 Nov 2020 21:34:57 +0900 Subject: [PATCH] Prototyped cleaned up runtime implementation --- src/duomo/core/border.scss | 1 - src/duomo/helpers/index.scss | 14 ++-- src/runtime/Duomo.ts | 122 ++++++++++++++++------------------- 3 files changed, 63 insertions(+), 74 deletions(-) diff --git a/src/duomo/core/border.scss b/src/duomo/core/border.scss index 0a119d6..a612b6e 100644 --- a/src/duomo/core/border.scss +++ b/src/duomo/core/border.scss @@ -28,7 +28,6 @@ ); } -// TODO: Rename to `generate-opaque-colors-from-map`. @mixin border-color-from-map($map, $opacity-range) { // prettier-ignore @include helpers.generate-opaque-colors-from-map( diff --git a/src/duomo/helpers/index.scss b/src/duomo/helpers/index.scss index 230f27d..bea5f92 100644 --- a/src/duomo/helpers/index.scss +++ b/src/duomo/helpers/index.scss @@ -1,7 +1,7 @@ -@forward "escape"; // TODO -@forward "generators"; // TODO -@forward "get-ampersand"; // TODO -@forward "getters"; // TODO -@forward "range"; // TODO -@forward "resolve"; // TODO -@forward "safe"; // TODO +@forward "escape"; +@forward "generators"; +@forward "get-ampersand"; +@forward "getters"; +@forward "range"; +@forward "resolve"; +@forward "safe"; // TODO: Do we want to forward `safe-abs`, etc.? diff --git a/src/runtime/Duomo.ts b/src/runtime/Duomo.ts index 146d6bc..0e502f6 100644 --- a/src/runtime/Duomo.ts +++ b/src/runtime/Duomo.ts @@ -1,87 +1,77 @@ -const THEME_PREFERENCE_KEY = "duomo-theme-preference" +const THEME_PREFERENCE_KEY = "duomo-theme-preference" as const + +export enum Mode { + development = "development", + production = "production", +} interface IDuomo { - __deferers: (() => void)[] - init(): void - defer(): void + init(mode: Mode): () => void toggleDebugMode(): void toggleDarkMode(): void } -// TODO: Can we refactor Duomo to be a React component? -// -// -// {/* ... */} -// -// -// The problem with this is SSR. This will be run on the server in NextJS. -// We want to trigger mode as-fast-as-possible when the client loads the app. -// -// Currently we use