Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale support cleanup #202

Merged
merged 5 commits into from
Jan 9, 2024
Merged

Locale support cleanup #202

merged 5 commits into from
Jan 9, 2024

Conversation

dimfeld
Copy link
Contributor

@dimfeld dimfeld commented Jan 9, 2024

No description provided.

Copy link

changeset-bot bot commented Jan 9, 2024

🦋 Changeset detected

Latest commit: fdeb597

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte-ux Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-ux ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2024 6:28pm

---

- Add locale settings to settings object, and allow dynamically changing the current locale.
- Move format function to be a store on the settings object, which updates when the locale changes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Covers this one and the previous PR, for which I forgot to add a changeset

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I was making sure I hadn't overlooked or misunderstood something. We still have format() as a non-store function as well, which I'd like to keep that way for the time being.

Copy link
Owner

@techniq techniq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@techniq techniq merged commit fa009e0 into techniq:next Jan 9, 2024
4 checks passed
@dimfeld dimfeld deleted the format-functions-2 branch January 9, 2024 20:13
techniq pushed a commit that referenced this pull request Jan 11, 2024
* fix circular reference

* remove knownLocales

* fix date tests

* add locale exports, hide exports of a few internal-only functions

* changeset
techniq pushed a commit that referenced this pull request Jan 11, 2024
* fix circular reference

* remove knownLocales

* fix date tests

* add locale exports, hide exports of a few internal-only functions

* changeset
techniq pushed a commit that referenced this pull request Jan 31, 2024
* fix circular reference

* remove knownLocales

* fix date tests

* add locale exports, hide exports of a few internal-only functions

* changeset
techniq pushed a commit that referenced this pull request Feb 6, 2024
* fix circular reference

* remove knownLocales

* fix date tests

* add locale exports, hide exports of a few internal-only functions

* changeset
techniq pushed a commit that referenced this pull request Feb 6, 2024
* fix circular reference

* remove knownLocales

* fix date tests

* add locale exports, hide exports of a few internal-only functions

* changeset
techniq pushed a commit that referenced this pull request Feb 6, 2024
* fix circular reference

* remove knownLocales

* fix date tests

* add locale exports, hide exports of a few internal-only functions

* changeset
techniq added a commit that referenced this pull request Feb 12, 2024
* Link npm downloads badge to npm package page

* 🕰️ NEW: formatDate (#137)

* re init my mess dates

* update for consistency

* moving format to intl

* tests with also fr local

* dico

* dateDisplay update

* Humm

* tmp rename to format_fns

* realignement & doc update

* add a playground

* Month & monthYear

* DateField

* Date Range

* Month done

* rmv all usage of dateDisplay

* Nice nice nice

* casing

* enums casing

* oups, need to comment fr for now in the doc

* formats

* okay with date of week

* update docs

* add changeset

* rmv dateDisplay

* cleanup

* dico

* keep Day default

* rmv useless

* Okay, adding DayTime & TimeOnly

* of course, updating doc is always good :)

* Swtich default to use Tokens enum

* Design tokens / Theme support (with dark mode) (#146)

* Squash all theme changes into single commit

* Add changeset

* Enter prerelease mode and version packages

* Add Kbd component.  Show keyboard shortcuts on ThemeButton menu

* Read themes/colors from tailwind config, including Daisy UI (with mapping).  Supports generating optional colors and further extension and flexability.

* Process daisy themes to generate lightThemes/darkThemes based on color-scheme value

* Add changeset

* Version bump to 0.58.0-next.1

* Add styles (with daisy) as top-level export

* Version bump to 0.58.0-next.2

* Add commonjs and esm versions of daisy module

* Version bump to 0.58.0-next.3

* Remove daisy from top-level exports

* Version bump to 0.58.0-next.4

* Rename `error` / `error-content` to `danger` / `danger-content`

* Fix pnpm-lock.yaml using `pnpm install` (ERR_PNPM_ERR_PNPM_UNEXPECTED_PKG_CONTENT_IN_STORE  The lockfile is broken! Resolution step will be performed to fix it.)

* Add `accent` and `neutral` theme colors

* Cleanup

* Update some leftover `error` => `danger` color references

* Extra tailwind plugin into multiple files for better readability

* Use darker "-content" color for default `fill` variant (distinguish from `fill-light`)

* Simplify naming and impl. of foregroundColor() and add lightenColor() (to match darkenColor())

* Register 100-900 shades for all semantic and state colors.  Replace color-mix() usage (including Tailwind *-mix-* utils) with new shades

* Use lib/styles/themes for types as well

* Replace SvelteComponentTyped with SvelteComponent

* Version bump to 0.58.0-next.5

* Cleanup

* Remove unused css files

* Simplify

* Support changing colorSpace (rgb, hsl, or oklch)

* Improve theme page preview and add menu item

* Improve default border color

* Fix handling of hsl() color space by clamping to RGB values (to not exceed 100% saturation or lightness).  Matches rgb() color

* Version bump to 0.58.0-next.6

* Use same surface-content/20% outline color as border color

* Remove explicit border colors that match default (border-surface-content/20) and replace some border-surface-### with default (surface-content/20)

* Version bump to 0.58.0-next.7

* Change "theme" to "classes" in Settings (#172)

* Rename settings `theme` to `classes` in preparation for adding theme support

* Rename getComponentTheme to getComponentClasses

* Add svelte settings to .prettierrc (#173)

* Theme store (#174)

* Move theme management to a store that lives in the context

* changeset

* Use cross-framework-compatible browser value

* handle post-load changes in prefers-color-scheme

* better browser stub-out

* Move culori to be a regular dependency so that all package managers will install it (#175)

* add ThemeInit component that place script inside <head> tag (#176)

* add ThemeInit component that place script inside <head> tag

* Fix bug

* proper sorting

* instantiate ThemeInit inside Settings component

* add comment about stringified function

* Version bump to 0.58.0-next.8

* Improve dark scheme icon

* Rename `ThemeButton` to `ThemeSelect`

* Add `ThemeSwitch` component to toggle between light/dark theme

* Generate `-50` shade for an option lighter than `-100`

* Update Settings component to expose each settings value as its own component prop (#177)

* Format project (fix lint failure)

* Update tailwind plugin to only generate shade colors if not present in theme (ex. Skeleton provides the shades 100-900).  Map `{color}-500` to `{color}` if not defined. Generate neutral color if not defined

* Map Skeleton themes to Svelte UX themes

* Switch Daisy UI themes back as the default (for now, until a more robust solution is available)

* refacto peer dev (#201)

* refacto peer dev

* @changesets/cli is only for library developers

* rehype-slug is only for the `svelte-ux` doc it can go to devDep

* @fortawesome/free-solid-svg-icons is only in the doc

* Move format function definitions onto settings to avoid calling getSettings after component initialization (#191)

* move format functions onto settings object

* update uses of formatting functions to fit new settings paradigm

* start transferring to store-based locale settings

* checkpoint

* update templates, add back custom date formatting

* upadte format samples

* update number tests

* clean up custom variant a bit, improve format function type definition

* remove date and number subformatters

* fixes

* fix missing style

* better label

* allow setting locale to one not explicitly supported

* fix a few old format calls

* add function type possibility to column format

* [formatNumber] Fix default style handling and update tests

* Locale support cleanup (#202)

* fix circular reference

* remove knownLocales

* fix date tests

* add locale exports, hide exports of a few internal-only functions

* changeset

* Format last qol for next (#203)

* add WeekStartsOn defaults depending on the locale

* init a Language Select comp

* Theme generator (#192)

* Rename `cssVars` action to `styleVars` and do not prefix properties with `--` by default (more flexible)

* [SelectField] Fix toggling display of options menu using toggleIcon. Ignore toggling when clicking on SelectField border.  Support hiding toggleIcon (`<SelectField toggleIcon={null} />

* [SelectField] Add `stepper` prop to iterate through options (like `MenuField`)

* [MenuField] Expose `selected` option via prop (similar to `SelectField`)

* [SelectField Add stepper example

* Move `processThemeColors()` from tailwind plugin to $lib/styles/theme to allow calling at runtime (theme generator frontend).  Add types

* Update skeleton.ts to match skeleton.cjs (to be removed)

* Beginning work of theme generator

* Read themes from `themes.json` file for both tailwind config and theme selector.  Remove daisy/skeleton commonjs modules.  Add `getThemeNames` to split based on `color-scheme`.  Ultimately simplifies a lot

* Add "Copy all" daisy and skeleton options

* Use <ThemeSelect> or <ThemeSwitch> based on more than 1 light/dark theme

* Fix skeleton dark themes after refactor

* Add explicit daisy themeName list to hopefully fix build (similar to skeleton)

* Set initial theme selections (fix reactivity infinite loop)

* [SelectField] Use `selectValue(...)` instead of `value = ...` so `change` is dispatched (and other consistent updating)

* Change light/dark preview based on which input was last changed

* Support overriding doc themes wtih generator (custom) themes

* Fix setting `prefers-color-scheme: dark` override

* Use a local copy of Skeleton themes to fix Cloudflare build (work around Node.js runtime issue)

* Improve handling of `-50` shade when `-100` exists (ex. Skeleton)

* Update site dark/light mode with preview for better experience (previewing and applying)

* Support custom Ior exisitng) theme editing

* Add state colors and support showing/hiding optoinal colors

* Add "Copy all themes" menu item

* [ColorField] Support `hex` entry

* Register all themes (daisy + skeleton)

* Format files (fix lint error)

* Add changeset

* Version bump to 0.58.0-next.9

* Add ThemeSwitch to top-level exports

* pass through existing locale stores if they are passed into settings (#205)

* make DateField format and mask reactive to locale changes (#206)

* make DateField format and mask reactive to locale changes

* Make Input component reactive to changes in mask

* fix getPeriodTypeName calls (#207)

* [ColorField] Make color swatch look clickable

* [TableOfContents] Support changing icon

* [Popover|Menu|popover] Support `resize` width or height only

* [ThemeSelect] Improve width (consistent when switching between light/dark, and fix width on mobile)

* [MenuButton] Support hiding `menuIcon` and dispatch `change` event

* Collapse app header actions into menu on small viewports.  Resolves #185

* Small docs design refinements

* [LanguageSelect] Use code instead of flag for selection display

* Responsive tweaks

* Update examles to use `fill-light" instead of "fill" for default color buttons (after darkening "fill")

* Update all light/dark mode toggles to be light/dark (and not dark/light).  Update theme page to initialize/sync showDarkMode based on the current setting

* Feat/date range weekstarton (#208)

* add fr translation & use the "week" to fit the weekstartOn

* range & fr & reactivity

* adding more translation

* internal var name

* typeHelpers

* fix my typo 🙈

* Update localization settings and translations (#211)

* Increase the z-index of the docs header to fix some examples (ex. AppBar) stacking above

* Refine theme page layout

* Add `isolate` to `<main>` allow modals (Dialog, Drawer, etc) to stack above high z-index elements when portal'd to the bottom of the DOM (outside of `<main>`

* Version bump to 0.58.0-next.10

* Support passing a custom formatter function as `format` argument to format() / formatWithLocale()

* Version bump to 0.58.0-next.11

* Comment out `$env/dynamic/private` usage unti SvelteKit is upgraded to `2.3.2+` to fix Safari issue

* Restore using `$env/dynamic/private` (doesn't appear to solve Safari issue)

* update SvelteKit and Vite dependencies (#215)

* update SvelteKit and Vite dependencies

* move sveld back to deps

* Handle `weekInfo` across different browsers (fix Safari).  Closes #214

* Change PeriodType values (0 = unqualified DoW, 1-7 = Sun-Sat).  Fix DateRange bi-week periodType.  Add tests for `hasDayOfWeek()`, `getDayOfWeek()`, and `replaceDayOfWeek()` (#217)

* Version bump to 0.58.0-next.12

* Update all dependencies except vitest

* Remove typedoc (since not actively using)

* Format projecdt after updating prettier (fix lint errors)

* [DateRange] Update selection when only changing period type (from/to

* Add changeset

* Version bump to 0.58.0-next.13

* Run svelte-migrate for Kit v2 (#218)

* Upgrade vitest to 1.2 (#219)

* Replace `sveltePreprocess` with `vitePreprocess` in docs.  Closes #57

* Remove broken classname

* Use a separate settings() context on format() page to not try to update site context.  Fixes error when setting to anything other than `en` and `fr`

* Add `sumObjects` array util

* Add jsdoc

* Remove unused prop accessor arg

* Reduce the font size of the Tailwind typography/prose headers

* [Kbd] Set the text color

* Update Getting Started and Customization docs

* Fix ThemeSwitch SSR behavior by using `dark` class to define positioning and icon display (#228)

* Add TODOs

* Replace red/green with danger/success

* Fix overriding `elevation-#` classes. Add `elevation-none` to remove `elevation-#`.  Closes #233 (#236)

* [Appbar] Add `menuIcon` prop and slot.  Closes #235 (#239)

* [MultiSelect] Add `autoFocusSearch` to opt into functionality, which `MultiSelectMenu` maintains (#241)

* [DateRange] Remove `scrollIntoView` for date selection components (month, year) (#242)

* Add ability to set default props on some components (#230)

* Add defaultProps to settings, with labelPlacement setting

* Allow per-component defaults as well

* remove global default props

* Update docs and calls to settings

* alter getComponentSettings return to make it easier to combine with restProps

* udpate changeset

* clean up imports

* fixes

* format

* support `rounded` on Buttons

* Fix getComponentClasses() with string (root-only) classes. Ex. `AppBar: { classes: '...' }`

* Refine customization docs

* Remove types in lib/types/options.ts to libs/types/index.ts

* Support `size` and `color` default settings

* Proper use of resolveComponentClasses from both call sites

---------

Co-authored-by: Sean Lynch <techniq35@gmail.com>

* feat(DateField): Add support for `class` and `classes` props (#244)

* feat(DateField): Add support for `class` and `classes` props, add `DateField` class, pass `$$restProps`

* Remove unnecessary `NonNullable`

* Fix DateField example with locale dictionary

* Add default light/dark themes if none are provided

* Do not require defining `color-scheme` for light/dark mode (but still support being explicit)

* [ThemeSelect] Opt into adding keyboard shortcuts.  Also fixes double registration on customization page

* [DateField] Fix input value when clearing value

* Replace any `.` (index) imports

* Fix getting started tailwind plugin path

* Change layerchart version in template to `latest` version

---------

Co-authored-by: JYC <jycouet@gmail.com>
Co-authored-by: Daniel Imfeld <daniel@imfeld.dev>
Co-authored-by: Brandon McConnell <brandon@dreamthinkbuild.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants