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

Merges widget-core into core. #306

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ Visit us at [dojo.io](https://dojo.io/) for documentation, tutorials, cookbooks,

## Sub-packages within `@dojo/framework`

There are eight sub-packages that form the framework for building a Dojo application:
There are seven sub-packages that form the framework for building a Dojo application:

- [`dojo/core`](src/core/README.md) - The foundational code of the Dojo platform
- [`dojo/has`](src/has/README.md) - A feature detection library
- [`dojo/i18n`](docs/en/i18n/) - A set of internationalization tooling
- [`dojo/routing`](src/routing/README.md) - A routing service to build web applications with
- [`dojo/shim`](src/shim/README.md) - Modules that provide fills of ES6+ functionality
- [`dojo/stores`](src/stores/README.md) - A lightweight state container
- [`dojo/widget-core`](src/widget-core/README.md) - The foundation code of Dojo widgets
- [`dojo/core`](src/core/README.md) - The foundation code of Dojo widgets
- [`dojo/testing`](src/testing/README.md) - A set of modules to help with testing Dojo

## External packages
Expand Down
18 changes: 9 additions & 9 deletions docs/en/i18n/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Starting off with a single default language (English).
> src/widgets/MyI18nWidget.ts

```ts
import { WidgetBase } from '@dojo/framework/widget-core/WidgetBase';
import { v } from '@dojo/framework/widget-core/d';
import { WidgetBase } from '@dojo/framework/core/WidgetBase';
import { v } from '@dojo/framework/core/d';

import I18nMixin from '@dojo/framework/widget-core/mixins/I18n';
import I18nMixin from '@dojo/framework/core/mixins/I18n';
import myWidgetMessageBundle from '../nls/MyI18nWidget.en.ts';

export default class MyI18nWidget extends I18nMixin(WidgetBase) {
Expand Down Expand Up @@ -88,10 +88,10 @@ Using the [i18n injector function](#providing-locale-data-to-i18n-aware-widgets)
> src/main.ts

```ts
import renderer from '@dojo/framework/widget-core/vdom';
import { w } from '@dojo/framework/widget-core/d';
import Registry from '@dojo/framework/widget-core/Registry';
import { registerI18nInjector } from '@dojo/framework/widget-core/mixins/I18n';
import renderer from '@dojo/framework/core/vdom';
import { w } from '@dojo/framework/core/d';
import Registry from '@dojo/framework/core/Registry';
import { registerI18nInjector } from '@dojo/framework/core/mixins/I18n';

import App from './App';

Expand All @@ -109,8 +109,8 @@ Using the [LocaleSwitcher](#changing-locales) utility widget to allow users to c
> src/widgets/LocaleChanger.ts

```ts
import WidgetBase from '@dojo/framework/widget-core/WidgetBase';
import { LocaleSwitcher, UpdateLocale } from '@dojo/framework/widget-core/mixins/I18n';
import WidgetBase from '@dojo/framework/core/WidgetBase';
import { LocaleSwitcher, UpdateLocale } from '@dojo/framework/core/mixins/I18n';

class LocaleChanger extends WidgetBase {
protected render() {
Expand Down
42 changes: 21 additions & 21 deletions docs/en/i18n/supplemental.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ This can be imported and referenced within a widget such as:
> widgets/MyI18nWidget.ts

```ts
import WidgetBase from '@dojo/framework/widget-core/WidgetBase';
import { v } from '@dojo/framework/widget-core/d';
import I18nMixin from '@dojo/framework/widget-core/mixins/I18n';
import WidgetBase from '@dojo/framework/core/WidgetBase';
import { v } from '@dojo/framework/core/d';
import I18nMixin from '@dojo/framework/core/mixins/I18n';

import myWidgetMessageBundle from '../nls/MyI18nWidget.en.ts';

Expand Down Expand Up @@ -152,7 +152,7 @@ For example, with the following configuration, an application specifies that its

## Creating i18n-aware Widgets

Individual widgets can be internationalized by adding the `I18nMixin` mixin from `@dojo/framework/widget-core/mixins/I18n`. This mixin adds some optional i18n-related widget properties, and also provides a `localizeBundle` method which is used to localize an imported message bundle to the widget's current locale.
Individual widgets can be internationalized by adding the `I18nMixin` mixin from `@dojo/framework/core/mixins/I18n`. This mixin adds some optional i18n-related widget properties, and also provides a `localizeBundle` method which is used to localize an imported message bundle to the widget's current locale.

### `I18nMixin` Widget Properties

Expand Down Expand Up @@ -195,9 +195,9 @@ export default {
> widgets/MyI18nWidget.ts

```ts
import WidgetBase from '@dojo/framework/widget-core/WidgetBase';
import { v, w } from '@dojo/framework/widget-core/d';
import I18nMixin from '@dojo/framework/widget-core/mixins/I18n';
import WidgetBase from '@dojo/framework/core/WidgetBase';
import { v, w } from '@dojo/framework/core/d';
import I18nMixin from '@dojo/framework/core/mixins/I18n';
import Label from '@dojo/widgets/label';
import Button from '@dojo/widgets/button';

Expand Down Expand Up @@ -237,15 +237,15 @@ Note that with this pattern it is possible for a widget to obtain its messages f

The Dojo registry is used to manage i18n locale data throughout an application, where locale data is injected into all i18n-aware widgets that utilize `I18nMixin`. When the application locale is changed, the i18n `Injector` will propagate new locale properties to all `I18nMixin` widgets, after which the affected widgets will be invalidated and re-rendered with the updated locale data.

This mechanism is enabled through `registerI18nInjector`, a convenience method provided by `@dojo/framework/widget-core/mixins/I18n`. Calling this method will register the `i18n` injector within a specific registry instance. Typically this is done at application bootstrap, where the i18n injector is registered against the global registry passed to the `renderer.mount()` method.
This mechanism is enabled through `registerI18nInjector`, a convenience method provided by `@dojo/framework/core/mixins/I18n`. Calling this method will register the `i18n` injector within a specific registry instance. Typically this is done at application bootstrap, where the i18n injector is registered against the global registry passed to the `renderer.mount()` method.

> main.ts

```ts
import renderer from '@dojo/framework/widget-core/vdom';
import { w } from '@dojo/framework/widget-core/d';
import Registry from '@dojo/framework/widget-core/Registry';
import { registerI18nInjector } from '@dojo/framework/widget-core/mixins/I18n';
import renderer from '@dojo/framework/core/vdom';
import { w } from '@dojo/framework/core/d';
import Registry from '@dojo/framework/core/Registry';
import { registerI18nInjector } from '@dojo/framework/core/mixins/I18n';

import App from './App';

Expand All @@ -258,7 +258,7 @@ r.mount({ registry });

## Changing locales

In combination with using the [i18n injector](#providing-locale-data-to-i18n-aware-widgets) to pass locale data to `I18nMixin` widgets, applications can use the `LocaleSwitcher` provider widget within `@dojo/framework/widget-core/mixins/I18n` to give users to ability to change locales. Applications can pass a `renderer` function property into a `LocaleSwitcher` instance, which will have an `updateLocale` function injected into it. The implementation of `renderer` should return `DNode | DNode[]`, similar to a regular widget `render` method. The implementation of the `renderer` function can then call `updateLocale` to enact a locale change throughout the application, for example in response to a user event when selecting a new locale from a list.
In combination with using the [i18n injector](#providing-locale-data-to-i18n-aware-widgets) to pass locale data to `I18nMixin` widgets, applications can use the `LocaleSwitcher` provider widget within `@dojo/framework/core/mixins/I18n` to give users to ability to change locales. Applications can pass a `renderer` function property into a `LocaleSwitcher` instance, which will have an `updateLocale` function injected into it. The implementation of `renderer` should return `DNode | DNode[]`, similar to a regular widget `render` method. The implementation of the `renderer` function can then call `updateLocale` to enact a locale change throughout the application, for example in response to a user event when selecting a new locale from a list.

### LocaleSwitcher Properties

Expand All @@ -272,8 +272,8 @@ In combination with using the [i18n injector](#providing-locale-data-to-i18n-awa
The following example shows an i18n-aware widget that uses `LocaleSwitcher` to render two buttons that allow switching the application locale between English and French.

```ts
import WidgetBase from '@dojo/framework/widget-core/WidgetBase';
import I18nMixin, { LocaleSwitcher, UpdateLocale } from '@dojo/framework/widget-core/mixins/I18n';
import WidgetBase from '@dojo/framework/core/WidgetBase';
import I18nMixin, { LocaleSwitcher, UpdateLocale } from '@dojo/framework/core/mixins/I18n';

import nlsBundle from '../nls/main';

Expand Down Expand Up @@ -484,9 +484,9 @@ The `guestInfo` message can be rendered directly via `format`:
> widgets/MyI18nWidget.ts

```ts
import WidgetBase from '@dojo/framework/widget-core/WidgetBase';
import { v } from '@dojo/framework/widget-core/d';
import I18nMixin from '@dojo/framework/widget-core/mixins/I18n';
import WidgetBase from '@dojo/framework/core/WidgetBase';
import { v } from '@dojo/framework/core/d';
import I18nMixin from '@dojo/framework/core/mixins/I18n';

import nlsBundle from '../nls/main';

Expand Down Expand Up @@ -585,9 +585,9 @@ The ICU-formatted `guestInfo` message can then be rendered as:
> widgets/MyI18nWidget.ts

```ts
import WidgetBase from '@dojo/framework/widget-core/WidgetBase';
import { v } from '@dojo/framework/widget-core/d';
import I18nMixin from '@dojo/framework/widget-core/mixins/I18n';
import WidgetBase from '@dojo/framework/core/WidgetBase';
import { v } from '@dojo/framework/core/d';
import I18nMixin from '@dojo/framework/core/mixins/I18n';

import nlsBundle from '../nls/main';

Expand Down
21 changes: 10 additions & 11 deletions intern.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"suites": [
"./dist/dev/tests/has/unit/all.js",
"./dist/dev/tests/shim/unit/all.js",
"./dist/dev/tests/core/unit/all.js",
"./dist/dev/tests/i18n/unit/all.js",
"./dist/dev/tests/stores/unit/all.js",
"./dist/dev/tests/testing/unit/all.js"
Expand All @@ -23,7 +22,7 @@
"./dist/dev/tests/has/functional/all.js",
"./dist/dev/tests/shim/functional/all.js",
"./dist/dev/tests/i18n/functional/**/*.js",
"./dist/dev/tests/widget-core/functional/all.js",
"./dist/dev/tests/core/functional/all.js",
"./dist/dev/tests/routing/functional/**/*.js",
"./dist/dev/tests/stores/functional/all.js"
],
Expand All @@ -34,7 +33,7 @@
"useLoader": true
},
{
"script": "./dist/dev/tests/widget-core/support/jsdom-plugin.js",
"script": "./dist/dev/tests/core/support/jsdom-plugin.js",
"useLoader": true
}
],
Expand Down Expand Up @@ -62,7 +61,7 @@
},
"suites+": [
"./dist/dev/tests/routing/unit/all.js",
"./dist/dev/tests/widget-core/unit/all.js"
"./dist/dev/tests/core/unit/all.js"
],
"plugins+": [
"./node_modules/whatwg-fetch/dist/fetch.umd.js",
Expand All @@ -71,7 +70,7 @@
"useLoader": true
},
{
"script": "./dist/dev/tests/widget-core/support/loadCustomElements.js",
"script": "./dist/dev/tests/core/support/loadCustomElements.js",
"useLoader": true
}
]
Expand All @@ -82,12 +81,12 @@
"./dist/dev/tests/routing/unit/**/*.js",
"!./dist/dev/tests/routing/unit/**/all.js",
"!./dist/dev/tests/routing/unit/history/StateHistory.js",
"./dist/dev/tests/widget-core/unit/**/*.js",
"!./dist/dev/tests/widget-core/unit/all.js",
"!./dist/dev/tests/widget-core/unit/meta/all.js",
"!./dist/dev/tests/widget-core/unit/meta/Resize.js",
"!./dist/dev/tests/widget-core/unit/meta/WebAnimation.js",
"!./dist/dev/tests/widget-core/unit/meta/Intersection.js"
"./dist/dev/tests/core/unit/**/*.js",
"!./dist/dev/tests/core/unit/all.js",
"!./dist/dev/tests/core/unit/meta/all.js",
"!./dist/dev/tests/core/unit/meta/Resize.js",
"!./dist/dev/tests/core/unit/meta/WebAnimation.js",
"!./dist/dev/tests/core/unit/meta/Intersection.js"
]
}
}
4 changes: 2 additions & 2 deletions run-benchmark.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { exec } = require('child_process');
const rimraf = require('rimraf');
const { runBench } = require('./dist/dev/tests/widget-core/benchmark/runner/src/benchmarkRunner.js');
const { runBench } = require('./dist/dev/tests/core/benchmark/runner/src/benchmarkRunner.js');
const {
processBenchmarkResults
} = require('./dist/dev/tests/widget-core/benchmark/runner/process-benchmark-results.js');
} = require('./dist/dev/tests/core/benchmark/runner/process-benchmark-results.js');
const http = require('http');
const url = require('url');
const fs = require('fs');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading