@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,10 @@
|
|
|
1
|
+
import { ThemeMap } from "../theme-map.types.cjs";
|
|
2
|
+
import { AsyncThemeStore } from "./async-theme-store.types.cjs";
|
|
3
|
+
import { ThemeStore } from "./theme-store.types.cjs";
|
|
4
|
+
|
|
5
|
+
//#region src/theme/theme-store/theme-store-factory.types.d.ts
|
|
6
|
+
/** Factory signature for theme stores. */
|
|
7
|
+
type ThemeStoreFactory<Themes extends ThemeMap> = (themes: Themes, ...args: any[]) => ThemeStore<Themes> | AsyncThemeStore<Themes>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ThemeStoreFactory };
|
|
10
|
+
//# sourceMappingURL=theme-store-factory.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-store-factory.types.d.cts","names":[],"sources":["../../../src/theme/theme-store/theme-store-factory.types.ts"],"sourcesContent":[],"mappings":";;;;;;KAKY,iCAAiC,qBACpC,2BAEJ,WAAW,UAAU,gBAAgB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ThemeMap } from "../theme-map.types.mjs";
|
|
2
|
+
import { AsyncThemeStore } from "./async-theme-store.types.mjs";
|
|
3
|
+
import { ThemeStore } from "./theme-store.types.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/theme/theme-store/theme-store-factory.types.d.ts
|
|
6
|
+
/** Factory signature for theme stores. */
|
|
7
|
+
type ThemeStoreFactory<Themes extends ThemeMap> = (themes: Themes, ...args: any[]) => ThemeStore<Themes> | AsyncThemeStore<Themes>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ThemeStoreFactory };
|
|
10
|
+
//# sourceMappingURL=theme-store-factory.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-store-factory.types.d.mts","names":[],"sources":["../../../src/theme/theme-store/theme-store-factory.types.ts"],"sourcesContent":[],"mappings":";;;;;;KAKY,iCAAiC,qBACpC,2BAEJ,WAAW,UAAU,gBAAgB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ThemeMap } from "../theme-map.types.cjs";
|
|
2
|
+
import { ThemeEntry } from "../theme-entry.types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/theme/theme-store/theme-store.types.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Interface for theme stores with optional read, write, and subscribe methods.
|
|
8
|
+
* Data flow participation is inferred from which methods exist:
|
|
9
|
+
*
|
|
10
|
+
* - **read** – Participates in waterfall read for `getThemeFromStores`
|
|
11
|
+
* - **write** – Receives writes from `setThemeToStores`
|
|
12
|
+
* - **subscribe** – GObserved for external changes via `observeThemeFromStores`
|
|
13
|
+
*
|
|
14
|
+
* All methods are optional.
|
|
15
|
+
* Built-in implementations:
|
|
16
|
+
* - `classNameThemeStore`
|
|
17
|
+
* - `cookieThemeStore`
|
|
18
|
+
* - `dataAttributeThemeStore`
|
|
19
|
+
* - `inMemoryThemeStore`
|
|
20
|
+
* - `localStorageThemeStore`
|
|
21
|
+
* - `prefersColorSchemeThemeStore`
|
|
22
|
+
* - `sessionStorageThemeStore`
|
|
23
|
+
*
|
|
24
|
+
* @typeParam Themes - Map of theme keys to their value types (string or readonly string[])
|
|
25
|
+
*/
|
|
26
|
+
interface ThemeStore<Themes extends ThemeMap = ThemeMap> {
|
|
27
|
+
read?: (() => ThemeEntry<Themes> | undefined) | undefined;
|
|
28
|
+
write?: ((entry: ThemeEntry<Themes> | undefined) => void) | undefined;
|
|
29
|
+
subscribe?: ((handler: (theme: ThemeEntry<Themes> | undefined | null) => void) => () => void) | undefined;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { ThemeStore };
|
|
33
|
+
//# sourceMappingURL=theme-store.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-store.types.d.cts","names":[],"sources":["../../../src/theme/theme-store/theme-store.types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAuBA;;;;;;;;;;;;;;;;;;UAAiB,0BAA0B,WAAW;gBACvC,WAAW;mBACR,WAAW;iCAEN,WAAW"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ThemeMap } from "../theme-map.types.mjs";
|
|
2
|
+
import { ThemeEntry } from "../theme-entry.types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/theme/theme-store/theme-store.types.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Interface for theme stores with optional read, write, and subscribe methods.
|
|
8
|
+
* Data flow participation is inferred from which methods exist:
|
|
9
|
+
*
|
|
10
|
+
* - **read** – Participates in waterfall read for `getThemeFromStores`
|
|
11
|
+
* - **write** – Receives writes from `setThemeToStores`
|
|
12
|
+
* - **subscribe** – GObserved for external changes via `observeThemeFromStores`
|
|
13
|
+
*
|
|
14
|
+
* All methods are optional.
|
|
15
|
+
* Built-in implementations:
|
|
16
|
+
* - `classNameThemeStore`
|
|
17
|
+
* - `cookieThemeStore`
|
|
18
|
+
* - `dataAttributeThemeStore`
|
|
19
|
+
* - `inMemoryThemeStore`
|
|
20
|
+
* - `localStorageThemeStore`
|
|
21
|
+
* - `prefersColorSchemeThemeStore`
|
|
22
|
+
* - `sessionStorageThemeStore`
|
|
23
|
+
*
|
|
24
|
+
* @typeParam Themes - Map of theme keys to their value types (string or readonly string[])
|
|
25
|
+
*/
|
|
26
|
+
interface ThemeStore<Themes extends ThemeMap = ThemeMap> {
|
|
27
|
+
read?: (() => ThemeEntry<Themes> | undefined) | undefined;
|
|
28
|
+
write?: ((entry: ThemeEntry<Themes> | undefined) => void) | undefined;
|
|
29
|
+
subscribe?: ((handler: (theme: ThemeEntry<Themes> | undefined | null) => void) => () => void) | undefined;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { ThemeStore };
|
|
33
|
+
//# sourceMappingURL=theme-store.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-store.types.d.mts","names":[],"sources":["../../../src/theme/theme-store/theme-store.types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAuBA;;;;;;;;;;;;;;;;;;UAAiB,0BAA0B,WAAW;gBACvC,WAAW;mBACR,WAAW;iCAEN,WAAW"}
|
package/dist/theme.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const require_theme_entry = require('./theme/theme-entry.cjs');
|
|
2
|
+
const require_class_name_theme_store = require('./theme/theme-store/class-name-theme-store/class-name-theme-store.cjs');
|
|
3
|
+
const require_data_attribute_theme_store = require('./theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.cjs');
|
|
4
|
+
const require_local_storage_theme_store = require('./theme/theme-store/local-storage-theme-store/local-storage-theme-store.cjs');
|
|
5
|
+
const require_compose_theme_stores = require('./theme/compose-theme-stores.cjs');
|
|
6
|
+
const require_cookie_theme_store = require('./theme/theme-store/cookie-theme-store/cookie-theme-store.cjs');
|
|
7
|
+
const require_in_memory_theme_store = require('./theme/theme-store/in-memory-theme-store/in-memory-theme-store.cjs');
|
|
8
|
+
const require_prefers_color_scheme_theme_store = require('./theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.cjs');
|
|
9
|
+
const require_session_storage_theme_store = require('./theme/theme-store/session-storage-theme-store/session-storage-theme-store.cjs');
|
|
10
|
+
|
|
11
|
+
exports.classNameThemeStore = require_class_name_theme_store.classNameThemeStore;
|
|
12
|
+
exports.composeThemeStores = require_compose_theme_stores.composeThemeStores;
|
|
13
|
+
exports.cookieThemeStore = require_cookie_theme_store.cookieThemeStore;
|
|
14
|
+
exports.dataAttributeThemeStore = require_data_attribute_theme_store.dataAttributeThemeStore;
|
|
15
|
+
exports.getThemeFromCookie = require_cookie_theme_store.getThemeFromCookie;
|
|
16
|
+
exports.inMemoryThemeStore = require_in_memory_theme_store.inMemoryThemeStore;
|
|
17
|
+
exports.localStorageThemeStore = require_local_storage_theme_store.localStorageThemeStore;
|
|
18
|
+
exports.prefersColorSchemeThemeStore = require_prefers_color_scheme_theme_store.prefersColorSchemeThemeStore;
|
|
19
|
+
exports.sessionStorageThemeStore = require_session_storage_theme_store.sessionStorageThemeStore;
|
|
20
|
+
exports.themeEntry = require_theme_entry.themeEntry;
|
package/dist/theme.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ThemeMap } from "./theme/theme-map.types.cjs";
|
|
2
|
+
import { ThemeEntry } from "./theme/theme-entry.types.cjs";
|
|
3
|
+
import { AsyncThemeStore } from "./theme/theme-store/async-theme-store.types.cjs";
|
|
4
|
+
import { ThemeStore } from "./theme/theme-store/theme-store.types.cjs";
|
|
5
|
+
import { ThemeStoreFactory } from "./theme/theme-store/theme-store-factory.types.cjs";
|
|
6
|
+
import { ComposeThemeStoreEntry, ComposeThemeStoresOptions, composeThemeStores } from "./theme/compose-theme-stores.cjs";
|
|
7
|
+
import { themeEntry } from "./theme/theme-entry.cjs";
|
|
8
|
+
import { classNameThemeStore } from "./theme/theme-store/class-name-theme-store/class-name-theme-store.cjs";
|
|
9
|
+
import { CookieThemeStoreOptions, cookieThemeStore, getThemeFromCookie } from "./theme/theme-store/cookie-theme-store/cookie-theme-store.cjs";
|
|
10
|
+
import { dataAttributeThemeStore } from "./theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.cjs";
|
|
11
|
+
import { inMemoryThemeStore } from "./theme/theme-store/in-memory-theme-store/in-memory-theme-store.cjs";
|
|
12
|
+
import { localStorageThemeStore } from "./theme/theme-store/local-storage-theme-store/local-storage-theme-store.cjs";
|
|
13
|
+
import { prefersColorSchemeThemeStore } from "./theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.cjs";
|
|
14
|
+
import { sessionStorageThemeStore } from "./theme/theme-store/session-storage-theme-store/session-storage-theme-store.cjs";
|
|
15
|
+
export { AsyncThemeStore, ComposeThemeStoreEntry, ComposeThemeStoresOptions, CookieThemeStoreOptions, ThemeEntry, ThemeMap, ThemeStore, ThemeStoreFactory, classNameThemeStore, composeThemeStores, cookieThemeStore, dataAttributeThemeStore, getThemeFromCookie, inMemoryThemeStore, localStorageThemeStore, prefersColorSchemeThemeStore, sessionStorageThemeStore, themeEntry };
|
package/dist/theme.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ThemeMap } from "./theme/theme-map.types.mjs";
|
|
2
|
+
import { ThemeEntry } from "./theme/theme-entry.types.mjs";
|
|
3
|
+
import { AsyncThemeStore } from "./theme/theme-store/async-theme-store.types.mjs";
|
|
4
|
+
import { ThemeStore } from "./theme/theme-store/theme-store.types.mjs";
|
|
5
|
+
import { ThemeStoreFactory } from "./theme/theme-store/theme-store-factory.types.mjs";
|
|
6
|
+
import { ComposeThemeStoreEntry, ComposeThemeStoresOptions, composeThemeStores } from "./theme/compose-theme-stores.mjs";
|
|
7
|
+
import { themeEntry } from "./theme/theme-entry.mjs";
|
|
8
|
+
import { classNameThemeStore } from "./theme/theme-store/class-name-theme-store/class-name-theme-store.mjs";
|
|
9
|
+
import { CookieThemeStoreOptions, cookieThemeStore, getThemeFromCookie } from "./theme/theme-store/cookie-theme-store/cookie-theme-store.mjs";
|
|
10
|
+
import { dataAttributeThemeStore } from "./theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.mjs";
|
|
11
|
+
import { inMemoryThemeStore } from "./theme/theme-store/in-memory-theme-store/in-memory-theme-store.mjs";
|
|
12
|
+
import { localStorageThemeStore } from "./theme/theme-store/local-storage-theme-store/local-storage-theme-store.mjs";
|
|
13
|
+
import { prefersColorSchemeThemeStore } from "./theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.mjs";
|
|
14
|
+
import { sessionStorageThemeStore } from "./theme/theme-store/session-storage-theme-store/session-storage-theme-store.mjs";
|
|
15
|
+
export { AsyncThemeStore, ComposeThemeStoreEntry, ComposeThemeStoresOptions, CookieThemeStoreOptions, ThemeEntry, ThemeMap, ThemeStore, ThemeStoreFactory, classNameThemeStore, composeThemeStores, cookieThemeStore, dataAttributeThemeStore, getThemeFromCookie, inMemoryThemeStore, localStorageThemeStore, prefersColorSchemeThemeStore, sessionStorageThemeStore, themeEntry };
|
package/dist/theme.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { themeEntry } from "./theme/theme-entry.mjs";
|
|
2
|
+
import { classNameThemeStore } from "./theme/theme-store/class-name-theme-store/class-name-theme-store.mjs";
|
|
3
|
+
import { dataAttributeThemeStore } from "./theme/theme-store/data-attribute-theme-store/data-attribute-theme-store.mjs";
|
|
4
|
+
import { localStorageThemeStore } from "./theme/theme-store/local-storage-theme-store/local-storage-theme-store.mjs";
|
|
5
|
+
import { composeThemeStores } from "./theme/compose-theme-stores.mjs";
|
|
6
|
+
import { cookieThemeStore, getThemeFromCookie } from "./theme/theme-store/cookie-theme-store/cookie-theme-store.mjs";
|
|
7
|
+
import { inMemoryThemeStore } from "./theme/theme-store/in-memory-theme-store/in-memory-theme-store.mjs";
|
|
8
|
+
import { prefersColorSchemeThemeStore } from "./theme/theme-store/prefers-color-scheme-theme-store/prefers-color-scheme-theme-store.mjs";
|
|
9
|
+
import { sessionStorageThemeStore } from "./theme/theme-store/session-storage-theme-store/session-storage-theme-store.mjs";
|
|
10
|
+
|
|
11
|
+
export { classNameThemeStore, composeThemeStores, cookieThemeStore, dataAttributeThemeStore, getThemeFromCookie, inMemoryThemeStore, localStorageThemeStore, prefersColorSchemeThemeStore, sessionStorageThemeStore, themeEntry };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/units/get-rem-to-px-scale.ts
|
|
3
|
+
const DEFAULT_REM_TO_PX_SCALE = 16;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the current document's rem-to-px scale (the pixel value of 1rem).
|
|
6
|
+
*
|
|
7
|
+
* Reads the computed font size of the root element (`html`), which is the value
|
|
8
|
+
* the browser uses to resolve rem units. In non-browser environments (e.g. SSR,
|
|
9
|
+
* Node), returns {@link DEFAULT_REM_TO_PX_SCALE} as a fallback.
|
|
10
|
+
*
|
|
11
|
+
* @returns The number of pixels that 1rem equals in the current document,
|
|
12
|
+
* or {@link DEFAULT_REM_TO_PX_SCALE} when not in a browser.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* getRemToPxScale() // e.g. 16 (or 20 if user increased default font size)
|
|
17
|
+
* rem2px(1, { base: getRemToPxScale() }) // matches actual 1rem in the document
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function getRemToPxScale() {
|
|
21
|
+
/* c8 ignore start */
|
|
22
|
+
if (typeof document === "undefined" || !document.documentElement) return DEFAULT_REM_TO_PX_SCALE;
|
|
23
|
+
/* c8 ignore end */
|
|
24
|
+
const rootFontSize = getComputedStyle(document.documentElement).fontSize;
|
|
25
|
+
return Number.parseFloat(rootFontSize) ?? DEFAULT_REM_TO_PX_SCALE;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.getRemToPxScale = getRemToPxScale;
|
|
30
|
+
//# sourceMappingURL=get-rem-to-px-scale.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-rem-to-px-scale.cjs","names":[],"sources":["../../src/units/get-rem-to-px-scale.ts"],"sourcesContent":["const DEFAULT_REM_TO_PX_SCALE = 16\n\n/**\n * Returns the current document's rem-to-px scale (the pixel value of 1rem).\n *\n * Reads the computed font size of the root element (`html`), which is the value\n * the browser uses to resolve rem units. In non-browser environments (e.g. SSR,\n * Node), returns {@link DEFAULT_REM_TO_PX_SCALE} as a fallback.\n *\n * @returns The number of pixels that 1rem equals in the current document,\n * or {@link DEFAULT_REM_TO_PX_SCALE} when not in a browser.\n *\n * @example\n * ```ts\n * getRemToPxScale() // e.g. 16 (or 20 if user increased default font size)\n * rem2px(1, { base: getRemToPxScale() }) // matches actual 1rem in the document\n * ```\n */\nexport function getRemToPxScale(): number {\n\t/* c8 ignore start */\n\tif (typeof document === 'undefined' || !document.documentElement) {\n\t\treturn DEFAULT_REM_TO_PX_SCALE\n\t}\n\t/* c8 ignore end */\n\tconst rootFontSize = getComputedStyle(document.documentElement).fontSize\n\treturn Number.parseFloat(rootFontSize) ?? DEFAULT_REM_TO_PX_SCALE\n}\n"],"mappings":";;AAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;AAkBhC,SAAgB,kBAA0B;;AAEzC,KAAI,OAAO,aAAa,eAAe,CAAC,SAAS,gBAChD,QAAO;;CAGR,MAAM,eAAe,iBAAiB,SAAS,gBAAgB,CAAC;AAChE,QAAO,OAAO,WAAW,aAAa,IAAI"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/units/get-rem-to-px-scale.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current document's rem-to-px scale (the pixel value of 1rem).
|
|
4
|
+
*
|
|
5
|
+
* Reads the computed font size of the root element (`html`), which is the value
|
|
6
|
+
* the browser uses to resolve rem units. In non-browser environments (e.g. SSR,
|
|
7
|
+
* Node), returns {@link DEFAULT_REM_TO_PX_SCALE} as a fallback.
|
|
8
|
+
*
|
|
9
|
+
* @returns The number of pixels that 1rem equals in the current document,
|
|
10
|
+
* or {@link DEFAULT_REM_TO_PX_SCALE} when not in a browser.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* getRemToPxScale() // e.g. 16 (or 20 if user increased default font size)
|
|
15
|
+
* rem2px(1, { base: getRemToPxScale() }) // matches actual 1rem in the document
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function getRemToPxScale(): number;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getRemToPxScale };
|
|
21
|
+
//# sourceMappingURL=get-rem-to-px-scale.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-rem-to-px-scale.d.cts","names":[],"sources":["../../src/units/get-rem-to-px-scale.ts"],"sourcesContent":[],"mappings":";;AAkBA;;;;;;;;;;;;;;;iBAAgB,eAAA,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/units/get-rem-to-px-scale.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current document's rem-to-px scale (the pixel value of 1rem).
|
|
4
|
+
*
|
|
5
|
+
* Reads the computed font size of the root element (`html`), which is the value
|
|
6
|
+
* the browser uses to resolve rem units. In non-browser environments (e.g. SSR,
|
|
7
|
+
* Node), returns {@link DEFAULT_REM_TO_PX_SCALE} as a fallback.
|
|
8
|
+
*
|
|
9
|
+
* @returns The number of pixels that 1rem equals in the current document,
|
|
10
|
+
* or {@link DEFAULT_REM_TO_PX_SCALE} when not in a browser.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* getRemToPxScale() // e.g. 16 (or 20 if user increased default font size)
|
|
15
|
+
* rem2px(1, { base: getRemToPxScale() }) // matches actual 1rem in the document
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function getRemToPxScale(): number;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getRemToPxScale };
|
|
21
|
+
//# sourceMappingURL=get-rem-to-px-scale.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-rem-to-px-scale.d.mts","names":[],"sources":["../../src/units/get-rem-to-px-scale.ts"],"sourcesContent":[],"mappings":";;AAkBA;;;;;;;;;;;;;;;iBAAgB,eAAA,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/units/get-rem-to-px-scale.ts
|
|
2
|
+
const DEFAULT_REM_TO_PX_SCALE = 16;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the current document's rem-to-px scale (the pixel value of 1rem).
|
|
5
|
+
*
|
|
6
|
+
* Reads the computed font size of the root element (`html`), which is the value
|
|
7
|
+
* the browser uses to resolve rem units. In non-browser environments (e.g. SSR,
|
|
8
|
+
* Node), returns {@link DEFAULT_REM_TO_PX_SCALE} as a fallback.
|
|
9
|
+
*
|
|
10
|
+
* @returns The number of pixels that 1rem equals in the current document,
|
|
11
|
+
* or {@link DEFAULT_REM_TO_PX_SCALE} when not in a browser.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* getRemToPxScale() // e.g. 16 (or 20 if user increased default font size)
|
|
16
|
+
* rem2px(1, { base: getRemToPxScale() }) // matches actual 1rem in the document
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function getRemToPxScale() {
|
|
20
|
+
/* c8 ignore start */
|
|
21
|
+
if (typeof document === "undefined" || !document.documentElement) return DEFAULT_REM_TO_PX_SCALE;
|
|
22
|
+
/* c8 ignore end */
|
|
23
|
+
const rootFontSize = getComputedStyle(document.documentElement).fontSize;
|
|
24
|
+
return Number.parseFloat(rootFontSize) ?? DEFAULT_REM_TO_PX_SCALE;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { getRemToPxScale };
|
|
29
|
+
//# sourceMappingURL=get-rem-to-px-scale.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-rem-to-px-scale.mjs","names":[],"sources":["../../src/units/get-rem-to-px-scale.ts"],"sourcesContent":["const DEFAULT_REM_TO_PX_SCALE = 16\n\n/**\n * Returns the current document's rem-to-px scale (the pixel value of 1rem).\n *\n * Reads the computed font size of the root element (`html`), which is the value\n * the browser uses to resolve rem units. In non-browser environments (e.g. SSR,\n * Node), returns {@link DEFAULT_REM_TO_PX_SCALE} as a fallback.\n *\n * @returns The number of pixels that 1rem equals in the current document,\n * or {@link DEFAULT_REM_TO_PX_SCALE} when not in a browser.\n *\n * @example\n * ```ts\n * getRemToPxScale() // e.g. 16 (or 20 if user increased default font size)\n * rem2px(1, { base: getRemToPxScale() }) // matches actual 1rem in the document\n * ```\n */\nexport function getRemToPxScale(): number {\n\t/* c8 ignore start */\n\tif (typeof document === 'undefined' || !document.documentElement) {\n\t\treturn DEFAULT_REM_TO_PX_SCALE\n\t}\n\t/* c8 ignore end */\n\tconst rootFontSize = getComputedStyle(document.documentElement).fontSize\n\treturn Number.parseFloat(rootFontSize) ?? DEFAULT_REM_TO_PX_SCALE\n}\n"],"mappings":";AAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;AAkBhC,SAAgB,kBAA0B;;AAEzC,KAAI,OAAO,aAAa,eAAe,CAAC,SAAS,gBAChD,QAAO;;CAGR,MAAM,eAAe,iBAAiB,SAAS,gBAAgB,CAAC;AAChE,QAAO,OAAO,WAAW,aAAa,IAAI"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/units/px-2-num.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts pixel values to numbers.
|
|
5
|
+
*
|
|
6
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
7
|
+
* @returns The numeric value
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* px2num(16) // 16
|
|
12
|
+
* px2num('32px') // 32
|
|
13
|
+
* px2num('12.5px') // 12.5
|
|
14
|
+
* px2num('0px') // 0
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function px2num(px) {
|
|
18
|
+
return typeof px === "string" ? Number.parseFloat(px.replace(/px$/, "")) : Number(px);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.px2num = px2num;
|
|
23
|
+
//# sourceMappingURL=px-2-num.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-num.cjs","names":[],"sources":["../../src/units/px-2-num.ts"],"sourcesContent":["/**\n * Converts pixel values to numbers.\n *\n * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')\n * @returns The numeric value\n *\n * @example\n * ```ts\n * px2num(16) // 16\n * px2num('32px') // 32\n * px2num('12.5px') // 12.5\n * px2num('0px') // 0\n * ```\n */\nexport function px2num(px: number | string | undefined): number {\n\treturn typeof px === 'string' ? Number.parseFloat(px.replace(/px$/, '')) : Number(px)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,SAAgB,OAAO,IAAyC;AAC/D,QAAO,OAAO,OAAO,WAAW,OAAO,WAAW,GAAG,QAAQ,OAAO,GAAG,CAAC,GAAG,OAAO,GAAG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/units/px-2-num.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts pixel values to numbers.
|
|
4
|
+
*
|
|
5
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
6
|
+
* @returns The numeric value
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* px2num(16) // 16
|
|
11
|
+
* px2num('32px') // 32
|
|
12
|
+
* px2num('12.5px') // 12.5
|
|
13
|
+
* px2num('0px') // 0
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare function px2num(px: number | string | undefined): number;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { px2num };
|
|
19
|
+
//# sourceMappingURL=px-2-num.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-num.d.cts","names":[],"sources":["../../src/units/px-2-num.ts"],"sourcesContent":[],"mappings":";;AAcA;;;;;;;;;;;;;iBAAgB,MAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/units/px-2-num.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts pixel values to numbers.
|
|
4
|
+
*
|
|
5
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
6
|
+
* @returns The numeric value
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* px2num(16) // 16
|
|
11
|
+
* px2num('32px') // 32
|
|
12
|
+
* px2num('12.5px') // 12.5
|
|
13
|
+
* px2num('0px') // 0
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare function px2num(px: number | string | undefined): number;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { px2num };
|
|
19
|
+
//# sourceMappingURL=px-2-num.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-num.d.mts","names":[],"sources":["../../src/units/px-2-num.ts"],"sourcesContent":[],"mappings":";;AAcA;;;;;;;;;;;;;iBAAgB,MAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/units/px-2-num.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts pixel values to numbers.
|
|
4
|
+
*
|
|
5
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
6
|
+
* @returns The numeric value
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* px2num(16) // 16
|
|
11
|
+
* px2num('32px') // 32
|
|
12
|
+
* px2num('12.5px') // 12.5
|
|
13
|
+
* px2num('0px') // 0
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function px2num(px) {
|
|
17
|
+
return typeof px === "string" ? Number.parseFloat(px.replace(/px$/, "")) : Number(px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { px2num };
|
|
22
|
+
//# sourceMappingURL=px-2-num.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-num.mjs","names":[],"sources":["../../src/units/px-2-num.ts"],"sourcesContent":["/**\n * Converts pixel values to numbers.\n *\n * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')\n * @returns The numeric value\n *\n * @example\n * ```ts\n * px2num(16) // 16\n * px2num('32px') // 32\n * px2num('12.5px') // 12.5\n * px2num('0px') // 0\n * ```\n */\nexport function px2num(px: number | string | undefined): number {\n\treturn typeof px === 'string' ? Number.parseFloat(px.replace(/px$/, '')) : Number(px)\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,OAAO,IAAyC;AAC/D,QAAO,OAAO,OAAO,WAAW,OAAO,WAAW,GAAG,QAAQ,OAAO,GAAG,CAAC,GAAG,OAAO,GAAG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/units/px-2-rem.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts pixel values to rem units.
|
|
5
|
+
*
|
|
6
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
7
|
+
* @param options - Optional configuration
|
|
8
|
+
* @param options.base - Base pixel value to calculate rem units from. Defaults to 16
|
|
9
|
+
* @param options.precision - Number of decimal places in the output. Defaults to 4
|
|
10
|
+
* @returns The converted value as a string with 'rem' units
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* px2rem(16) // '1.0000'
|
|
15
|
+
* px2rem('32px') // '2.0000'
|
|
16
|
+
* px2rem(20, { base: 20 }) // '1.0000'
|
|
17
|
+
* px2rem(13, { precision: 2 }) // '0.81'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function px2rem(px, options) {
|
|
21
|
+
const { base = 16, precision = 4 } = options ?? {};
|
|
22
|
+
if (typeof px === "string") {
|
|
23
|
+
px = px.replace(/px$/, "");
|
|
24
|
+
px = Number.parseFloat(px);
|
|
25
|
+
}
|
|
26
|
+
return Number((px / base).toFixed(precision));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.px2rem = px2rem;
|
|
31
|
+
//# sourceMappingURL=px-2-rem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-rem.cjs","names":[],"sources":["../../src/units/px-2-rem.ts"],"sourcesContent":["/**\n * Converts pixel values to rem units.\n *\n * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')\n * @param options - Optional configuration\n * @param options.base - Base pixel value to calculate rem units from. Defaults to 16\n * @param options.precision - Number of decimal places in the output. Defaults to 4\n * @returns The converted value as a string with 'rem' units\n *\n * @example\n * ```ts\n * px2rem(16) // '1.0000'\n * px2rem('32px') // '2.0000'\n * px2rem(20, { base: 20 }) // '1.0000'\n * px2rem(13, { precision: 2 }) // '0.81'\n * ```\n */\nexport function px2rem(\n\tpx: number | string,\n\toptions?: { base?: number | undefined; precision?: number | undefined }\n): number {\n\tconst { base = 16, precision = 4 } = options ?? {}\n\n\tif (typeof px === 'string') {\n\t\tpx = px.replace(/px$/, '')\n\t\tpx = Number.parseFloat(px)\n\t}\n\n\treturn Number((px / base).toFixed(precision))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,SAAgB,OACf,IACA,SACS;CACT,MAAM,EAAE,OAAO,IAAI,YAAY,MAAM,WAAW,EAAE;AAElD,KAAI,OAAO,OAAO,UAAU;AAC3B,OAAK,GAAG,QAAQ,OAAO,GAAG;AAC1B,OAAK,OAAO,WAAW,GAAG;;AAG3B,QAAO,QAAQ,KAAK,MAAM,QAAQ,UAAU,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/units/px-2-rem.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts pixel values to rem units.
|
|
4
|
+
*
|
|
5
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
6
|
+
* @param options - Optional configuration
|
|
7
|
+
* @param options.base - Base pixel value to calculate rem units from. Defaults to 16
|
|
8
|
+
* @param options.precision - Number of decimal places in the output. Defaults to 4
|
|
9
|
+
* @returns The converted value as a string with 'rem' units
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* px2rem(16) // '1.0000'
|
|
14
|
+
* px2rem('32px') // '2.0000'
|
|
15
|
+
* px2rem(20, { base: 20 }) // '1.0000'
|
|
16
|
+
* px2rem(13, { precision: 2 }) // '0.81'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare function px2rem(px: number | string, options?: {
|
|
20
|
+
base?: number | undefined;
|
|
21
|
+
precision?: number | undefined;
|
|
22
|
+
}): number;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { px2rem };
|
|
25
|
+
//# sourceMappingURL=px-2-rem.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-rem.d.cts","names":[],"sources":["../../src/units/px-2-rem.ts"],"sourcesContent":[],"mappings":";;AAiBA;;;;;;;;;;;;;;;;iBAAgB,MAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/units/px-2-rem.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts pixel values to rem units.
|
|
4
|
+
*
|
|
5
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
6
|
+
* @param options - Optional configuration
|
|
7
|
+
* @param options.base - Base pixel value to calculate rem units from. Defaults to 16
|
|
8
|
+
* @param options.precision - Number of decimal places in the output. Defaults to 4
|
|
9
|
+
* @returns The converted value as a string with 'rem' units
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* px2rem(16) // '1.0000'
|
|
14
|
+
* px2rem('32px') // '2.0000'
|
|
15
|
+
* px2rem(20, { base: 20 }) // '1.0000'
|
|
16
|
+
* px2rem(13, { precision: 2 }) // '0.81'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare function px2rem(px: number | string, options?: {
|
|
20
|
+
base?: number | undefined;
|
|
21
|
+
precision?: number | undefined;
|
|
22
|
+
}): number;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { px2rem };
|
|
25
|
+
//# sourceMappingURL=px-2-rem.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-rem.d.mts","names":[],"sources":["../../src/units/px-2-rem.ts"],"sourcesContent":[],"mappings":";;AAiBA;;;;;;;;;;;;;;;;iBAAgB,MAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/units/px-2-rem.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts pixel values to rem units.
|
|
4
|
+
*
|
|
5
|
+
* @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
|
|
6
|
+
* @param options - Optional configuration
|
|
7
|
+
* @param options.base - Base pixel value to calculate rem units from. Defaults to 16
|
|
8
|
+
* @param options.precision - Number of decimal places in the output. Defaults to 4
|
|
9
|
+
* @returns The converted value as a string with 'rem' units
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* px2rem(16) // '1.0000'
|
|
14
|
+
* px2rem('32px') // '2.0000'
|
|
15
|
+
* px2rem(20, { base: 20 }) // '1.0000'
|
|
16
|
+
* px2rem(13, { precision: 2 }) // '0.81'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function px2rem(px, options) {
|
|
20
|
+
const { base = 16, precision = 4 } = options ?? {};
|
|
21
|
+
if (typeof px === "string") {
|
|
22
|
+
px = px.replace(/px$/, "");
|
|
23
|
+
px = Number.parseFloat(px);
|
|
24
|
+
}
|
|
25
|
+
return Number((px / base).toFixed(precision));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { px2rem };
|
|
30
|
+
//# sourceMappingURL=px-2-rem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px-2-rem.mjs","names":[],"sources":["../../src/units/px-2-rem.ts"],"sourcesContent":["/**\n * Converts pixel values to rem units.\n *\n * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')\n * @param options - Optional configuration\n * @param options.base - Base pixel value to calculate rem units from. Defaults to 16\n * @param options.precision - Number of decimal places in the output. Defaults to 4\n * @returns The converted value as a string with 'rem' units\n *\n * @example\n * ```ts\n * px2rem(16) // '1.0000'\n * px2rem('32px') // '2.0000'\n * px2rem(20, { base: 20 }) // '1.0000'\n * px2rem(13, { precision: 2 }) // '0.81'\n * ```\n */\nexport function px2rem(\n\tpx: number | string,\n\toptions?: { base?: number | undefined; precision?: number | undefined }\n): number {\n\tconst { base = 16, precision = 4 } = options ?? {}\n\n\tif (typeof px === 'string') {\n\t\tpx = px.replace(/px$/, '')\n\t\tpx = Number.parseFloat(px)\n\t}\n\n\treturn Number((px / base).toFixed(precision))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAgB,OACf,IACA,SACS;CACT,MAAM,EAAE,OAAO,IAAI,YAAY,MAAM,WAAW,EAAE;AAElD,KAAI,OAAO,OAAO,UAAU;AAC3B,OAAK,GAAG,QAAQ,OAAO,GAAG;AAC1B,OAAK,OAAO,WAAW,GAAG;;AAG3B,QAAO,QAAQ,KAAK,MAAM,QAAQ,UAAU,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/units/rem-2-px.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts rem values to pixel units.
|
|
5
|
+
*
|
|
6
|
+
* @param rem - The rem value to convert. Can be a number or string (e.g. '1rem' or '1')
|
|
7
|
+
* @param options - Optional configuration
|
|
8
|
+
* @param options.base - Base pixel value to calculate pixels from. Defaults to 16
|
|
9
|
+
* @param options.precision - Number of decimal places in the output. Defaults to 4
|
|
10
|
+
* @returns The converted value as a string with 'px' units
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* rem2px(1) // '16.0000'
|
|
15
|
+
* rem2px('2rem') // '32.0000'
|
|
16
|
+
* rem2px(1, { base: 20 }) // '20.0000'
|
|
17
|
+
* rem2px(0.8125, { precision: 2 }) // '13.00'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function rem2px(rem, options) {
|
|
21
|
+
const { base = 16, precision = 4 } = options ?? {};
|
|
22
|
+
if (typeof rem === "string") {
|
|
23
|
+
rem = rem.replace(/rem$/, "");
|
|
24
|
+
rem = Number.parseFloat(rem);
|
|
25
|
+
}
|
|
26
|
+
return Number((rem * base).toFixed(precision));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.rem2px = rem2px;
|
|
31
|
+
//# sourceMappingURL=rem-2-px.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rem-2-px.cjs","names":[],"sources":["../../src/units/rem-2-px.ts"],"sourcesContent":["/**\n * Converts rem values to pixel units.\n *\n * @param rem - The rem value to convert. Can be a number or string (e.g. '1rem' or '1')\n * @param options - Optional configuration\n * @param options.base - Base pixel value to calculate pixels from. Defaults to 16\n * @param options.precision - Number of decimal places in the output. Defaults to 4\n * @returns The converted value as a string with 'px' units\n *\n * @example\n * ```ts\n * rem2px(1) // '16.0000'\n * rem2px('2rem') // '32.0000'\n * rem2px(1, { base: 20 }) // '20.0000'\n * rem2px(0.8125, { precision: 2 }) // '13.00'\n * ```\n */\nexport function rem2px(\n\trem: number | string,\n\toptions?: { base?: number | undefined; precision?: number | undefined }\n): number {\n\tconst { base = 16, precision = 4 } = options ?? {}\n\n\tif (typeof rem === 'string') {\n\t\trem = rem.replace(/rem$/, '')\n\t\trem = Number.parseFloat(rem)\n\t}\n\n\treturn Number((rem * base).toFixed(precision))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,SAAgB,OACf,KACA,SACS;CACT,MAAM,EAAE,OAAO,IAAI,YAAY,MAAM,WAAW,EAAE;AAElD,KAAI,OAAO,QAAQ,UAAU;AAC5B,QAAM,IAAI,QAAQ,QAAQ,GAAG;AAC7B,QAAM,OAAO,WAAW,IAAI;;AAG7B,QAAO,QAAQ,MAAM,MAAM,QAAQ,UAAU,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/units/rem-2-px.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts rem values to pixel units.
|
|
4
|
+
*
|
|
5
|
+
* @param rem - The rem value to convert. Can be a number or string (e.g. '1rem' or '1')
|
|
6
|
+
* @param options - Optional configuration
|
|
7
|
+
* @param options.base - Base pixel value to calculate pixels from. Defaults to 16
|
|
8
|
+
* @param options.precision - Number of decimal places in the output. Defaults to 4
|
|
9
|
+
* @returns The converted value as a string with 'px' units
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* rem2px(1) // '16.0000'
|
|
14
|
+
* rem2px('2rem') // '32.0000'
|
|
15
|
+
* rem2px(1, { base: 20 }) // '20.0000'
|
|
16
|
+
* rem2px(0.8125, { precision: 2 }) // '13.00'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare function rem2px(rem: number | string, options?: {
|
|
20
|
+
base?: number | undefined;
|
|
21
|
+
precision?: number | undefined;
|
|
22
|
+
}): number;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { rem2px };
|
|
25
|
+
//# sourceMappingURL=rem-2-px.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rem-2-px.d.cts","names":[],"sources":["../../src/units/rem-2-px.ts"],"sourcesContent":[],"mappings":";;AAiBA;;;;;;;;;;;;;;;;iBAAgB,MAAA"}
|