@just-web/toolkits 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/utils/try-parse-json.cjs +14 -0
- package/dist/_internal/utils/try-parse-json.cjs.map +1 -0
- package/dist/_internal/utils/try-parse-json.mjs +13 -0
- package/dist/_internal/utils/try-parse-json.mjs.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/attributes/data-attribute.d.cts +17 -0
- package/dist/attributes/data-attribute.d.cts.map +1 -0
- package/dist/attributes/data-attribute.d.mts +17 -0
- package/dist/attributes/data-attribute.d.mts.map +1 -0
- package/dist/attributes/get-attribute.cjs +26 -0
- package/dist/attributes/get-attribute.cjs.map +1 -0
- package/dist/attributes/get-attribute.d.cts +21 -0
- package/dist/attributes/get-attribute.d.cts.map +1 -0
- package/dist/attributes/get-attribute.d.mts +21 -0
- package/dist/attributes/get-attribute.d.mts.map +1 -0
- package/dist/attributes/get-attribute.mjs +25 -0
- package/dist/attributes/get-attribute.mjs.map +1 -0
- package/dist/attributes/get-data-attribute.cjs +19 -0
- package/dist/attributes/get-data-attribute.cjs.map +1 -0
- package/dist/attributes/get-data-attribute.d.cts +17 -0
- package/dist/attributes/get-data-attribute.d.cts.map +1 -0
- package/dist/attributes/get-data-attribute.d.mts +17 -0
- package/dist/attributes/get-data-attribute.d.mts.map +1 -0
- package/dist/attributes/get-data-attribute.mjs +19 -0
- package/dist/attributes/get-data-attribute.mjs.map +1 -0
- package/dist/attributes/observe-attribute.cjs +40 -0
- package/dist/attributes/observe-attribute.cjs.map +1 -0
- package/dist/attributes/observe-attribute.d.cts +23 -0
- package/dist/attributes/observe-attribute.d.cts.map +1 -0
- package/dist/attributes/observe-attribute.d.mts +23 -0
- package/dist/attributes/observe-attribute.d.mts.map +1 -0
- package/dist/attributes/observe-attribute.mjs +39 -0
- package/dist/attributes/observe-attribute.mjs.map +1 -0
- package/dist/attributes/observe-data-attribute.cjs +31 -0
- package/dist/attributes/observe-data-attribute.cjs.map +1 -0
- package/dist/attributes/observe-data-attribute.d.cts +26 -0
- package/dist/attributes/observe-data-attribute.d.cts.map +1 -0
- package/dist/attributes/observe-data-attribute.d.mts +26 -0
- package/dist/attributes/observe-data-attribute.d.mts.map +1 -0
- package/dist/attributes/observe-data-attribute.mjs +31 -0
- package/dist/attributes/observe-data-attribute.mjs.map +1 -0
- package/dist/children/just-children.d.cts +37 -0
- package/dist/children/just-children.d.cts.map +1 -0
- package/dist/children/just-children.d.mts +37 -0
- package/dist/children/just-children.d.mts.map +1 -0
- package/dist/children/resolve-children.cjs +11 -0
- package/dist/children/resolve-children.cjs.map +1 -0
- package/dist/children/resolve-children.d.cts +9 -0
- package/dist/children/resolve-children.d.cts.map +1 -0
- package/dist/children/resolve-children.d.mts +9 -0
- package/dist/children/resolve-children.d.mts.map +1 -0
- package/dist/children/resolve-children.mjs +10 -0
- package/dist/children/resolve-children.mjs.map +1 -0
- package/dist/class-name/class-name-props.d.cts +11 -0
- package/dist/class-name/class-name-props.d.cts.map +1 -0
- package/dist/class-name/class-name-props.d.mts +11 -0
- package/dist/class-name/class-name-props.d.mts.map +1 -0
- package/dist/class-name/clsx.cjs +3 -0
- package/dist/class-name/clsx.d.cts +2 -0
- package/dist/class-name/clsx.d.mts +2 -0
- package/dist/class-name/clsx.mjs +3 -0
- package/dist/class-name/just-class-name.d.cts +36 -0
- package/dist/class-name/just-class-name.d.cts.map +1 -0
- package/dist/class-name/just-class-name.d.mts +36 -0
- package/dist/class-name/just-class-name.d.mts.map +1 -0
- package/dist/class-name/resolve-class-name.cjs +12 -0
- package/dist/class-name/resolve-class-name.cjs.map +1 -0
- package/dist/class-name/resolve-class-name.d.cts +8 -0
- package/dist/class-name/resolve-class-name.d.cts.map +1 -0
- package/dist/class-name/resolve-class-name.d.mts +8 -0
- package/dist/class-name/resolve-class-name.d.mts.map +1 -0
- package/dist/class-name/resolve-class-name.mjs +10 -0
- package/dist/class-name/resolve-class-name.mjs.map +1 -0
- package/dist/color-scheme/get-prefers-color-scheme.cjs +21 -0
- package/dist/color-scheme/get-prefers-color-scheme.cjs.map +1 -0
- package/dist/color-scheme/get-prefers-color-scheme.d.cts +16 -0
- package/dist/color-scheme/get-prefers-color-scheme.d.cts.map +1 -0
- package/dist/color-scheme/get-prefers-color-scheme.d.mts +16 -0
- package/dist/color-scheme/get-prefers-color-scheme.d.mts.map +1 -0
- package/dist/color-scheme/get-prefers-color-scheme.mjs +20 -0
- package/dist/color-scheme/get-prefers-color-scheme.mjs.map +1 -0
- package/dist/color-scheme/observe-prefers-color-scheme.cjs +29 -0
- package/dist/color-scheme/observe-prefers-color-scheme.cjs.map +1 -0
- package/dist/color-scheme/observe-prefers-color-scheme.d.cts +20 -0
- package/dist/color-scheme/observe-prefers-color-scheme.d.cts.map +1 -0
- package/dist/color-scheme/observe-prefers-color-scheme.d.mts +20 -0
- package/dist/color-scheme/observe-prefers-color-scheme.d.mts.map +1 -0
- package/dist/color-scheme/observe-prefers-color-scheme.mjs +28 -0
- package/dist/color-scheme/observe-prefers-color-scheme.mjs.map +1 -0
- package/dist/index.cjs +39 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.mjs +20 -0
- package/dist/react/hooks/use-attribute.cjs +41 -0
- package/dist/react/hooks/use-attribute.cjs.map +1 -0
- package/dist/react/hooks/use-attribute.d.cts +21 -0
- package/dist/react/hooks/use-attribute.d.cts.map +1 -0
- package/dist/react/hooks/use-attribute.d.mts +21 -0
- package/dist/react/hooks/use-attribute.d.mts.map +1 -0
- package/dist/react/hooks/use-attribute.mjs +40 -0
- package/dist/react/hooks/use-attribute.mjs.map +1 -0
- package/dist/react/hooks/use-prefers-color-scheme.cjs +42 -0
- package/dist/react/hooks/use-prefers-color-scheme.cjs.map +1 -0
- package/dist/react/hooks/use-prefers-color-scheme.d.cts +29 -0
- package/dist/react/hooks/use-prefers-color-scheme.d.cts.map +1 -0
- package/dist/react/hooks/use-prefers-color-scheme.d.mts +29 -0
- package/dist/react/hooks/use-prefers-color-scheme.d.mts.map +1 -0
- package/dist/react/hooks/use-prefers-color-scheme.mjs +41 -0
- package/dist/react/hooks/use-prefers-color-scheme.mjs.map +1 -0
- package/dist/react/hooks/use-theme-by-class-name.cjs +60 -0
- package/dist/react/hooks/use-theme-by-class-name.cjs.map +1 -0
- package/dist/react/hooks/use-theme-by-class-name.d.cts +34 -0
- package/dist/react/hooks/use-theme-by-class-name.d.cts.map +1 -0
- package/dist/react/hooks/use-theme-by-class-name.d.mts +34 -0
- package/dist/react/hooks/use-theme-by-class-name.d.mts.map +1 -0
- package/dist/react/hooks/use-theme-by-class-name.mjs +59 -0
- package/dist/react/hooks/use-theme-by-class-name.mjs.map +1 -0
- package/dist/react/hooks/use-theme-by-data-attribute.cjs +73 -0
- package/dist/react/hooks/use-theme-by-data-attribute.cjs.map +1 -0
- package/dist/react/hooks/use-theme-by-data-attribute.d.cts +39 -0
- package/dist/react/hooks/use-theme-by-data-attribute.d.cts.map +1 -0
- package/dist/react/hooks/use-theme-by-data-attribute.d.mts +39 -0
- package/dist/react/hooks/use-theme-by-data-attribute.d.mts.map +1 -0
- package/dist/react/hooks/use-theme-by-data-attribute.mjs +72 -0
- package/dist/react/hooks/use-theme-by-data-attribute.mjs.map +1 -0
- package/dist/react/hooks/use-theme-by-local-storage.cjs +53 -0
- package/dist/react/hooks/use-theme-by-local-storage.cjs.map +1 -0
- package/dist/react/hooks/use-theme-by-local-storage.d.cts +37 -0
- package/dist/react/hooks/use-theme-by-local-storage.d.cts.map +1 -0
- package/dist/react/hooks/use-theme-by-local-storage.d.mts +37 -0
- package/dist/react/hooks/use-theme-by-local-storage.d.mts.map +1 -0
- package/dist/react/hooks/use-theme-by-local-storage.mjs +52 -0
- package/dist/react/hooks/use-theme-by-local-storage.mjs.map +1 -0
- package/dist/react/hooks/use-theme-stores.cjs +40 -0
- package/dist/react/hooks/use-theme-stores.cjs.map +1 -0
- package/dist/react/hooks/use-theme-stores.d.cts +38 -0
- package/dist/react/hooks/use-theme-stores.d.cts.map +1 -0
- package/dist/react/hooks/use-theme-stores.d.mts +38 -0
- package/dist/react/hooks/use-theme-stores.d.mts.map +1 -0
- package/dist/react/hooks/use-theme-stores.mjs +39 -0
- package/dist/react/hooks/use-theme-stores.mjs.map +1 -0
- package/dist/react/theme/create-theme-hook.cjs +105 -0
- package/dist/react/theme/create-theme-hook.cjs.map +1 -0
- package/dist/react/theme/create-theme-hook.d.cts +29 -0
- package/dist/react/theme/create-theme-hook.d.cts.map +1 -0
- package/dist/react/theme/create-theme-hook.d.mts +29 -0
- package/dist/react/theme/create-theme-hook.d.mts.map +1 -0
- package/dist/react/theme/create-theme-hook.mjs +104 -0
- package/dist/react/theme/create-theme-hook.mjs.map +1 -0
- package/dist/react.cjs +15 -0
- package/dist/react.d.cts +8 -0
- package/dist/react.d.mts +8 -0
- package/dist/react.mjs +9 -0
- package/dist/style/css-properties.d.cts +20 -0
- package/dist/style/css-properties.d.cts.map +1 -0
- package/dist/style/css-properties.d.mts +20 -0
- package/dist/style/css-properties.d.mts.map +1 -0
- package/dist/style/define-css-properties.cjs +25 -0
- package/dist/style/define-css-properties.cjs.map +1 -0
- package/dist/style/define-css-properties.d.cts +24 -0
- package/dist/style/define-css-properties.d.cts.map +1 -0
- package/dist/style/define-css-properties.d.mts +24 -0
- package/dist/style/define-css-properties.d.mts.map +1 -0
- package/dist/style/define-css-properties.mjs +24 -0
- package/dist/style/define-css-properties.mjs.map +1 -0
- package/dist/style/get-css-variable-value.cjs +11 -0
- package/dist/style/get-css-variable-value.cjs.map +1 -0
- package/dist/style/get-css-variable-value.d.cts +22 -0
- package/dist/style/get-css-variable-value.d.cts.map +1 -0
- package/dist/style/get-css-variable-value.d.mts +22 -0
- package/dist/style/get-css-variable-value.d.mts.map +1 -0
- package/dist/style/get-css-variable-value.mjs +10 -0
- package/dist/style/get-css-variable-value.mjs.map +1 -0
- package/dist/style/just-style.d.cts +44 -0
- package/dist/style/just-style.d.cts.map +1 -0
- package/dist/style/just-style.d.mts +44 -0
- package/dist/style/just-style.d.mts.map +1 -0
- package/dist/style/resolve-style.cjs +14 -0
- package/dist/style/resolve-style.cjs.map +1 -0
- package/dist/style/resolve-style.d.cts +11 -0
- package/dist/style/resolve-style.d.cts.map +1 -0
- package/dist/style/resolve-style.d.mts +11 -0
- package/dist/style/resolve-style.d.mts.map +1 -0
- package/dist/style/resolve-style.mjs +13 -0
- package/dist/style/resolve-style.mjs.map +1 -0
- package/dist/style/style-props.d.cts +13 -0
- package/dist/style/style-props.d.cts.map +1 -0
- package/dist/style/style-props.d.mts +13 -0
- package/dist/style/style-props.d.mts.map +1 -0
- package/dist/style/to-dom-style.cjs +33 -0
- package/dist/style/to-dom-style.cjs.map +1 -0
- package/dist/style/to-dom-style.d.cts +29 -0
- package/dist/style/to-dom-style.d.cts.map +1 -0
- package/dist/style/to-dom-style.d.mts +29 -0
- package/dist/style/to-dom-style.d.mts.map +1 -0
- package/dist/style/to-dom-style.mjs +32 -0
- package/dist/style/to-dom-style.mjs.map +1 -0
- package/dist/testing/theme/dummy-theme-store.cjs +11 -0
- package/dist/testing/theme/dummy-theme-store.cjs.map +1 -0
- package/dist/testing/theme/dummy-theme-store.mjs +10 -0
- package/dist/testing/theme/dummy-theme-store.mjs.map +1 -0
- package/dist/theme/_utils/get-theme-from-stores.cjs +24 -0
- package/dist/theme/_utils/get-theme-from-stores.cjs.map +1 -0
- package/dist/theme/_utils/get-theme-from-stores.mjs +23 -0
- package/dist/theme/_utils/get-theme-from-stores.mjs.map +1 -0
- package/dist/theme/_utils/observe-theme-from-stores.cjs +39 -0
- package/dist/theme/_utils/observe-theme-from-stores.cjs.map +1 -0
- package/dist/theme/_utils/observe-theme-from-stores.mjs +39 -0
- package/dist/theme/_utils/observe-theme-from-stores.mjs.map +1 -0
- package/dist/theme/_utils/parse-stored-theme.cjs +22 -0
- package/dist/theme/_utils/parse-stored-theme.cjs.map +1 -0
- package/dist/theme/_utils/parse-stored-theme.mjs +22 -0
- package/dist/theme/_utils/parse-stored-theme.mjs.map +1 -0
- package/dist/theme/_utils/set-theme-to-stores.cjs +16 -0
- package/dist/theme/_utils/set-theme-to-stores.cjs.map +1 -0
- package/dist/theme/_utils/set-theme-to-stores.mjs +15 -0
- package/dist/theme/_utils/set-theme-to-stores.mjs.map +1 -0
- package/dist/theme/class-name/apply-theme-to-class-name.cjs +23 -0
- package/dist/theme/class-name/apply-theme-to-class-name.cjs.map +1 -0
- package/dist/theme/class-name/apply-theme-to-class-name.mjs +22 -0
- package/dist/theme/class-name/apply-theme-to-class-name.mjs.map +1 -0
- package/dist/theme/class-name/resolve-theme-from-class-name.cjs +23 -0
- package/dist/theme/class-name/resolve-theme-from-class-name.cjs.map +1 -0
- package/dist/theme/class-name/resolve-theme-from-class-name.mjs +22 -0
- package/dist/theme/class-name/resolve-theme-from-class-name.mjs.map +1 -0
- package/dist/theme/compose-theme-stores.cjs +74 -0
- package/dist/theme/compose-theme-stores.cjs.map +1 -0
- package/dist/theme/compose-theme-stores.d.cts +33 -0
- package/dist/theme/compose-theme-stores.d.cts.map +1 -0
- package/dist/theme/compose-theme-stores.d.mts +33 -0
- package/dist/theme/compose-theme-stores.d.mts.map +1 -0
- package/dist/theme/compose-theme-stores.mjs +74 -0
- package/dist/theme/compose-theme-stores.mjs.map +1 -0
- package/dist/theme/data-attribute/apply-theme-to-data-attribute.cjs +23 -0
- package/dist/theme/data-attribute/apply-theme-to-data-attribute.cjs.map +1 -0
- package/dist/theme/data-attribute/apply-theme-to-data-attribute.mjs +22 -0
- package/dist/theme/data-attribute/apply-theme-to-data-attribute.mjs.map +1 -0
- package/dist/theme/data-attribute/resolve-theme-from-data-attribute.cjs +23 -0
- package/dist/theme/data-attribute/resolve-theme-from-data-attribute.cjs.map +1 -0
- package/dist/theme/data-attribute/resolve-theme-from-data-attribute.mjs +22 -0
- package/dist/theme/data-attribute/resolve-theme-from-data-attribute.mjs.map +1 -0
- package/dist/theme/theme-entry.cjs +13 -0
- package/dist/theme/theme-entry.cjs.map +1 -0
- package/dist/theme/theme-entry.d.cts +9 -0
- package/dist/theme/theme-entry.d.cts.map +1 -0
- package/dist/theme/theme-entry.d.mts +9 -0
- package/dist/theme/theme-entry.d.mts.map +1 -0
- package/dist/theme/theme-entry.mjs +12 -0
- package/dist/theme/theme-entry.mjs.map +1 -0
- package/dist/theme/theme-entry.types.d.cts +16 -0
- package/dist/theme/theme-entry.types.d.cts.map +1 -0
- package/dist/theme/theme-entry.types.d.mts +16 -0
- package/dist/theme/theme-entry.types.d.mts.map +1 -0
- package/dist/theme/theme-map.types.d.cts +10 -0
- package/dist/theme/theme-map.types.d.cts.map +1 -0
- package/dist/theme/theme-map.types.d.mts +10 -0
- package/dist/theme/theme-map.types.d.mts.map +1 -0
- package/dist/theme/theme-store/async-theme-store.types.d.cts +25 -0
- package/dist/theme/theme-store/async-theme-store.types.d.cts.map +1 -0
- package/dist/theme/theme-store/async-theme-store.types.d.mts +25 -0
- package/dist/theme/theme-store/async-theme-store.types.d.mts.map +1 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.cjs +53 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.cjs.map +1 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.d.cts +28 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.d.cts.map +1 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.d.mts +28 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.d.mts.map +1 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.mjs +53 -0
- package/dist/theme/theme-store/class-name-theme-store/class-name-theme-store.mjs.map +1 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.cjs +121 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.cjs.map +1 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.d.cts +65 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.d.cts.map +1 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.d.mts +65 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.d.mts.map +1 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.mjs +120 -0
- package/dist/theme/theme-store/cookie-theme-store/cookie-theme-store.mjs.map +1 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.cjs +51 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.cjs.map +1 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.d.cts +30 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.d.cts.map +1 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.d.mts +30 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.d.mts.map +1 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.mjs +51 -0
- package/dist/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.mjs.map +1 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.cjs +54 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.cjs.map +1 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.d.cts +31 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.d.cts.map +1 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.d.mts +31 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.d.mts.map +1 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.mjs +54 -0
- package/dist/theme/theme-store/in-memory-theme-store/in-memory-theme-store.mjs.map +1 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.cjs +67 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.cjs.map +1 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.d.cts +34 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.d.cts.map +1 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.d.mts +34 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.d.mts.map +1 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.mjs +67 -0
- package/dist/theme/theme-store/local-storage-theme-store/local-storage-theme-store.mjs.map +1 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.cjs +39 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.cjs.map +1 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.d.cts +32 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.d.cts.map +1 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.d.mts +32 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.d.mts.map +1 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.mjs +39 -0
- package/dist/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.mjs.map +1 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.cjs +67 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.cjs.map +1 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.d.cts +34 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.d.cts.map +1 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.d.mts +34 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.d.mts.map +1 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.mjs +67 -0
- package/dist/theme/theme-store/session-storage-theme-store/session-storage-theme-store.mjs.map +1 -0
- package/dist/theme/theme-store/theme-store-factory.types.d.cts +10 -0
- package/dist/theme/theme-store/theme-store-factory.types.d.cts.map +1 -0
- package/dist/theme/theme-store/theme-store-factory.types.d.mts +10 -0
- package/dist/theme/theme-store/theme-store-factory.types.d.mts.map +1 -0
- package/dist/theme/theme-store/theme-store.types.d.cts +33 -0
- package/dist/theme/theme-store/theme-store.types.d.cts.map +1 -0
- package/dist/theme/theme-store/theme-store.types.d.mts +33 -0
- package/dist/theme/theme-store/theme-store.types.d.mts.map +1 -0
- package/dist/theme.cjs +20 -0
- package/dist/theme.d.cts +15 -0
- package/dist/theme.d.mts +15 -0
- package/dist/theme.mjs +11 -0
- package/dist/units/get-rem-to-px-scale.cjs +30 -0
- package/dist/units/get-rem-to-px-scale.cjs.map +1 -0
- package/dist/units/get-rem-to-px-scale.d.cts +21 -0
- package/dist/units/get-rem-to-px-scale.d.cts.map +1 -0
- package/dist/units/get-rem-to-px-scale.d.mts +21 -0
- package/dist/units/get-rem-to-px-scale.d.mts.map +1 -0
- package/dist/units/get-rem-to-px-scale.mjs +29 -0
- package/dist/units/get-rem-to-px-scale.mjs.map +1 -0
- package/dist/units/px-2-num.cjs +23 -0
- package/dist/units/px-2-num.cjs.map +1 -0
- package/dist/units/px-2-num.d.cts +19 -0
- package/dist/units/px-2-num.d.cts.map +1 -0
- package/dist/units/px-2-num.d.mts +19 -0
- package/dist/units/px-2-num.d.mts.map +1 -0
- package/dist/units/px-2-num.mjs +22 -0
- package/dist/units/px-2-num.mjs.map +1 -0
- package/dist/units/px-2-rem.cjs +31 -0
- package/dist/units/px-2-rem.cjs.map +1 -0
- package/dist/units/px-2-rem.d.cts +25 -0
- package/dist/units/px-2-rem.d.cts.map +1 -0
- package/dist/units/px-2-rem.d.mts +25 -0
- package/dist/units/px-2-rem.d.mts.map +1 -0
- package/dist/units/px-2-rem.mjs +30 -0
- package/dist/units/px-2-rem.mjs.map +1 -0
- package/dist/units/rem-2-px.cjs +31 -0
- package/dist/units/rem-2-px.cjs.map +1 -0
- package/dist/units/rem-2-px.d.cts +25 -0
- package/dist/units/rem-2-px.d.cts.map +1 -0
- package/dist/units/rem-2-px.d.mts +25 -0
- package/dist/units/rem-2-px.d.mts.map +1 -0
- package/dist/units/rem-2-px.mjs +30 -0
- package/dist/units/rem-2-px.mjs.map +1 -0
- package/dist/utils/append-id.cjs +16 -0
- package/dist/utils/append-id.cjs.map +1 -0
- package/dist/utils/append-id.d.cts +12 -0
- package/dist/utils/append-id.d.cts.map +1 -0
- package/dist/utils/append-id.d.mts +12 -0
- package/dist/utils/append-id.d.mts.map +1 -0
- package/dist/utils/append-id.mjs +15 -0
- package/dist/utils/append-id.mjs.map +1 -0
- package/package.json +120 -0
- package/readme.md +15 -0
- package/src/_internal/utils/try-parse-json.ts +8 -0
- package/src/attributes/data-attribute.ts +49 -0
- package/src/attributes/get-attribute.ts +20 -0
- package/src/attributes/get-data-attribute.ts +15 -0
- package/src/attributes/observe-attribute.ts +37 -0
- package/src/attributes/observe-data-attribute.ts +29 -0
- package/src/children/just-children-fn-props.editor.default.tsx +29 -0
- package/src/children/just-children-props.editor.default.tsx +17 -0
- package/src/children/just-children.editor.default.tsx +11 -0
- package/src/children/just-children.ts +37 -0
- package/src/children/resolve-children.ts +16 -0
- package/src/class-name/class-name-props.editor.tsx +13 -0
- package/src/class-name/class-name-props.ts +7 -0
- package/src/class-name/clsx.ts +3 -0
- package/src/class-name/just-class-name-props.editor.default.tsx +23 -0
- package/src/class-name/just-class-name-resolver-state.editor.default.tsx +18 -0
- package/src/class-name/just-class-name.editor.default-class-name.tsx +28 -0
- package/src/class-name/just-class-name.editor.default.tsx +14 -0
- package/src/class-name/just-class-name.editor.type-param.tsx +25 -0
- package/src/class-name/just-class-name.ts +36 -0
- package/src/class-name/resolve-class-name.ts +12 -0
- package/src/color-scheme/get-prefers-color-scheme.ts +17 -0
- package/src/color-scheme/observe-prefers-color-scheme.ts +24 -0
- package/src/index.ts +25 -0
- package/src/react/hooks/use-attribute.ts +59 -0
- package/src/react/hooks/use-prefers-color-scheme.ts +42 -0
- package/src/react/hooks/use-theme-by-class-name.ts +69 -0
- package/src/react/hooks/use-theme-by-data-attribute.ts +84 -0
- package/src/react/hooks/use-theme-by-local-storage.ts +68 -0
- package/src/react/hooks/use-theme-stores.ts +83 -0
- package/src/react/theme/create-theme-hook.ts +197 -0
- package/src/react.ts +7 -0
- package/src/style/css-properties.ts +20 -0
- package/src/style/define-css-properties.ts +23 -0
- package/src/style/get-css-variable-value.ts +32 -0
- package/src/style/just-style-props.editor.default.tsx +17 -0
- package/src/style/just-style-resolver-state.editor.default.tsx +22 -0
- package/src/style/just-style.editor.default.tsx +17 -0
- package/src/style/just-style.editor.type-param.tsx +31 -0
- package/src/style/just-style.ts +60 -0
- package/src/style/resolve-style.ts +23 -0
- package/src/style/style-props.editor.tsx +13 -0
- package/src/style/style-props.ts +8 -0
- package/src/style/to-dom-style.ts +36 -0
- package/src/testing/button.theme.ts +21 -0
- package/src/testing/button.tsx +11 -0
- package/src/testing/log-panel.tsx +14 -0
- package/src/testing/theme/dummy-theme-store.ts +7 -0
- package/src/testing/theme/theme-result-card.tsx +43 -0
- package/src/testing/theme/theme-store-demo.tsx +87 -0
- package/src/theme/_utils/get-theme-from-stores.ts +34 -0
- package/src/theme/_utils/observe-theme-from-stores.ts +57 -0
- package/src/theme/_utils/parse-stored-theme.ts +21 -0
- package/src/theme/_utils/set-theme-to-stores.ts +23 -0
- package/src/theme/class-name/apply-theme-to-class-name.ts +26 -0
- package/src/theme/class-name/resolve-theme-from-class-name.ts +22 -0
- package/src/theme/compose-theme-stores.ts +139 -0
- package/src/theme/data-attribute/apply-theme-to-data-attribute.ts +27 -0
- package/src/theme/data-attribute/resolve-theme-from-data-attribute.ts +23 -0
- package/src/theme/theme-entry.ts +10 -0
- package/src/theme/theme-entry.types.ts +11 -0
- package/src/theme/theme-map.types.ts +6 -0
- package/src/theme/theme-store/async-theme-store.types.ts +24 -0
- package/src/theme/theme-store/class-name-theme-store/class-name-theme-store.ts +62 -0
- package/src/theme/theme-store/cookie-theme-store/cookie-theme-store.ts +174 -0
- package/src/theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.ts +60 -0
- package/src/theme/theme-store/in-memory-theme-store/in-memory-theme-store.ts +54 -0
- package/src/theme/theme-store/local-storage-theme-store/local-storage-theme-store.ts +83 -0
- package/src/theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.ts +43 -0
- package/src/theme/theme-store/session-storage-theme-store/session-storage-theme-store.ts +83 -0
- package/src/theme/theme-store/theme-store-factory.types.ts +9 -0
- package/src/theme/theme-store/theme-store.types.ts +30 -0
- package/src/theme.ts +14 -0
- package/src/units/get-rem-to-px-scale.ts +27 -0
- package/src/units/px-2-num.ts +17 -0
- package/src/units/px-2-rem.ts +30 -0
- package/src/units/rem-2-px.ts +30 -0
- package/src/utils/append-id.ts +10 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CreateTuple } from "type-plus";
|
|
2
|
+
|
|
3
|
+
//#region src/style/get-css-variable-value.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves CSS custom property values from the specified element.
|
|
7
|
+
*
|
|
8
|
+
* @param element - The HTML element to get property values from
|
|
9
|
+
* @param props - CSS custom property names to retrieve, must be in the format `--property-name`
|
|
10
|
+
* @returns Array of property values corresponding to the requested custom properties
|
|
11
|
+
*/
|
|
12
|
+
declare function getCSSVariableValue<Props extends Array<`--${string}`>>(element: HTMLElement, ...props: Props): CreateTuple<Props['length'], string>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves CSS custom property values from `document.body`.
|
|
15
|
+
*
|
|
16
|
+
* @param props - CSS custom property names to retrieve, must be in the format `--property-name`
|
|
17
|
+
* @returns Array of property values corresponding to the requested custom properties
|
|
18
|
+
*/
|
|
19
|
+
declare function getCSSVariableValue<Props extends Array<`--${string}`>>(...props: Props): CreateTuple<Props['length'], string>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getCSSVariableValue };
|
|
22
|
+
//# sourceMappingURL=get-css-variable-value.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-css-variable-value.d.cts","names":[],"sources":["../../src/style/get-css-variable-value.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;;;;;AAGG,iBAHa,mBAGb,CAAA,cAH+C,KAG/C,CAAA,KAAA,MAAA,EAAA,CAAA,CAAA,CAAA,OAAA,EAFO,WAEP,EAAA,GAAA,KAAA,EADQ,KACR,CAAA,EAAA,WAAA,CAAY,KAAZ,CAAA,QAAA,CAAA,EAAA,MAAA,CAAA;;AAOH;;;;;AAEc,iBAFE,mBAEF,CAAA,cAFoC,KAEpC,CAAA,KAAA,MAAA,EAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EADH,KACG,CAAA,EAAX,WAAW,CAAC,KAAD,CAAA,QAAA,CAAA,EAAA,MAAA,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CreateTuple } from "type-plus";
|
|
2
|
+
|
|
3
|
+
//#region src/style/get-css-variable-value.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves CSS custom property values from the specified element.
|
|
7
|
+
*
|
|
8
|
+
* @param element - The HTML element to get property values from
|
|
9
|
+
* @param props - CSS custom property names to retrieve, must be in the format `--property-name`
|
|
10
|
+
* @returns Array of property values corresponding to the requested custom properties
|
|
11
|
+
*/
|
|
12
|
+
declare function getCSSVariableValue<Props extends Array<`--${string}`>>(element: HTMLElement, ...props: Props): CreateTuple<Props['length'], string>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves CSS custom property values from `document.body`.
|
|
15
|
+
*
|
|
16
|
+
* @param props - CSS custom property names to retrieve, must be in the format `--property-name`
|
|
17
|
+
* @returns Array of property values corresponding to the requested custom properties
|
|
18
|
+
*/
|
|
19
|
+
declare function getCSSVariableValue<Props extends Array<`--${string}`>>(...props: Props): CreateTuple<Props['length'], string>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getCSSVariableValue };
|
|
22
|
+
//# sourceMappingURL=get-css-variable-value.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-css-variable-value.d.mts","names":[],"sources":["../../src/style/get-css-variable-value.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;;;;;AAGG,iBAHa,mBAGb,CAAA,cAH+C,KAG/C,CAAA,KAAA,MAAA,EAAA,CAAA,CAAA,CAAA,OAAA,EAFO,WAEP,EAAA,GAAA,KAAA,EADQ,KACR,CAAA,EAAA,WAAA,CAAY,KAAZ,CAAA,QAAA,CAAA,EAAA,MAAA,CAAA;;AAOH;;;;;AAEc,iBAFE,mBAEF,CAAA,cAFoC,KAEpC,CAAA,KAAA,MAAA,EAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EADH,KACG,CAAA,EAAX,WAAW,CAAC,KAAD,CAAA,QAAA,CAAA,EAAA,MAAA,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/style/get-css-variable-value.ts
|
|
2
|
+
function getCSSVariableValue(element, ...props) {
|
|
3
|
+
if (typeof element === "string") return getCSSVariableValue(globalThis.document.body, element, ...props);
|
|
4
|
+
const style = globalThis.getComputedStyle(element);
|
|
5
|
+
return props.map((v) => style.getPropertyValue(v));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getCSSVariableValue };
|
|
10
|
+
//# sourceMappingURL=get-css-variable-value.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-css-variable-value.mjs","names":[],"sources":["../../src/style/get-css-variable-value.ts"],"sourcesContent":["import type { CreateTuple } from 'type-plus'\n\n/**\n * Retrieves CSS custom property values from the specified element.\n *\n * @param element - The HTML element to get property values from\n * @param props - CSS custom property names to retrieve, must be in the format `--property-name`\n * @returns Array of property values corresponding to the requested custom properties\n */\nexport function getCSSVariableValue<Props extends Array<`--${string}`>>(\n\telement: HTMLElement,\n\t...props: Props\n): CreateTuple<Props['length'], string>\n/**\n * Retrieves CSS custom property values from `document.body`.\n *\n * @param props - CSS custom property names to retrieve, must be in the format `--property-name`\n * @returns Array of property values corresponding to the requested custom properties\n */\nexport function getCSSVariableValue<Props extends Array<`--${string}`>>(\n\t...props: Props\n): CreateTuple<Props['length'], string>\nexport function getCSSVariableValue<Props extends Array<`--${string}`>>(\n\telement: unknown,\n\t...props: Props\n) {\n\tif (typeof element === 'string') {\n\t\treturn getCSSVariableValue(globalThis.document.body, element as `--${string}`, ...props)\n\t}\n\tconst style = globalThis.getComputedStyle(element as HTMLElement)\n\treturn props.map((v) => style.getPropertyValue(v)) as any\n}\n"],"mappings":";AAsBA,SAAgB,oBACf,SACA,GAAG,OACF;AACD,KAAI,OAAO,YAAY,SACtB,QAAO,oBAAoB,WAAW,SAAS,MAAM,SAA0B,GAAG,MAAM;CAEzF,MAAM,QAAQ,WAAW,iBAAiB,QAAuB;AACjE,QAAO,MAAM,KAAK,MAAM,MAAM,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.cjs";
|
|
2
|
+
import { AnyRecord } from "type-plus";
|
|
3
|
+
|
|
4
|
+
//#region src/style/just-style.d.ts
|
|
5
|
+
type DefaultLength = 0 | (string & {});
|
|
6
|
+
type DefaultTime = string & {};
|
|
7
|
+
/**
|
|
8
|
+
* Props interface for components that accept a render-props-aware `style`.
|
|
9
|
+
*
|
|
10
|
+
* Use this when defining component props that support the same `style` contract as {@link JustStyle}:
|
|
11
|
+
* a static object, a resolver function that receives render props (including existing `style`), or `undefined`.
|
|
12
|
+
*
|
|
13
|
+
* @typeParam RenderProps - Record type for render props. When `style` is a function, it receives `RenderProps` merged with `{ style?: CSSProperties }`.
|
|
14
|
+
* @typeParam TLength - CSS length type (default: `0 | (string & {})`).
|
|
15
|
+
* @typeParam TTime - CSS time type (default: `string & {}`).
|
|
16
|
+
*/
|
|
17
|
+
interface JustStyleProps<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime> {
|
|
18
|
+
style?: JustStyle<RenderProps, TLength, TTime> | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A `style` type that can be static or computed from render props.
|
|
22
|
+
*
|
|
23
|
+
* - `CSSProperties`: The value is merged with the existing `style` in render props (override wins).
|
|
24
|
+
* - `undefined`: Uses the existing `style` from render props as-is.
|
|
25
|
+
* - `function`: Process the render props and return the desired `style`.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam RenderProps - Record type for render props. Resolvers receive `RenderProps` merged with `{ style?: CSSProperties }`.
|
|
28
|
+
* @typeParam TLength - CSS length type (default: `0 | (string & {})`).
|
|
29
|
+
* @typeParam TTime - CSS time type (default: `string & {}`).
|
|
30
|
+
*/
|
|
31
|
+
type JustStyle<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime> = ((renderProps: JustStyleFnProps<RenderProps, TLength, TTime>) => CSSProperties<TLength, TTime> | undefined) | CSSProperties<TLength, TTime> | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The props type for `JustStyle` resolver functions.
|
|
34
|
+
*
|
|
35
|
+
* @typeParam RenderProps - Record type for render props.
|
|
36
|
+
* @typeParam TLength - CSS length type (default: `0 | (string & {})`).
|
|
37
|
+
* @typeParam TTime - CSS time type (default: `string & {}`).
|
|
38
|
+
*/
|
|
39
|
+
type JustStyleFnProps<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime> = RenderProps & {
|
|
40
|
+
style?: CSSProperties<TLength, TTime> | undefined;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { JustStyle, JustStyleFnProps, JustStyleProps };
|
|
44
|
+
//# sourceMappingURL=just-style.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"just-style.d.cts","names":[],"sources":["../../src/style/just-style.ts"],"sourcesContent":[],"mappings":";;;;KAGK,aAAA;KACA,WAAA;AAHmD;AAEtC;AAalB;;;;;;;;AAKS,UALQ,cAKR,CAAA,oBAJY,SAIZ,GAJwB,SAIxB,EAAA,UAHE,aAGF,EAAA,QAFA,WAEA,CAAA,CAAA;EAAS,KAAA,CAAA,EAAT,SAAS,CAAC,WAAD,EAAc,OAAd,EAAuB,KAAvB,CAAA,GAAA,SAAA;AAclB;;;;;;;;;;;;AAQiB,KARL,SAQK,CAAA,oBAPI,SAOJ,GAPgB,SAOhB,EAAA,UANN,aAMM,EAAA,QALR,WAKQ,CAAA,GAAA,CAAA,CAAA,WAAA,EAFD,gBAEC,CAFgB,WAEhB,EAF6B,OAE7B,EAFsC,KAEtC,CAAA,EAAA,GADT,aACS,CADK,OACL,EADc,KACd,CAAA,GAAA,SAAA,CAAA,GAAd,aAAc,CAAA,OAAA,EAAS,KAAT,CAAA,GAAA,SAAA;;;;AAUjB;;;;AAGS,KAHG,gBAGH,CAAA,oBAFY,SAEZ,GAFwB,SAExB,EAAA,UADE,aACF,EAAA,QAAA,WAAA,CAAA,GACL,WADK,GAAA;EACL,KAAA,CAAA,EACK,aADL,CACmB,OADnB,EAC4B,KAD5B,CAAA,GAAA,SAAA;CACmB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.mjs";
|
|
2
|
+
import { AnyRecord } from "type-plus";
|
|
3
|
+
|
|
4
|
+
//#region src/style/just-style.d.ts
|
|
5
|
+
type DefaultLength = 0 | (string & {});
|
|
6
|
+
type DefaultTime = string & {};
|
|
7
|
+
/**
|
|
8
|
+
* Props interface for components that accept a render-props-aware `style`.
|
|
9
|
+
*
|
|
10
|
+
* Use this when defining component props that support the same `style` contract as {@link JustStyle}:
|
|
11
|
+
* a static object, a resolver function that receives render props (including existing `style`), or `undefined`.
|
|
12
|
+
*
|
|
13
|
+
* @typeParam RenderProps - Record type for render props. When `style` is a function, it receives `RenderProps` merged with `{ style?: CSSProperties }`.
|
|
14
|
+
* @typeParam TLength - CSS length type (default: `0 | (string & {})`).
|
|
15
|
+
* @typeParam TTime - CSS time type (default: `string & {}`).
|
|
16
|
+
*/
|
|
17
|
+
interface JustStyleProps<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime> {
|
|
18
|
+
style?: JustStyle<RenderProps, TLength, TTime> | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A `style` type that can be static or computed from render props.
|
|
22
|
+
*
|
|
23
|
+
* - `CSSProperties`: The value is merged with the existing `style` in render props (override wins).
|
|
24
|
+
* - `undefined`: Uses the existing `style` from render props as-is.
|
|
25
|
+
* - `function`: Process the render props and return the desired `style`.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam RenderProps - Record type for render props. Resolvers receive `RenderProps` merged with `{ style?: CSSProperties }`.
|
|
28
|
+
* @typeParam TLength - CSS length type (default: `0 | (string & {})`).
|
|
29
|
+
* @typeParam TTime - CSS time type (default: `string & {}`).
|
|
30
|
+
*/
|
|
31
|
+
type JustStyle<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime> = ((renderProps: JustStyleFnProps<RenderProps, TLength, TTime>) => CSSProperties<TLength, TTime> | undefined) | CSSProperties<TLength, TTime> | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The props type for `JustStyle` resolver functions.
|
|
34
|
+
*
|
|
35
|
+
* @typeParam RenderProps - Record type for render props.
|
|
36
|
+
* @typeParam TLength - CSS length type (default: `0 | (string & {})`).
|
|
37
|
+
* @typeParam TTime - CSS time type (default: `string & {}`).
|
|
38
|
+
*/
|
|
39
|
+
type JustStyleFnProps<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime> = RenderProps & {
|
|
40
|
+
style?: CSSProperties<TLength, TTime> | undefined;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { JustStyle, JustStyleFnProps, JustStyleProps };
|
|
44
|
+
//# sourceMappingURL=just-style.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"just-style.d.mts","names":[],"sources":["../../src/style/just-style.ts"],"sourcesContent":[],"mappings":";;;;KAGK,aAAA;KACA,WAAA;AAHmD;AAEtC;AAalB;;;;;;;;AAKS,UALQ,cAKR,CAAA,oBAJY,SAIZ,GAJwB,SAIxB,EAAA,UAHE,aAGF,EAAA,QAFA,WAEA,CAAA,CAAA;EAAS,KAAA,CAAA,EAAT,SAAS,CAAC,WAAD,EAAc,OAAd,EAAuB,KAAvB,CAAA,GAAA,SAAA;AAclB;;;;;;;;;;;;AAQiB,KARL,SAQK,CAAA,oBAPI,SAOJ,GAPgB,SAOhB,EAAA,UANN,aAMM,EAAA,QALR,WAKQ,CAAA,GAAA,CAAA,CAAA,WAAA,EAFD,gBAEC,CAFgB,WAEhB,EAF6B,OAE7B,EAFsC,KAEtC,CAAA,EAAA,GADT,aACS,CADK,OACL,EADc,KACd,CAAA,GAAA,SAAA,CAAA,GAAd,aAAc,CAAA,OAAA,EAAS,KAAT,CAAA,GAAA,SAAA;;;;AAUjB;;;;AAGS,KAHG,gBAGH,CAAA,oBAFY,SAEZ,GAFwB,SAExB,EAAA,UADE,aACF,EAAA,QAAA,WAAA,CAAA,GACL,WADK,GAAA;EACL,KAAA,CAAA,EACK,aADL,CACmB,OADnB,EAC4B,KAD5B,CAAA,GAAA,SAAA;CACmB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/style/resolve-style.ts
|
|
3
|
+
function resolveStyle(renderProps, style) {
|
|
4
|
+
if (typeof style === "function") return style(renderProps);
|
|
5
|
+
if (style !== void 0) return {
|
|
6
|
+
...renderProps.style,
|
|
7
|
+
...style
|
|
8
|
+
};
|
|
9
|
+
return renderProps.style;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.resolveStyle = resolveStyle;
|
|
14
|
+
//# sourceMappingURL=resolve-style.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-style.cjs","names":[],"sources":["../../src/style/resolve-style.ts"],"sourcesContent":["import type { AnyRecord } from 'type-plus'\nimport type { CSSProperties } from './css-properties.ts'\nimport type { JustStyle, JustStyleFnProps } from './just-style.ts'\n\ntype DefaultLength = 0 | (string & {})\ntype DefaultTime = string & {}\n\nexport function resolveStyle<\n\tRenderProps extends AnyRecord = AnyRecord,\n\tTLength = DefaultLength,\n\tTTime = DefaultTime\n>(\n\trenderProps: JustStyleFnProps<RenderProps, TLength, TTime>,\n\tstyle?: JustStyle<RenderProps, TLength, TTime>\n): CSSProperties<TLength, TTime> | undefined {\n\tif (typeof style === 'function') {\n\t\treturn style(renderProps)\n\t}\n\tif (style !== undefined) {\n\t\treturn { ...renderProps.style, ...style } as CSSProperties<TLength, TTime>\n\t}\n\treturn renderProps.style\n}\n"],"mappings":";;AAOA,SAAgB,aAKf,aACA,OAC4C;AAC5C,KAAI,OAAO,UAAU,WACpB,QAAO,MAAM,YAAY;AAE1B,KAAI,UAAU,OACb,QAAO;EAAE,GAAG,YAAY;EAAO,GAAG;EAAO;AAE1C,QAAO,YAAY"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.cjs";
|
|
2
|
+
import { JustStyle, JustStyleFnProps } from "./just-style.cjs";
|
|
3
|
+
import { AnyRecord } from "type-plus";
|
|
4
|
+
|
|
5
|
+
//#region src/style/resolve-style.d.ts
|
|
6
|
+
type DefaultLength = 0 | (string & {});
|
|
7
|
+
type DefaultTime = string & {};
|
|
8
|
+
declare function resolveStyle<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime>(renderProps: JustStyleFnProps<RenderProps, TLength, TTime>, style?: JustStyle<RenderProps, TLength, TTime>): CSSProperties<TLength, TTime> | undefined;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { resolveStyle };
|
|
11
|
+
//# sourceMappingURL=resolve-style.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-style.d.cts","names":[],"sources":["../../src/style/resolve-style.ts"],"sourcesContent":[],"mappings":";;;;;KAIK,aAAA;KACA,WAAA;AADA,iBAGW,YAHE,CAAA,oBAIG,SAJH,GAIe,SAJf,EAAA,UAKP,aALO,EAAA,QAMT,WANS,CAAA,CAAA,WAAA,EAQJ,gBARI,CAQa,WARb,EAQ0B,OAR1B,EAQmC,KARnC,CAAA,EAAA,KAAA,CAAA,EAST,SATS,CASC,WATD,EASc,OATd,EASuB,KATvB,CAAA,CAAA,EAUf,aAVe,CAUD,OAVC,EAUQ,KAVR,CAAA,GAAA,SAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.mjs";
|
|
2
|
+
import { JustStyle, JustStyleFnProps } from "./just-style.mjs";
|
|
3
|
+
import { AnyRecord } from "type-plus";
|
|
4
|
+
|
|
5
|
+
//#region src/style/resolve-style.d.ts
|
|
6
|
+
type DefaultLength = 0 | (string & {});
|
|
7
|
+
type DefaultTime = string & {};
|
|
8
|
+
declare function resolveStyle<RenderProps extends AnyRecord = AnyRecord, TLength = DefaultLength, TTime = DefaultTime>(renderProps: JustStyleFnProps<RenderProps, TLength, TTime>, style?: JustStyle<RenderProps, TLength, TTime>): CSSProperties<TLength, TTime> | undefined;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { resolveStyle };
|
|
11
|
+
//# sourceMappingURL=resolve-style.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-style.d.mts","names":[],"sources":["../../src/style/resolve-style.ts"],"sourcesContent":[],"mappings":";;;;;KAIK,aAAA;KACA,WAAA;AADA,iBAGW,YAHE,CAAA,oBAIG,SAJH,GAIe,SAJf,EAAA,UAKP,aALO,EAAA,QAMT,WANS,CAAA,CAAA,WAAA,EAQJ,gBARI,CAQa,WARb,EAQ0B,OAR1B,EAQmC,KARnC,CAAA,EAAA,KAAA,CAAA,EAST,SATS,CASC,WATD,EASc,OATd,EASuB,KATvB,CAAA,CAAA,EAUf,aAVe,CAUD,OAVC,EAUQ,KAVR,CAAA,GAAA,SAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/style/resolve-style.ts
|
|
2
|
+
function resolveStyle(renderProps, style) {
|
|
3
|
+
if (typeof style === "function") return style(renderProps);
|
|
4
|
+
if (style !== void 0) return {
|
|
5
|
+
...renderProps.style,
|
|
6
|
+
...style
|
|
7
|
+
};
|
|
8
|
+
return renderProps.style;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { resolveStyle };
|
|
13
|
+
//# sourceMappingURL=resolve-style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-style.mjs","names":[],"sources":["../../src/style/resolve-style.ts"],"sourcesContent":["import type { AnyRecord } from 'type-plus'\nimport type { CSSProperties } from './css-properties.ts'\nimport type { JustStyle, JustStyleFnProps } from './just-style.ts'\n\ntype DefaultLength = 0 | (string & {})\ntype DefaultTime = string & {}\n\nexport function resolveStyle<\n\tRenderProps extends AnyRecord = AnyRecord,\n\tTLength = DefaultLength,\n\tTTime = DefaultTime\n>(\n\trenderProps: JustStyleFnProps<RenderProps, TLength, TTime>,\n\tstyle?: JustStyle<RenderProps, TLength, TTime>\n): CSSProperties<TLength, TTime> | undefined {\n\tif (typeof style === 'function') {\n\t\treturn style(renderProps)\n\t}\n\tif (style !== undefined) {\n\t\treturn { ...renderProps.style, ...style } as CSSProperties<TLength, TTime>\n\t}\n\treturn renderProps.style\n}\n"],"mappings":";AAOA,SAAgB,aAKf,aACA,OAC4C;AAC5C,KAAI,OAAO,UAAU,WACpB,QAAO,MAAM,YAAY;AAE1B,KAAI,UAAU,OACb,QAAO;EAAE,GAAG,YAAY;EAAO,GAAG;EAAO;AAE1C,QAAO,YAAY"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/style/style-props.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Interface for component props that include a style property.
|
|
7
|
+
*/
|
|
8
|
+
type StyleProps<TLength = 0 | (string & {}), TTime = string & {}> = {
|
|
9
|
+
style?: CSSProperties<TLength, TTime> | undefined;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { StyleProps };
|
|
13
|
+
//# sourceMappingURL=style-props.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-props.d.cts","names":[],"sources":["../../src/style/style-props.ts"],"sourcesContent":[],"mappings":";;;;;;AAKA;AACuB,KADX,UACW,CAAA,UAAA,CAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,EAAA,QAAA,MAAA,GAAA,CAAA,CAAA,CAAA,GAAA;EAAS,KAAA,CAAA,EAAvB,aAAuB,CAAT,OAAS,EAAA,KAAA,CAAA,GAAA,SAAA;CAAvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/style/style-props.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Interface for component props that include a style property.
|
|
7
|
+
*/
|
|
8
|
+
type StyleProps<TLength = 0 | (string & {}), TTime = string & {}> = {
|
|
9
|
+
style?: CSSProperties<TLength, TTime> | undefined;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { StyleProps };
|
|
13
|
+
//# sourceMappingURL=style-props.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-props.d.mts","names":[],"sources":["../../src/style/style-props.ts"],"sourcesContent":[],"mappings":";;;;;;AAKA;AACuB,KADX,UACW,CAAA,UAAA,CAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,EAAA,QAAA,MAAA,GAAA,CAAA,CAAA,CAAA,GAAA;EAAS,KAAA,CAAA,EAAvB,aAAuB,CAAT,OAAS,EAAA,KAAA,CAAA,GAAA,SAAA;CAAvB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/style/to-dom-style.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts React-style CSS properties to DOM style properties.
|
|
5
|
+
* This function handles both standard CSS properties and custom properties,
|
|
6
|
+
* ensuring proper formatting for DOM style application.
|
|
7
|
+
*
|
|
8
|
+
* @param style - React-style CSS properties object
|
|
9
|
+
* @returns DOM style properties object
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const domStyle = toDomStyle({
|
|
14
|
+
* backgroundColor: 'red',
|
|
15
|
+
* '--custom-color': '#ff0000'
|
|
16
|
+
* })
|
|
17
|
+
* if (domStyle && element.style) {
|
|
18
|
+
* for (const [key, value] of Object.entries(domStyle)) {
|
|
19
|
+
* element.style.setProperty(key, value)
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function toDomStyle(style) {
|
|
25
|
+
if (style === void 0) return void 0;
|
|
26
|
+
const result = {};
|
|
27
|
+
for (const [key, value] of Object.entries(style)) result[key.startsWith("--") ? key : key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`)] = value;
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.toDomStyle = toDomStyle;
|
|
33
|
+
//# sourceMappingURL=to-dom-style.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-dom-style.cjs","names":["result: Record<string, string | null>"],"sources":["../../src/style/to-dom-style.ts"],"sourcesContent":["import type { CSSProperties } from './css-properties.ts'\n\n/**\n * Converts React-style CSS properties to DOM style properties.\n * This function handles both standard CSS properties and custom properties,\n * ensuring proper formatting for DOM style application.\n *\n * @param style - React-style CSS properties object\n * @returns DOM style properties object\n *\n * @example\n * ```ts\n * const domStyle = toDomStyle({\n * backgroundColor: 'red',\n * '--custom-color': '#ff0000'\n * })\n * if (domStyle && element.style) {\n * for (const [key, value] of Object.entries(domStyle)) {\n * element.style.setProperty(key, value)\n * }\n * }\n * ```\n */\nexport function toDomStyle(style: CSSProperties | undefined) {\n\tif (style === undefined) return undefined\n\n\tconst result: Record<string, string | null> = {}\n\n\tfor (const [key, value] of Object.entries(style)) {\n\t\tresult[\n\t\t\tkey.startsWith('--') ? key : key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`)\n\t\t] = value\n\t}\n\n\treturn result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,WAAW,OAAkC;AAC5D,KAAI,UAAU,OAAW,QAAO;CAEhC,MAAMA,SAAwC,EAAE;AAEhD,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC/C,QACC,IAAI,WAAW,KAAK,GAAG,MAAM,IAAI,QAAQ,WAAW,UAAU,IAAI,MAAM,aAAa,GAAG,IACrF;AAGL,QAAO"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/style/to-dom-style.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts React-style CSS properties to DOM style properties.
|
|
7
|
+
* This function handles both standard CSS properties and custom properties,
|
|
8
|
+
* ensuring proper formatting for DOM style application.
|
|
9
|
+
*
|
|
10
|
+
* @param style - React-style CSS properties object
|
|
11
|
+
* @returns DOM style properties object
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const domStyle = toDomStyle({
|
|
16
|
+
* backgroundColor: 'red',
|
|
17
|
+
* '--custom-color': '#ff0000'
|
|
18
|
+
* })
|
|
19
|
+
* if (domStyle && element.style) {
|
|
20
|
+
* for (const [key, value] of Object.entries(domStyle)) {
|
|
21
|
+
* element.style.setProperty(key, value)
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function toDomStyle(style: CSSProperties | undefined): Record<string, string | null> | undefined;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { toDomStyle };
|
|
29
|
+
//# sourceMappingURL=to-dom-style.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-dom-style.d.cts","names":[],"sources":["../../src/style/to-dom-style.ts"],"sourcesContent":[],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;;;;;;iBAAgB,UAAA,QAAkB,4BAAyB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-properties.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/style/to-dom-style.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts React-style CSS properties to DOM style properties.
|
|
7
|
+
* This function handles both standard CSS properties and custom properties,
|
|
8
|
+
* ensuring proper formatting for DOM style application.
|
|
9
|
+
*
|
|
10
|
+
* @param style - React-style CSS properties object
|
|
11
|
+
* @returns DOM style properties object
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const domStyle = toDomStyle({
|
|
16
|
+
* backgroundColor: 'red',
|
|
17
|
+
* '--custom-color': '#ff0000'
|
|
18
|
+
* })
|
|
19
|
+
* if (domStyle && element.style) {
|
|
20
|
+
* for (const [key, value] of Object.entries(domStyle)) {
|
|
21
|
+
* element.style.setProperty(key, value)
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function toDomStyle(style: CSSProperties | undefined): Record<string, string | null> | undefined;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { toDomStyle };
|
|
29
|
+
//# sourceMappingURL=to-dom-style.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-dom-style.d.mts","names":[],"sources":["../../src/style/to-dom-style.ts"],"sourcesContent":[],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;;;;;;iBAAgB,UAAA,QAAkB,4BAAyB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/style/to-dom-style.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts React-style CSS properties to DOM style properties.
|
|
4
|
+
* This function handles both standard CSS properties and custom properties,
|
|
5
|
+
* ensuring proper formatting for DOM style application.
|
|
6
|
+
*
|
|
7
|
+
* @param style - React-style CSS properties object
|
|
8
|
+
* @returns DOM style properties object
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const domStyle = toDomStyle({
|
|
13
|
+
* backgroundColor: 'red',
|
|
14
|
+
* '--custom-color': '#ff0000'
|
|
15
|
+
* })
|
|
16
|
+
* if (domStyle && element.style) {
|
|
17
|
+
* for (const [key, value] of Object.entries(domStyle)) {
|
|
18
|
+
* element.style.setProperty(key, value)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function toDomStyle(style) {
|
|
24
|
+
if (style === void 0) return void 0;
|
|
25
|
+
const result = {};
|
|
26
|
+
for (const [key, value] of Object.entries(style)) result[key.startsWith("--") ? key : key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`)] = value;
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { toDomStyle };
|
|
32
|
+
//# sourceMappingURL=to-dom-style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-dom-style.mjs","names":["result: Record<string, string | null>"],"sources":["../../src/style/to-dom-style.ts"],"sourcesContent":["import type { CSSProperties } from './css-properties.ts'\n\n/**\n * Converts React-style CSS properties to DOM style properties.\n * This function handles both standard CSS properties and custom properties,\n * ensuring proper formatting for DOM style application.\n *\n * @param style - React-style CSS properties object\n * @returns DOM style properties object\n *\n * @example\n * ```ts\n * const domStyle = toDomStyle({\n * backgroundColor: 'red',\n * '--custom-color': '#ff0000'\n * })\n * if (domStyle && element.style) {\n * for (const [key, value] of Object.entries(domStyle)) {\n * element.style.setProperty(key, value)\n * }\n * }\n * ```\n */\nexport function toDomStyle(style: CSSProperties | undefined) {\n\tif (style === undefined) return undefined\n\n\tconst result: Record<string, string | null> = {}\n\n\tfor (const [key, value] of Object.entries(style)) {\n\t\tresult[\n\t\t\tkey.startsWith('--') ? key : key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`)\n\t\t] = value\n\t}\n\n\treturn result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,WAAW,OAAkC;AAC5D,KAAI,UAAU,OAAW,QAAO;CAEhC,MAAMA,SAAwC,EAAE;AAEhD,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC/C,QACC,IAAI,WAAW,KAAK,GAAG,MAAM,IAAI,QAAQ,WAAW,UAAU,IAAI,MAAM,aAAa,GAAG,IACrF;AAGL,QAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/testing/theme/dummy-theme-store.ts
|
|
3
|
+
const dummyThemeStore = {
|
|
4
|
+
read: () => void 0,
|
|
5
|
+
write: () => {},
|
|
6
|
+
subscribe: () => () => {}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.dummyThemeStore = dummyThemeStore;
|
|
11
|
+
//# sourceMappingURL=dummy-theme-store.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dummy-theme-store.cjs","names":[],"sources":["../../../src/testing/theme/dummy-theme-store.ts"],"sourcesContent":["import type { ThemeStore } from '../../theme/theme-store/theme-store.types.ts'\n\nexport const dummyThemeStore = {\n\tread: () => undefined,\n\twrite: () => {},\n\tsubscribe: () => () => {}\n} satisfies ThemeStore\n"],"mappings":";;AAEA,MAAa,kBAAkB;CAC9B,YAAY;CACZ,aAAa;CACb,uBAAuB;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dummy-theme-store.mjs","names":[],"sources":["../../../src/testing/theme/dummy-theme-store.ts"],"sourcesContent":["import type { ThemeStore } from '../../theme/theme-store/theme-store.types.ts'\n\nexport const dummyThemeStore = {\n\tread: () => undefined,\n\twrite: () => {},\n\tsubscribe: () => () => {}\n} satisfies ThemeStore\n"],"mappings":";AAEA,MAAa,kBAAkB;CAC9B,YAAY;CACZ,aAAa;CACb,uBAAuB;CACvB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/theme/_utils/get-theme-from-stores.ts
|
|
3
|
+
/**
|
|
4
|
+
* Reads theme from stores using waterfall strategy.
|
|
5
|
+
*
|
|
6
|
+
* Iterates stores in order; returns first non-empty result.
|
|
7
|
+
* Only includes stores that have a `read` method.
|
|
8
|
+
*
|
|
9
|
+
* @param stores - Array of theme stores
|
|
10
|
+
* @param defaultTheme - Fallback when all stores return empty
|
|
11
|
+
* @returns Resolved theme key or defaultTheme
|
|
12
|
+
*/
|
|
13
|
+
async function getThemeFromStores(stores, defaultTheme) {
|
|
14
|
+
const withRead = stores.filter((s) => typeof s.read === "function");
|
|
15
|
+
for (const store of withRead) {
|
|
16
|
+
const result = await Promise.resolve(store.read());
|
|
17
|
+
if (result !== void 0) return result.theme;
|
|
18
|
+
}
|
|
19
|
+
return defaultTheme;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.getThemeFromStores = getThemeFromStores;
|
|
24
|
+
//# sourceMappingURL=get-theme-from-stores.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-theme-from-stores.cjs","names":[],"sources":["../../../src/theme/_utils/get-theme-from-stores.ts"],"sourcesContent":["import type { ThemeEntry } from '../theme-entry.types.ts'\nimport type { ThemeMap } from '../theme-map.types.ts'\nimport type { AsyncThemeStore } from '../theme-store/async-theme-store.types.ts'\nimport type { ThemeStore } from '../theme-store/theme-store.types.ts'\n\ntype StoreWithRead<Themes extends ThemeMap> = (ThemeStore<Themes> | AsyncThemeStore<Themes>) & {\n\tread: () => ThemeEntry<Themes> | undefined | Promise<ThemeEntry<Themes> | undefined>\n}\n\n/**\n * Reads theme from stores using waterfall strategy.\n *\n * Iterates stores in order; returns first non-empty result.\n * Only includes stores that have a `read` method.\n *\n * @param stores - Array of theme stores\n * @param defaultTheme - Fallback when all stores return empty\n * @returns Resolved theme key or defaultTheme\n */\nexport async function getThemeFromStores<Themes extends ThemeMap>(\n\tstores: (ThemeStore<Themes> | AsyncThemeStore<Themes>)[],\n\tdefaultTheme: keyof Themes | undefined\n): Promise<keyof Themes | undefined> {\n\tconst withRead = stores.filter((s): s is StoreWithRead<Themes> => typeof s.read === 'function')\n\n\tfor (const store of withRead) {\n\t\tconst result = await Promise.resolve(store.read())\n\t\tif (result !== undefined) {\n\t\t\treturn result.theme\n\t\t}\n\t}\n\n\treturn defaultTheme\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,eAAsB,mBACrB,QACA,cACoC;CACpC,MAAM,WAAW,OAAO,QAAQ,MAAkC,OAAO,EAAE,SAAS,WAAW;AAE/F,MAAK,MAAM,SAAS,UAAU;EAC7B,MAAM,SAAS,MAAM,QAAQ,QAAQ,MAAM,MAAM,CAAC;AAClD,MAAI,WAAW,OACd,QAAO,OAAO;;AAIhB,QAAO"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/theme/_utils/get-theme-from-stores.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reads theme from stores using waterfall strategy.
|
|
4
|
+
*
|
|
5
|
+
* Iterates stores in order; returns first non-empty result.
|
|
6
|
+
* Only includes stores that have a `read` method.
|
|
7
|
+
*
|
|
8
|
+
* @param stores - Array of theme stores
|
|
9
|
+
* @param defaultTheme - Fallback when all stores return empty
|
|
10
|
+
* @returns Resolved theme key or defaultTheme
|
|
11
|
+
*/
|
|
12
|
+
async function getThemeFromStores(stores, defaultTheme) {
|
|
13
|
+
const withRead = stores.filter((s) => typeof s.read === "function");
|
|
14
|
+
for (const store of withRead) {
|
|
15
|
+
const result = await Promise.resolve(store.read());
|
|
16
|
+
if (result !== void 0) return result.theme;
|
|
17
|
+
}
|
|
18
|
+
return defaultTheme;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getThemeFromStores };
|
|
23
|
+
//# sourceMappingURL=get-theme-from-stores.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-theme-from-stores.mjs","names":[],"sources":["../../../src/theme/_utils/get-theme-from-stores.ts"],"sourcesContent":["import type { ThemeEntry } from '../theme-entry.types.ts'\nimport type { ThemeMap } from '../theme-map.types.ts'\nimport type { AsyncThemeStore } from '../theme-store/async-theme-store.types.ts'\nimport type { ThemeStore } from '../theme-store/theme-store.types.ts'\n\ntype StoreWithRead<Themes extends ThemeMap> = (ThemeStore<Themes> | AsyncThemeStore<Themes>) & {\n\tread: () => ThemeEntry<Themes> | undefined | Promise<ThemeEntry<Themes> | undefined>\n}\n\n/**\n * Reads theme from stores using waterfall strategy.\n *\n * Iterates stores in order; returns first non-empty result.\n * Only includes stores that have a `read` method.\n *\n * @param stores - Array of theme stores\n * @param defaultTheme - Fallback when all stores return empty\n * @returns Resolved theme key or defaultTheme\n */\nexport async function getThemeFromStores<Themes extends ThemeMap>(\n\tstores: (ThemeStore<Themes> | AsyncThemeStore<Themes>)[],\n\tdefaultTheme: keyof Themes | undefined\n): Promise<keyof Themes | undefined> {\n\tconst withRead = stores.filter((s): s is StoreWithRead<Themes> => typeof s.read === 'function')\n\n\tfor (const store of withRead) {\n\t\tconst result = await Promise.resolve(store.read())\n\t\tif (result !== undefined) {\n\t\t\treturn result.theme\n\t\t}\n\t}\n\n\treturn defaultTheme\n}\n"],"mappings":";;;;;;;;;;;AAmBA,eAAsB,mBACrB,QACA,cACoC;CACpC,MAAM,WAAW,OAAO,QAAQ,MAAkC,OAAO,EAAE,SAAS,WAAW;AAE/F,MAAK,MAAM,SAAS,UAAU;EAC7B,MAAM,SAAS,MAAM,QAAQ,QAAQ,MAAM,MAAM,CAAC;AAClD,MAAI,WAAW,OACd,QAAO,OAAO;;AAIhB,QAAO"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const require_get_theme_from_stores = require('./get-theme-from-stores.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/theme/_utils/observe-theme-from-stores.ts
|
|
4
|
+
/**
|
|
5
|
+
* Subscribes to stores that have a subscribe method.
|
|
6
|
+
*
|
|
7
|
+
* When any store emits, runs coalesced handler (getThemeFromStores + callback).
|
|
8
|
+
* Skips handler if resolved theme equals last emitted (value equality).
|
|
9
|
+
*
|
|
10
|
+
* @param stores - Array of theme stores
|
|
11
|
+
* @param defaultTheme - Fallback when all stores return empty
|
|
12
|
+
* @param handler - Callback with resolved theme key
|
|
13
|
+
* @returns Unsubscribe function
|
|
14
|
+
*/
|
|
15
|
+
function observeThemeFromStores(stores, defaultTheme, handler) {
|
|
16
|
+
const withSubscribe = stores.filter((s) => typeof s.subscribe === "function");
|
|
17
|
+
let scheduled = false;
|
|
18
|
+
let lastEmitted;
|
|
19
|
+
const scheduleNotify = () => {
|
|
20
|
+
if (scheduled) return;
|
|
21
|
+
scheduled = true;
|
|
22
|
+
queueMicrotask(async () => {
|
|
23
|
+
scheduled = false;
|
|
24
|
+
const theme = await require_get_theme_from_stores.getThemeFromStores(stores, defaultTheme);
|
|
25
|
+
if (theme === lastEmitted) return;
|
|
26
|
+
lastEmitted = theme;
|
|
27
|
+
handler(theme);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
scheduleNotify();
|
|
31
|
+
const unSubs = withSubscribe.map((s) => s.subscribe((_result) => scheduleNotify()));
|
|
32
|
+
return () => {
|
|
33
|
+
for (const unSub of unSubs) unSub();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.observeThemeFromStores = observeThemeFromStores;
|
|
39
|
+
//# sourceMappingURL=observe-theme-from-stores.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-theme-from-stores.cjs","names":["lastEmitted: keyof Themes | undefined","getThemeFromStores"],"sources":["../../../src/theme/_utils/observe-theme-from-stores.ts"],"sourcesContent":["import type { RequiredPick } from 'type-plus'\nimport type { ThemeMap } from '../theme-map.types.ts'\nimport type { AsyncThemeStore } from '../theme-store/async-theme-store.types.ts'\nimport type { ThemeStore } from '../theme-store/theme-store.types.ts'\nimport { getThemeFromStores } from './get-theme-from-stores.ts'\n\ntype StoreWithSubscribe<Themes extends ThemeMap> = RequiredPick<\n\tAsyncThemeStore<Themes>,\n\t'subscribe'\n>\n\n/**\n * Subscribes to stores that have a subscribe method.\n *\n * When any store emits, runs coalesced handler (getThemeFromStores + callback).\n * Skips handler if resolved theme equals last emitted (value equality).\n *\n * @param stores - Array of theme stores\n * @param defaultTheme - Fallback when all stores return empty\n * @param handler - Callback with resolved theme key\n * @returns Unsubscribe function\n */\nexport function observeThemeFromStores<Themes extends ThemeMap>(\n\tstores: (ThemeStore<Themes> | AsyncThemeStore<Themes>)[],\n\tdefaultTheme: keyof Themes | undefined,\n\thandler: (theme: keyof Themes | undefined) => void\n): () => void {\n\tconst withSubscribe = stores.filter(\n\t\t(s): s is StoreWithSubscribe<Themes> => typeof s.subscribe === 'function'\n\t)\n\n\tlet scheduled = false\n\tlet lastEmitted: keyof Themes | undefined\n\n\tconst scheduleNotify = () => {\n\t\tif (scheduled) return\n\t\tscheduled = true\n\t\tqueueMicrotask(async () => {\n\t\t\tscheduled = false\n\t\t\tconst theme = await getThemeFromStores(stores, defaultTheme)\n\t\t\tif (theme === lastEmitted) return\n\t\t\tlastEmitted = theme\n\t\t\thandler(theme)\n\t\t})\n\t}\n\n\t// Initial notify\n\tscheduleNotify()\n\n\tconst unSubs = withSubscribe.map((s) => s.subscribe!((_result) => scheduleNotify()))\n\n\treturn () => {\n\t\tfor (const unSub of unSubs) {\n\t\t\tunSub()\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,SAAgB,uBACf,QACA,cACA,SACa;CACb,MAAM,gBAAgB,OAAO,QAC3B,MAAuC,OAAO,EAAE,cAAc,WAC/D;CAED,IAAI,YAAY;CAChB,IAAIA;CAEJ,MAAM,uBAAuB;AAC5B,MAAI,UAAW;AACf,cAAY;AACZ,iBAAe,YAAY;AAC1B,eAAY;GACZ,MAAM,QAAQ,MAAMC,iDAAmB,QAAQ,aAAa;AAC5D,OAAI,UAAU,YAAa;AAC3B,iBAAc;AACd,WAAQ,MAAM;IACb;;AAIH,iBAAgB;CAEhB,MAAM,SAAS,cAAc,KAAK,MAAM,EAAE,WAAY,YAAY,gBAAgB,CAAC,CAAC;AAEpF,cAAa;AACZ,OAAK,MAAM,SAAS,OACnB,QAAO"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getThemeFromStores } from "./get-theme-from-stores.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/theme/_utils/observe-theme-from-stores.ts
|
|
4
|
+
/**
|
|
5
|
+
* Subscribes to stores that have a subscribe method.
|
|
6
|
+
*
|
|
7
|
+
* When any store emits, runs coalesced handler (getThemeFromStores + callback).
|
|
8
|
+
* Skips handler if resolved theme equals last emitted (value equality).
|
|
9
|
+
*
|
|
10
|
+
* @param stores - Array of theme stores
|
|
11
|
+
* @param defaultTheme - Fallback when all stores return empty
|
|
12
|
+
* @param handler - Callback with resolved theme key
|
|
13
|
+
* @returns Unsubscribe function
|
|
14
|
+
*/
|
|
15
|
+
function observeThemeFromStores(stores, defaultTheme, handler) {
|
|
16
|
+
const withSubscribe = stores.filter((s) => typeof s.subscribe === "function");
|
|
17
|
+
let scheduled = false;
|
|
18
|
+
let lastEmitted;
|
|
19
|
+
const scheduleNotify = () => {
|
|
20
|
+
if (scheduled) return;
|
|
21
|
+
scheduled = true;
|
|
22
|
+
queueMicrotask(async () => {
|
|
23
|
+
scheduled = false;
|
|
24
|
+
const theme = await getThemeFromStores(stores, defaultTheme);
|
|
25
|
+
if (theme === lastEmitted) return;
|
|
26
|
+
lastEmitted = theme;
|
|
27
|
+
handler(theme);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
scheduleNotify();
|
|
31
|
+
const unSubs = withSubscribe.map((s) => s.subscribe((_result) => scheduleNotify()));
|
|
32
|
+
return () => {
|
|
33
|
+
for (const unSub of unSubs) unSub();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { observeThemeFromStores };
|
|
39
|
+
//# sourceMappingURL=observe-theme-from-stores.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-theme-from-stores.mjs","names":["lastEmitted: keyof Themes | undefined"],"sources":["../../../src/theme/_utils/observe-theme-from-stores.ts"],"sourcesContent":["import type { RequiredPick } from 'type-plus'\nimport type { ThemeMap } from '../theme-map.types.ts'\nimport type { AsyncThemeStore } from '../theme-store/async-theme-store.types.ts'\nimport type { ThemeStore } from '../theme-store/theme-store.types.ts'\nimport { getThemeFromStores } from './get-theme-from-stores.ts'\n\ntype StoreWithSubscribe<Themes extends ThemeMap> = RequiredPick<\n\tAsyncThemeStore<Themes>,\n\t'subscribe'\n>\n\n/**\n * Subscribes to stores that have a subscribe method.\n *\n * When any store emits, runs coalesced handler (getThemeFromStores + callback).\n * Skips handler if resolved theme equals last emitted (value equality).\n *\n * @param stores - Array of theme stores\n * @param defaultTheme - Fallback when all stores return empty\n * @param handler - Callback with resolved theme key\n * @returns Unsubscribe function\n */\nexport function observeThemeFromStores<Themes extends ThemeMap>(\n\tstores: (ThemeStore<Themes> | AsyncThemeStore<Themes>)[],\n\tdefaultTheme: keyof Themes | undefined,\n\thandler: (theme: keyof Themes | undefined) => void\n): () => void {\n\tconst withSubscribe = stores.filter(\n\t\t(s): s is StoreWithSubscribe<Themes> => typeof s.subscribe === 'function'\n\t)\n\n\tlet scheduled = false\n\tlet lastEmitted: keyof Themes | undefined\n\n\tconst scheduleNotify = () => {\n\t\tif (scheduled) return\n\t\tscheduled = true\n\t\tqueueMicrotask(async () => {\n\t\t\tscheduled = false\n\t\t\tconst theme = await getThemeFromStores(stores, defaultTheme)\n\t\t\tif (theme === lastEmitted) return\n\t\t\tlastEmitted = theme\n\t\t\thandler(theme)\n\t\t})\n\t}\n\n\t// Initial notify\n\tscheduleNotify()\n\n\tconst unSubs = withSubscribe.map((s) => s.subscribe!((_result) => scheduleNotify()))\n\n\treturn () => {\n\t\tfor (const unSub of unSubs) {\n\t\t\tunSub()\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,SAAgB,uBACf,QACA,cACA,SACa;CACb,MAAM,gBAAgB,OAAO,QAC3B,MAAuC,OAAO,EAAE,cAAc,WAC/D;CAED,IAAI,YAAY;CAChB,IAAIA;CAEJ,MAAM,uBAAuB;AAC5B,MAAI,UAAW;AACf,cAAY;AACZ,iBAAe,YAAY;AAC1B,eAAY;GACZ,MAAM,QAAQ,MAAM,mBAAmB,QAAQ,aAAa;AAC5D,OAAI,UAAU,YAAa;AAC3B,iBAAc;AACd,WAAQ,MAAM;IACb;;AAIH,iBAAgB;CAEhB,MAAM,SAAS,cAAc,KAAK,MAAM,EAAE,WAAY,YAAY,gBAAgB,CAAC,CAAC;AAEpF,cAAa;AACZ,OAAK,MAAM,SAAS,OACnB,QAAO"}
|