ember-freestyle 0.19.0 → 0.21.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +27 -2
  3. package/RELEASE.md +2 -2
  4. package/addon/components/freestyle/usage/index.hbs +1 -1
  5. package/addon/components/freestyle/usage/index.ts +0 -8
  6. package/addon/components/freestyle-palette-item/index.ts +1 -1
  7. package/addon/components/freestyle-section/index.hbs +0 -1
  8. package/addon/components/freestyle-section/index.ts +6 -1
  9. package/addon/components/freestyle-source/index.hbs +1 -1
  10. package/addon/components/freestyle-source/index.ts +10 -9
  11. package/addon/components/freestyle-subsection/index.hbs +0 -1
  12. package/addon/components/freestyle-subsection/index.ts +7 -1
  13. package/addon/components/freestyle-usage/index.hbs +1 -1
  14. package/addon/components/freestyle-usage-controls/index.hbs +7 -8
  15. package/addon/components/freestyle-usage-controls/index.ts +27 -5
  16. package/addon/modifiers/ensure-freestyle-theme.ts +22 -0
  17. package/addon/services/ember-freestyle.ts +15 -12
  18. package/addon/template-registry.ts +109 -0
  19. package/app/modifiers/ensure-freestyle-theme.js +1 -0
  20. package/app/styles/components/freestyle-menu.scss +9 -4
  21. package/app/styles/components/freestyle-section.scss +0 -1
  22. package/app/styles/components/freestyle-subsection.scss +0 -1
  23. package/components/freestyle/usage/index.d.ts +0 -2
  24. package/components/freestyle-palette-item/index.d.ts +1 -1
  25. package/components/freestyle-section/index.d.ts +2 -0
  26. package/components/freestyle-source/index.d.ts +7 -1
  27. package/components/freestyle-subsection/index.d.ts +2 -0
  28. package/components/freestyle-usage-controls/index.d.ts +16 -1
  29. package/lib/ast-transform.js +5 -1
  30. package/modifiers/ensure-freestyle-theme.d.ts +13 -0
  31. package/package.json +21 -22
  32. package/services/ember-freestyle.d.ts +3 -3
  33. package/{addon/glint.ts → template-registry.d.ts} +74 -54
  34. package/types/ember-truth-helpers/helpers/and.d.ts +2 -5
  35. package/types/ember-truth-helpers/helpers/or.d.ts +4 -4
  36. package/types/global.d.ts +4 -2
  37. package/vendor/ember-freestyle.css +9 -6
  38. package/glint.d.ts +0 -81
package/CHANGELOG.md CHANGED
@@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
 
6
6
 
7
+
8
+
9
+ ## v0.21.0 (2024-09-27)
10
+
11
+ #### :boom: Breaking Change
12
+ * [#995](https://github.com/chrislopresto/ember-freestyle/pull/995) Provide an extendable template registry ([@bertdeblock](https://github.com/bertdeblock))
13
+ * [#996](https://github.com/chrislopresto/ember-freestyle/pull/996) Drop support for Node versions below v18 ([@bertdeblock](https://github.com/bertdeblock))
14
+
15
+ #### :rocket: Enhancement
16
+ * [#999](https://github.com/chrislopresto/ember-freestyle/pull/999) Update AST transform to replace curly braces ([@lukemelia](https://github.com/lukemelia))
17
+ * [#995](https://github.com/chrislopresto/ember-freestyle/pull/995) Provide an extendable template registry ([@bertdeblock](https://github.com/bertdeblock))
18
+
19
+ #### :bug: Bug Fix
20
+ * [#998](https://github.com/chrislopresto/ember-freestyle/pull/998) Fix import path for `SafeString` type ([@bertdeblock](https://github.com/bertdeblock))
21
+
22
+ #### :house: Internal
23
+ * [#1005](https://github.com/chrislopresto/ember-freestyle/pull/1005) Type fixes ([@lukemelia](https://github.com/lukemelia))
24
+
25
+ #### Committers: 3
26
+ - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
27
+ - Luke Melia ([@lukemelia](https://github.com/lukemelia))
28
+ - [@tintinthong](https://github.com/tintinthong)
29
+
30
+ ## v0.20.0 (2023-10-07)
31
+
32
+ #### :rocket: Enhancement
33
+ * [#973](https://github.com/chrislopresto/ember-freestyle/pull/973) Eliminate uppercase'ing of menu items and update menu item hover state ([@lukemelia](https://github.com/lukemelia))
34
+
35
+ #### Committers: 1
36
+ - Luke Melia ([@lukemelia](https://github.com/lukemelia))
37
+
7
38
  ## v0.19.0 (2023-09-28)
8
39
 
9
40
  #### :boom: Breaking Change
package/README.md CHANGED
@@ -25,10 +25,10 @@ To see Ember Freestyle in action, visit [https://chrislopresto.github.io/ember-f
25
25
 
26
26
  * Ember.js v3.24 or above
27
27
  * Ember CLI v3.24 or above
28
- * Node.js v14 or above
28
+ * Node.js v18 or above
29
29
  * Ember Auto Import v2 or above
30
30
 
31
- ember-freestyle includes Typescript types and provides `addon/glint.ts` for Glint usage
31
+ ember-freestyle includes TypeScript types, and provides a template registry that can be imported from `ember-freestyle/template-registry` for Glint usage.
32
32
 
33
33
  ## Installation
34
34
 
@@ -113,6 +113,31 @@ You should include `ember-freestyle` in your `devDependencies` so that apps
113
113
  using your addon will not include Ember Freestyle CSS and JavaScript in their
114
114
  production builds.
115
115
 
116
+ ### In V2 addons
117
+
118
+ You will need to configure babel to run ember-freestyle's AST Transform in order to capture
119
+ source code from Freestyle::Usage example blocks. For example:
120
+
121
+ ```js
122
+ // babel.config.mjs
123
+ import FreestyleTransform from 'ember-freestyle/lib/ast-transform.js';
124
+
125
+ export default {
126
+ plugins: [
127
+ // ...
128
+ [
129
+ 'babel-plugin-ember-template-compilation',
130
+ {
131
+ targetFormat: 'hbs',
132
+ transforms: [FreestyleTransform],
133
+ },
134
+ ],
135
+ // ...
136
+ ],
137
+ };
138
+
139
+ ```
140
+
116
141
  ## Contributing
117
142
 
118
143
  See the [Contributing](CONTRIBUTING.md) guide for details.
package/RELEASE.md CHANGED
@@ -31,7 +31,7 @@ Once the prep work is completed, the actual release is straight forward:
31
31
  * First, ensure that you have installed your projects dependencies:
32
32
 
33
33
  ```sh
34
- yarn install
34
+ pnpn install
35
35
  ```
36
36
 
37
37
  * Second, ensure that you have obtained a
@@ -50,7 +50,7 @@ yarn install
50
50
  * And last (but not least 😁) do your release.
51
51
 
52
52
  ```sh
53
- npx release-it
53
+ pnpm release
54
54
  ```
55
55
 
56
56
  [release-it](https://github.com/release-it/release-it/) manages the actual
@@ -84,7 +84,7 @@
84
84
  {{/if}}
85
85
 
86
86
  {{#if this.showSource}}
87
- <div class="FreestyleUsage-sourceContainer" {{did-insert this.highlightSource}}>
87
+ <div class="FreestyleUsage-sourceContainer" {{ensure-freestyle-theme @highlightJsTheme}}>
88
88
  <FreestyleSource @source={{@source}} />
89
89
  </div>
90
90
  {{/if}}
@@ -71,14 +71,6 @@ export default class extends Component<Signature> {
71
71
  return this.args.slug || this.args.name;
72
72
  }
73
73
 
74
- get computedTheme(): string {
75
- return this.args.highlightJsTheme || this.emberFreestyle.defaultTheme;
76
- }
77
-
78
- @action highlightSource(): void {
79
- this.emberFreestyle.ensureHljsTheme(this.computedTheme);
80
- }
81
-
82
74
  @action setFocus(): void {
83
75
  this.emberFreestyle.focus = this.effectiveSlug ?? null;
84
76
  }
@@ -1,6 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { htmlSafe } from '@ember/template';
3
- import { SafeString } from '@ember/template/-private/handlebars';
3
+ import { type SafeString } from '@ember/template';
4
4
  import { PaletteItem } from '../freestyle-palette';
5
5
 
6
6
  interface Signature {
@@ -1,6 +1,5 @@
1
1
  <div
2
2
  class="FreestyleSection {{if this.show 'FreestyleSection--showing' 'FreestyleSection--hidden'}}"
3
- {{did-insert (fn this.emberFreestyle.registerSection @name null)}}
4
3
  ...attributes
5
4
  >
6
5
  {{#if this.show}}
@@ -1,9 +1,9 @@
1
1
  import Component from '@glimmer/component';
2
2
  import type EmberFreestyleService from '../../services/ember-freestyle';
3
3
  import type { WithBoundArgs } from '@glint/template';
4
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
4
  import { inject as service } from '@ember/service';
6
5
  import FreestyleSubsection from '../freestyle-subsection';
6
+ import Owner from '@ember/owner';
7
7
 
8
8
  interface Signature {
9
9
  Element: HTMLDivElement;
@@ -20,6 +20,11 @@ interface Signature {
20
20
  export default class FreestyleSection extends Component<Signature> {
21
21
  @service('ember-freestyle') declare emberFreestyle: EmberFreestyleService;
22
22
 
23
+ constructor(owner: Owner, args: Signature['Args']) {
24
+ super(owner, args);
25
+ this.emberFreestyle.registerSection(this.args.name);
26
+ }
27
+
23
28
  get show(): boolean {
24
29
  return this.emberFreestyle.shouldShowSection(this.args.name);
25
30
  }
@@ -2,5 +2,5 @@
2
2
  <div class="FreestyleSource-title">
3
3
  Source
4
4
  </div>
5
- <pre class="handlebars" tabindex="0" {{did-insert this.highlight}}>{{this.renderableSource}}</pre>
5
+ <pre class="handlebars" tabindex="0" {{this.highlight}}>{{this.renderableSource}}</pre>
6
6
  {{/if}}
@@ -1,11 +1,9 @@
1
1
  import Component from '@glimmer/component';
2
2
  import EmberFreestyleService from '../../services/ember-freestyle';
3
- /* eslint-disable @typescript-eslint/no-unused-vars */
4
3
  import { inject as service } from '@ember/service';
5
- import { tracked } from '@glimmer/tracking';
6
4
  import { reads } from 'macro-decorators';
7
- import { action, get } from '@ember/object';
8
- /* eslint-enable @typescript-eslint/no-unused-vars */
5
+ import { get } from '@ember/object';
6
+ import { modifier } from 'ember-modifier';
9
7
 
10
8
  interface Signature {
11
9
  Args: {
@@ -22,7 +20,7 @@ export default class FreestyleSource extends Component<Signature> {
22
20
  string,
23
21
  unknown
24
22
  >;
25
- @tracked initialHighlightComplete = false;
23
+ initialHighlightComplete = false;
26
24
  preElement: HTMLElement | undefined;
27
25
 
28
26
  private dynamafy(sourceCode: string) {
@@ -61,7 +59,11 @@ export default class FreestyleSource extends Component<Signature> {
61
59
  if (!this.args.source) {
62
60
  return '';
63
61
  }
64
- let result = this.args.source.replace(/^(\s*\n)*/, '').replace(/\s*$/, '');
62
+ let result = this.args.source
63
+ .replace(/^(\s*\n)*/, '')
64
+ .replace(/\s*$/, '')
65
+ .replace(/&#123;/g, '{')
66
+ .replace(/&#125;/g, '}');
65
67
 
66
68
  if (this.args.isDynamic) {
67
69
  result = this.dynamafy(result);
@@ -78,12 +80,11 @@ export default class FreestyleSource extends Component<Signature> {
78
80
  return result;
79
81
  }
80
82
 
81
- @action
82
- highlight(preElement: HTMLElement): void {
83
+ highlight = modifier((preElement: HTMLElement) => {
83
84
  this.preElement = preElement;
84
85
  if (preElement && this.renderableSource) {
85
86
  this.emberFreestyle.highlight(preElement);
86
87
  }
87
88
  this.initialHighlightComplete = true;
88
- }
89
+ });
89
90
  }
@@ -1,5 +1,4 @@
1
1
  <div class="FreestyleSubsection {{if this.show 'is-showing' 'is-hidden'}}"
2
- {{did-insert (fn this.emberFreestyle.registerSection @section @name)}}
3
2
  ...attributes
4
3
  >
5
4
  {{#if this.show}}
@@ -1,7 +1,7 @@
1
1
  import Component from '@glimmer/component';
2
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
2
  import { inject as service } from '@ember/service';
4
3
  import EmberFreestyleService from '../../services/ember-freestyle';
4
+ import Owner from '@ember/owner';
5
5
 
6
6
  interface Signature {
7
7
  Element: HTMLDivElement;
@@ -15,6 +15,12 @@ interface Signature {
15
15
  }
16
16
  export default class FreestyleSubsection extends Component<Signature> {
17
17
  @service('ember-freestyle') declare emberFreestyle: EmberFreestyleService;
18
+
19
+ constructor(owner: Owner, args: Signature['Args']) {
20
+ super(owner, args);
21
+ this.emberFreestyle.registerSection(this.args.section, this.args.name);
22
+ }
23
+
18
24
  get show(): boolean {
19
25
  return this.emberFreestyle.shouldShowSubsection(
20
26
  this.args.section,
@@ -1,6 +1,6 @@
1
1
  <div
2
2
  class="FreestyleUsage {{if @inline 'FreestyleUsage--inline'}}"
3
- {{did-insert this.ensureTheme}}
3
+ {{ensure-freestyle-theme}}
4
4
  ...attributes
5
5
  >
6
6
  {{#if this.show}}
@@ -1,4 +1,4 @@
1
- <div class="FreestyleUsageControls" {{did-insert this.setup}}>
1
+ <div class="FreestyleUsageControls" {{this.setup}}>
2
2
  {{#if this.showHeader}}
3
3
  <div class="FreestyleUsageControls-header">
4
4
  Settings
@@ -7,7 +7,7 @@
7
7
  <div class="FreestyleUsageControls-item">
8
8
  <div class="FreestyleUsageControls-itemControl">
9
9
  <label class="FreestyleUsageControls-itemLabel">
10
- <Input @type="checkbox" @checked={{this.showLabels}} />
10
+ <input type="checkbox" checked={{this.showLabels}} {{on 'click' (this.toggle 'showLabels')}} />
11
11
  Show Labels
12
12
  </label>
13
13
  </div>
@@ -15,7 +15,7 @@
15
15
  <div class="FreestyleUsageControls-item">
16
16
  <div class="FreestyleUsageControls-itemControl">
17
17
  <label class="FreestyleUsageControls-itemLabel">
18
- <Input @type="checkbox" @checked={{this.showNotes}} />
18
+ <input type="checkbox" checked={{this.showNotes}} {{on 'click' (this.toggle 'showNotes')}} />
19
19
  Show Notes
20
20
  </label>
21
21
  </div>
@@ -23,7 +23,7 @@
23
23
  <div class="FreestyleUsageControls-item">
24
24
  <div class="FreestyleUsageControls-itemControl">
25
25
  <label class="FreestyleUsageControls-itemLabel">
26
- <Input @type="checkbox" @checked={{this.showCode}} />
26
+ <input type="checkbox" checked={{this.showCode}} {{on 'click' (this.toggle 'showCode')}} />
27
27
  Show Code
28
28
  </label>
29
29
  </div>
@@ -31,7 +31,7 @@
31
31
  <div class="FreestyleUsageControls-item">
32
32
  <div class="FreestyleUsageControls-itemControl">
33
33
  <label class="FreestyleUsageControls-itemLabel">
34
- <Input @type="checkbox" @checked={{this.showApi}} />
34
+ <input type="checkbox" checked={{this.showApi}} {{on 'click' (this.toggle 'showApi')}} />
35
35
  Show API
36
36
  </label>
37
37
  </div>
@@ -39,9 +39,8 @@
39
39
  {{#if this.showFocus}}
40
40
  <div class="FreestyleUsageControls-item FreestyleUsageControls-item--focus">
41
41
  <div class="FreestyleUsageControls-itemControl">
42
- <label class="FreestyleUsageControls-label--focus">Focus a section
43
- <Input class="FreestyleUsageControls-input--focus" @value={{this.focus}} @enter={{this.setFocus}} />
44
- </label>
42
+ {{!-- template-lint-disable require-input-label --}}
43
+ <input type="text" class="FreestyleUsageControls-input--focus" value={{this.focus}} {{on 'input' this.updateFocus}} {{on 'keydown' this.setFocusOnEnterKey}} />
45
44
  <button class="FreestyleUsageControls-button" {{on 'click' this.setFocus}} type="button">Focus</button>
46
45
  </div>
47
46
  </div>
@@ -2,11 +2,11 @@ import Component from '@glimmer/component';
2
2
  import { schedule } from '@ember/runloop';
3
3
  import { capitalize } from '@ember/string';
4
4
  import type EmberFreestyleService from '../../services/ember-freestyle';
5
- /* eslint-disable @typescript-eslint/no-unused-vars */
6
5
  import { inject as service } from '@ember/service';
7
6
  import { action, get, set } from '@ember/object';
8
7
  import { tracked } from '@glimmer/tracking';
9
- /* eslint-enable @typescript-eslint/no-unused-vars */
8
+ import { modifier } from 'ember-modifier';
9
+ import { helper } from '@ember/component/helper';
10
10
 
11
11
  export default class FreestyleUsageControls extends Component {
12
12
  @service('ember-freestyle') declare emberFreestyle: EmberFreestyleService;
@@ -40,11 +40,29 @@ export default class FreestyleUsageControls extends Component {
40
40
  showFocus = true;
41
41
  @tracked focus: string | null = null;
42
42
 
43
- @action setup(): void {
43
+ setup = modifier(() => {
44
44
  schedule('afterRender', () => {
45
45
  this.focus = this.emberFreestyle.focus;
46
46
  });
47
- }
47
+ });
48
+
49
+ toggle = helper(
50
+ ([prop]: ['showNotes' | 'showLabels' | 'showCode' | 'showApi']) => {
51
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
52
+ const component = this;
53
+ return () => {
54
+ const currentValue = get(component, prop) as boolean;
55
+ const newValue = !currentValue;
56
+ set(component, prop, newValue);
57
+ };
58
+ },
59
+ );
60
+
61
+ setFocusOnEnterKey = (ev: KeyboardEvent) => {
62
+ if (ev.key === 'Enter') {
63
+ this.setFocus();
64
+ }
65
+ };
48
66
 
49
67
  @action
50
68
  toggleUsage(usageType: 'labels' | 'notes' | 'code' | 'api'): void {
@@ -58,6 +76,10 @@ export default class FreestyleUsageControls extends Component {
58
76
 
59
77
  @action
60
78
  setFocus(): void {
61
- this.emberFreestyle.set('focus', this.focus);
79
+ this.emberFreestyle.focus = this.focus;
62
80
  }
81
+
82
+ updateFocus = (ev: Event) => {
83
+ this.focus = (ev.target as HTMLInputElement).value;
84
+ };
63
85
  }
@@ -0,0 +1,22 @@
1
+ import Modifier from 'ember-modifier';
2
+ import { inject as service } from '@ember/service';
3
+ import type EmberFreestyleService from '../services/ember-freestyle';
4
+
5
+ interface Signature {
6
+ Element: HTMLElement;
7
+ Args: {
8
+ Positional: [highlightJsTheme?: string];
9
+ };
10
+ }
11
+
12
+ export default class EnsureFreestyleTheme extends Modifier<Signature> {
13
+ @service declare emberFreestyle: EmberFreestyleService;
14
+
15
+ modify(
16
+ _element: HTMLElement,
17
+ positional: Signature['Args']['Positional'],
18
+ ): void {
19
+ const computedTheme = positional?.[0] || this.emberFreestyle.defaultTheme;
20
+ this.emberFreestyle.ensureHljsTheme(computedTheme);
21
+ }
22
+ }
@@ -1,15 +1,13 @@
1
1
  import Service from '@ember/service';
2
2
  import { isBlank, isPresent } from '@ember/utils';
3
- import { TrackedArray } from 'tracked-built-ins';
4
3
  import { Promise } from 'rsvp';
5
- /* eslint-disable @typescript-eslint/no-unused-vars */
6
4
  import { tracked } from '@glimmer/tracking';
7
5
  import { action } from '@ember/object';
8
- /* eslint-enable @typescript-eslint/no-unused-vars */
6
+ import { scheduleOnce } from '@ember/runloop';
9
7
 
10
8
  export interface Section {
11
9
  name: string;
12
- subsections: TrackedArray<Subsection>;
10
+ subsections: Subsection[];
13
11
  }
14
12
 
15
13
  interface Subsection {
@@ -22,7 +20,7 @@ export default class EmberFreestyleService extends Service {
22
20
  @tracked showCode = true;
23
21
  @tracked showApi = true;
24
22
 
25
- @tracked menu: TrackedArray<Section> | null = null;
23
+ @tracked menu: Section[] = [];
26
24
  @tracked showMenu = true;
27
25
  @tracked allowRenderingAllSections = true;
28
26
 
@@ -125,16 +123,15 @@ export default class EmberFreestyleService extends Service {
125
123
 
126
124
  @action
127
125
  registerSection(sectionName: string, subsectionName = ''): void {
128
- const menu: TrackedArray<Section> =
129
- this.menu || new TrackedArray<Section>();
130
- if (!menu.find((s) => s.name === sectionName)) {
131
- menu.push({
126
+ this.menu;
127
+ if (!this.menu.find((s) => s.name === sectionName)) {
128
+ this.menu.push({
132
129
  name: sectionName,
133
- subsections: new TrackedArray<Subsection>(),
130
+ subsections: [],
134
131
  });
135
132
  }
136
133
  if (isPresent(subsectionName)) {
137
- const section = menu.find((s) => s.name === sectionName);
134
+ const section = this.menu.find((s) => s.name === sectionName);
138
135
  if (
139
136
  section &&
140
137
  !section.subsections.find((s) => s.name === subsectionName)
@@ -142,10 +139,16 @@ export default class EmberFreestyleService extends Service {
142
139
  section.subsections.push({
143
140
  name: subsectionName,
144
141
  });
142
+ section.subsections = [...section.subsections];
145
143
  }
146
144
  }
147
- this.menu = menu;
145
+ scheduleOnce('afterRender', this, this.notifyMenuChanged);
148
146
  }
147
+
148
+ notifyMenuChanged = () => {
149
+ // eslint-disable-next-line no-self-assign
150
+ this.menu = this.menu;
151
+ };
149
152
  }
150
153
 
151
154
  // DO NOT DELETE: this is how TypeScript knows how to look up your services.
@@ -0,0 +1,109 @@
1
+ // components
2
+ import type FreestyleAnnotation from 'ember-freestyle/components/freestyle-annotation';
3
+ import type FreestyleCollection from 'ember-freestyle/components/freestyle-collection';
4
+ import type FreestyleDynamicInputSelectOption from 'ember-freestyle/components/freestyle-dynamic-input-select-option';
5
+ import type FreestyleDynamicInput from 'ember-freestyle/components/freestyle-dynamic-input';
6
+ import type FreestyleDynamic from 'ember-freestyle/components/freestyle-dynamic';
7
+ import type FreestyleFocusButton from 'ember-freestyle/components/freestyle-focus-button';
8
+ import type FreestyleGuide from 'ember-freestyle/components/freestyle-guide';
9
+ import type FreestyleMenu from 'ember-freestyle/components/freestyle-menu';
10
+ import type FreestylePaletteItem from 'ember-freestyle/components/freestyle-palette-item';
11
+ import type FreestylePalette from 'ember-freestyle/components/freestyle-palette';
12
+ import type FreestyleSection from 'ember-freestyle/components/freestyle-section';
13
+ import type FreestyleSource from 'ember-freestyle/components/freestyle-source';
14
+ import type FreestyleSubsection from 'ember-freestyle/components/freestyle-subsection';
15
+ import type FreestyleTypeface from 'ember-freestyle/components/freestyle-typeface';
16
+ import type FreestyleUsageControls from 'ember-freestyle/components/freestyle-usage-controls';
17
+ import type FreestyleUsageLegacy from 'ember-freestyle/components/freestyle-usage';
18
+ import type FreestyleVariantList from 'ember-freestyle/components/freestyle-variant-list';
19
+ import type FreestyleVariant from 'ember-freestyle/components/freestyle-variant';
20
+ import type FreestyleUsageArgument from 'ember-freestyle/components/freestyle/usage/argument';
21
+ import type FreestyleUsageArray from 'ember-freestyle/components/freestyle/usage/array';
22
+ import type FreestyleUsageBasicCssVariable from 'ember-freestyle/components/freestyle/usage/basic-css-variable';
23
+ import type FreestyleUsageBoolControl from 'ember-freestyle/components/freestyle/usage/bool/control';
24
+ import type FreestyleUsageBool from 'ember-freestyle/components/freestyle/usage/bool';
25
+ import type FreestyleUsageComponentLikeControl from 'ember-freestyle/components/freestyle/usage/component-like/control';
26
+ import type FreestyleUsageComponentLike from 'ember-freestyle/components/freestyle/usage/component-like';
27
+ import type FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
28
+ import type FreestyleUsageNumberControl from 'ember-freestyle/components/freestyle/usage/number/control';
29
+ import type FreestyleUsageNumber from 'ember-freestyle/components/freestyle/usage/number';
30
+ import type FreestyleUsageObjectControl from 'ember-freestyle/components/freestyle/usage/object/control';
31
+ import type FreestyleUsageObject from 'ember-freestyle/components/freestyle/usage/object';
32
+ import type FreestyleUsageStringControl from 'ember-freestyle/components/freestyle/usage/string/control';
33
+ import type FreestyleUsageString from 'ember-freestyle/components/freestyle/usage/string';
34
+
35
+ // modifiers
36
+ import type FreestyleHighlight from 'ember-freestyle/modifiers/freestyle-highlight';
37
+ import EnsureFreestyleTheme from './modifiers/ensure-freestyle-theme';
38
+
39
+ export default interface EmberFreestyleRegistry {
40
+ // components
41
+ 'freestyle-annotation': typeof FreestyleAnnotation;
42
+ FreestyleAnnotation: typeof FreestyleAnnotation;
43
+ 'freestyle-collection': typeof FreestyleCollection;
44
+ FreestyleCollection: typeof FreestyleCollection;
45
+ 'freestyle-dynamic-input-select-option': typeof FreestyleDynamicInputSelectOption;
46
+ FreestyleDynamicInputSelectOption: typeof FreestyleDynamicInputSelectOption;
47
+ 'freestyle-dynamic-input': typeof FreestyleDynamicInput;
48
+ FreestyleDynamicInput: typeof FreestyleDynamicInput;
49
+ 'freestyle-dynamic': typeof FreestyleDynamic;
50
+ FreestyleDynamic: typeof FreestyleDynamic;
51
+ 'freestyle-focus-button': typeof FreestyleFocusButton;
52
+ FreestyleFocusButton: typeof FreestyleFocusButton;
53
+ 'freestyle-guide': typeof FreestyleGuide;
54
+ FreestyleGuide: typeof FreestyleGuide;
55
+ 'freestyle-menu': typeof FreestyleMenu;
56
+ FreestyleMenu: typeof FreestyleMenu;
57
+ 'freestyle-palette-item': typeof FreestylePaletteItem;
58
+ FreestylePaletteItem: typeof FreestylePaletteItem;
59
+ 'freestyle-palette': typeof FreestylePalette;
60
+ FreestylePalette: typeof FreestylePalette;
61
+ 'freestyle-section': typeof FreestyleSection;
62
+ FreestyleSection: typeof FreestyleSection;
63
+ 'freestyle-source': typeof FreestyleSource;
64
+ FreestyleSource: typeof FreestyleSource;
65
+ 'freestyle-subsection': typeof FreestyleSubsection;
66
+ FreestyleSubsection: typeof FreestyleSubsection;
67
+ 'freestyle-typeface': typeof FreestyleTypeface;
68
+ FreestyleTypeface: typeof FreestyleTypeface;
69
+ 'freestyle-usage-controls': typeof FreestyleUsageControls;
70
+ FreestyleUsageControls: typeof FreestyleUsageControls;
71
+ 'freestyle-usage': typeof FreestyleUsageLegacy;
72
+ FreestyleUsage: typeof FreestyleUsageLegacy;
73
+ 'freestyle-variant-list': typeof FreestyleVariantList;
74
+ FreestyleVariantList: typeof FreestyleVariantList;
75
+ 'freestyle-variant': typeof FreestyleVariant;
76
+ FreestyleVariant: typeof FreestyleVariant;
77
+ 'freestyle/usage/argument': typeof FreestyleUsageArgument;
78
+ 'Freestyle::Usage::Argument': typeof FreestyleUsageArgument;
79
+ 'freestyle/usage/array': typeof FreestyleUsageArray;
80
+ 'Freestyle::Usage::Array': typeof FreestyleUsageArray;
81
+ 'freestyle/usage/basic-css-variable': typeof FreestyleUsageBasicCssVariable;
82
+ 'Freestyle::Usage::BasicCssVariable': typeof FreestyleUsageBasicCssVariable;
83
+ 'freestyle/usage/bool/control': typeof FreestyleUsageBoolControl;
84
+ 'Freestyle::Usage::Bool::Control': typeof FreestyleUsageBoolControl;
85
+ 'freestyle/usage/bool': typeof FreestyleUsageBool;
86
+ 'Freestyle::Usage::Bool': typeof FreestyleUsageBool;
87
+ 'freestyle/usage/component-like/control': typeof FreestyleUsageComponentLikeControl;
88
+ 'Freestyle::Usage::ComponentLike::Control': typeof FreestyleUsageComponentLikeControl;
89
+ 'freestyle/usage/component-like': typeof FreestyleUsageComponentLike;
90
+ 'Freestyle::Usage::ComponentLike': typeof FreestyleUsageComponentLike;
91
+ 'freestyle/usage': typeof FreestyleUsage;
92
+ 'Freestyle::Usage': typeof FreestyleUsage;
93
+ 'freestyle/usage/number/control': typeof FreestyleUsageNumberControl;
94
+ 'Freestyle::Usage::Number::Control': typeof FreestyleUsageNumberControl;
95
+ 'freestyle/usage/number': typeof FreestyleUsageNumber;
96
+ 'Freestyle::Usage::Number': typeof FreestyleUsageNumber;
97
+ 'freestyle/usage/object/control': typeof FreestyleUsageObjectControl;
98
+ 'Freestyle::Usage::Object::Control': typeof FreestyleUsageObjectControl;
99
+ 'freestyle/usage/object': typeof FreestyleUsageObject;
100
+ 'Freestyle::Usage::Object': typeof FreestyleUsageObject;
101
+ 'freestyle/usage/string/control': typeof FreestyleUsageStringControl;
102
+ 'Freestyle::Usage::String::Control': typeof FreestyleUsageStringControl;
103
+ 'freestyle/usage/string': typeof FreestyleUsageString;
104
+ 'Freestyle::Usage::String': typeof FreestyleUsageString;
105
+
106
+ // modifiers
107
+ 'freestyle-highlight': typeof FreestyleHighlight;
108
+ 'ensure-freestyle-theme': typeof EnsureFreestyleTheme;
109
+ }
@@ -0,0 +1 @@
1
+ export { default } from 'ember-freestyle/modifiers/ensure-freestyle-theme';
@@ -5,22 +5,27 @@
5
5
 
6
6
  &-item,
7
7
  &-submenuItem {
8
- padding-top: 0.6rem;
9
- text-transform: uppercase;
8
+ padding-top: 0.1rem;
10
9
  }
11
10
 
12
11
  &-itemLink,
13
12
  &-submenuItemLink {
13
+ border-radius: 6px;
14
14
  color: $FreestyleGuide-color--foreground;
15
+ display: block;
16
+ padding: 0.3rem 0.3rem 0.3rem 0.5rem;
15
17
  text-decoration: none;
16
18
 
17
19
  &.active {
18
- color: $FreestyleGuide-color--primary;
20
+ background-color: $FreestyleGuide-color--primary;
21
+ color: white;
19
22
  text-decoration: none;
23
+ font-weight: bold;
20
24
  }
21
25
 
22
26
  &:hover {
23
- color: $FreestyleGuide-color--accent;
27
+ background-color: $FreestyleGuide-color--primary;
28
+ color: white;
24
29
  text-decoration: none;
25
30
  }
26
31
  }
@@ -9,7 +9,6 @@ $FreestyleSection-borderColor: #ccc !default;
9
9
  margin: 0 1rem;
10
10
  max-width: calc(1200px - 1rem);
11
11
  padding: 1rem 0 0.4rem;
12
- text-transform: uppercase;
13
12
  }
14
13
 
15
14
  &--hidden {
@@ -7,6 +7,5 @@
7
7
  font-size: 1.3rem;
8
8
  margin: 0 1rem;
9
9
  padding: 0.8rem 0 0.4rem;
10
- text-transform: uppercase;
11
10
  }
12
11
  }
@@ -40,8 +40,6 @@ export default class extends Component<Signature> {
40
40
  get showApi(): boolean;
41
41
  get show(): boolean;
42
42
  get effectiveSlug(): string | undefined;
43
- get computedTheme(): string;
44
- highlightSource(): void;
45
43
  setFocus(): void;
46
44
  }
47
45
  export {};
@@ -1,5 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
- import { SafeString } from '@ember/template/-private/handlebars';
2
+ import { type SafeString } from '@ember/template';
3
3
  import { PaletteItem } from '../freestyle-palette';
4
4
  interface Signature {
5
5
  Element: HTMLDivElement;
@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
2
2
  import type EmberFreestyleService from '../../services/ember-freestyle';
3
3
  import type { WithBoundArgs } from '@glint/template';
4
4
  import FreestyleSubsection from '../freestyle-subsection';
5
+ import Owner from '@ember/owner';
5
6
  interface Signature {
6
7
  Element: HTMLDivElement;
7
8
  Args: {
@@ -17,6 +18,7 @@ interface Signature {
17
18
  }
18
19
  export default class FreestyleSection extends Component<Signature> {
19
20
  emberFreestyle: EmberFreestyleService;
21
+ constructor(owner: Owner, args: Signature['Args']);
20
22
  get show(): boolean;
21
23
  }
22
24
  export {};
@@ -15,6 +15,12 @@ export default class FreestyleSource extends Component<Signature> {
15
15
  preElement: HTMLElement | undefined;
16
16
  private dynamafy;
17
17
  get renderableSource(): string;
18
- highlight(preElement: HTMLElement): void;
18
+ highlight: import("ember-modifier").FunctionBasedModifier<{
19
+ Args: {
20
+ Positional: unknown[];
21
+ Named: import("ember-modifier/-private/signature").EmptyObject;
22
+ };
23
+ Element: HTMLElement;
24
+ }>;
19
25
  }
20
26
  export {};
@@ -1,5 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import EmberFreestyleService from '../../services/ember-freestyle';
3
+ import Owner from '@ember/owner';
3
4
  interface Signature {
4
5
  Element: HTMLDivElement;
5
6
  Args: {
@@ -12,6 +13,7 @@ interface Signature {
12
13
  }
13
14
  export default class FreestyleSubsection extends Component<Signature> {
14
15
  emberFreestyle: EmberFreestyleService;
16
+ constructor(owner: Owner, args: Signature['Args']);
15
17
  get show(): boolean;
16
18
  }
17
19
  export {};
@@ -13,7 +13,22 @@ export default class FreestyleUsageControls extends Component {
13
13
  showHeader: boolean;
14
14
  showFocus: boolean;
15
15
  focus: string | null;
16
- setup(): void;
16
+ setup: import("ember-modifier").FunctionBasedModifier<{
17
+ Args: {
18
+ Positional: unknown[];
19
+ Named: import("ember-modifier/-private/signature").EmptyObject;
20
+ };
21
+ Element: Element;
22
+ }>;
23
+ toggle: import("@ember/component/helper").FunctionBasedHelper<{
24
+ Args: {
25
+ Positional: ["showLabels" | "showNotes" | "showCode" | "showApi"];
26
+ Named: import("@ember/component/helper").EmptyObject;
27
+ };
28
+ Return: () => void;
29
+ }>;
30
+ setFocusOnEnterKey: (ev: KeyboardEvent) => void;
17
31
  toggleUsage(usageType: 'labels' | 'notes' | 'code' | 'api'): void;
18
32
  setFocus(): void;
33
+ updateFocus: (ev: Event) => void;
19
34
  }
@@ -48,6 +48,10 @@ function cleanupNamedBlocksPolyfillSyntax(sourceString) {
48
48
  return sourceString;
49
49
  }
50
50
 
51
+ function escapeCurlyBraces(s) {
52
+ return s.replace(/\{/g, '&#123;').replace(/\}/g, '&#125;');
53
+ }
54
+
51
55
  function extractSource(nodes, contents) {
52
56
  // nodes should be a contiguous collection of ast nodes
53
57
  let startNode = nodes[0];
@@ -57,7 +61,7 @@ function extractSource(nodes, contents) {
57
61
  let lines = contents.split('\n').slice(start.line - 1, end.line);
58
62
  lines[0] = new Array(start.column).join(' ') + lines[0].slice(start.column);
59
63
  lines[lines.length - 1] = lines[lines.length - 1].slice(0, end.column);
60
- return stripIndent(lines.join('\n'));
64
+ return escapeCurlyBraces(stripIndent(lines.join('\n')));
61
65
  }
62
66
 
63
67
  module.exports = function ({ contents, syntax }) {
@@ -0,0 +1,13 @@
1
+ import Modifier from 'ember-modifier';
2
+ import type EmberFreestyleService from '../services/ember-freestyle';
3
+ interface Signature {
4
+ Element: HTMLElement;
5
+ Args: {
6
+ Positional: [highlightJsTheme?: string];
7
+ };
8
+ }
9
+ export default class EnsureFreestyleTheme extends Modifier<Signature> {
10
+ emberFreestyle: EmberFreestyleService;
11
+ modify(_element: HTMLElement, positional: Signature['Args']['Positional']): void;
12
+ }
13
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-freestyle",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Create a living styleguide for your Ember app.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -36,17 +36,16 @@
36
36
  "postpack": "ember ts:clean"
37
37
  },
38
38
  "dependencies": {
39
- "@ember/render-modifiers": "^2.0.4",
40
39
  "@glimmer/component": "^1.1.2",
41
40
  "@glimmer/tracking": "^1.1.2",
42
41
  "ember-auto-import": "^2.4.3",
43
- "ember-cli-babel": "^7.26.11",
44
- "ember-cli-htmlbars": "^6.1.1",
42
+ "ember-cli-babel": "^8.2.0",
43
+ "ember-cli-htmlbars": "^6.3.0",
45
44
  "ember-cli-typescript": "^5.1.1",
46
45
  "ember-focus-trap": "^1.0.1",
47
46
  "ember-modifier": "^3.2.7 || ^4.0.0",
48
47
  "ember-named-blocks-polyfill": "^0.2.5",
49
- "ember-truth-helpers": "^3.1.1",
48
+ "ember-truth-helpers": "^4.0.3",
50
49
  "json-formatter-js": "^2.3.4",
51
50
  "macro-decorators": "^0.1.2",
52
51
  "strip-indent": "^3.0.0",
@@ -57,31 +56,31 @@
57
56
  "@ember/string": "^3.1.1",
58
57
  "@ember/test-helpers": "^3.2.0",
59
58
  "@embroider/test-setup": "^3.0.1",
60
- "@glint/core": "^1.2.0",
61
- "@glint/template": "^1.2.0",
62
- "@glint/environment-ember-loose": "^1.2.0",
59
+ "@glint/core": "^1.4.0",
60
+ "@glint/environment-ember-loose": "^1.4.0",
61
+ "@glint/template": "^1.4.0",
63
62
  "@release-it-plugins/lerna-changelog": "^5.0.0",
64
- "@tsconfig/ember": "^1.0.1",
65
- "@types/ember": "^4.0.1",
63
+ "@tsconfig/ember": "^3.0.1",
64
+ "@types/ember": "^4.0.6",
66
65
  "@types/ember-resolver": "^5.0.11",
67
66
  "@types/ember__application": "^4.0.2",
68
67
  "@types/ember__array": "^4.0.2",
69
- "@types/ember__component": "^4.0.10",
68
+ "@types/ember__component": "^4.0.18",
70
69
  "@types/ember__controller": "^4.0.4",
71
70
  "@types/ember__debug": "^4.0.1",
72
71
  "@types/ember__engine": "^4.0.4",
73
72
  "@types/ember__error": "^4.0.3",
74
73
  "@types/ember__helper": "^4.0.0",
75
- "@types/ember__modifier": "^4.0.2",
76
74
  "@types/ember__object": "^4.0.4",
75
+ "@types/ember__owner": "^4.0.9",
77
76
  "@types/ember__polyfills": "^4.0.0",
78
77
  "@types/ember__routing": "^4.0.10",
79
78
  "@types/ember__runloop": "^4.0.1",
80
79
  "@types/ember__service": "^4.0.0",
81
80
  "@types/ember__string": "^3.0.9",
82
- "@types/ember__template": "^4.0.0",
81
+ "@types/ember__template": "^4.0.7",
83
82
  "@types/ember__test": "^4.0.0",
84
- "@types/ember__utils": "^4.0.1",
83
+ "@types/ember__utils": "^4.0.4",
85
84
  "@types/qunit": "^2.19.3",
86
85
  "@types/remarkable": "^2.0.3",
87
86
  "@types/rsvp": "^4.0.4",
@@ -109,8 +108,8 @@
109
108
  "ember-source": "~4.12.3",
110
109
  "ember-source-channel-url": "^3.0.0",
111
110
  "ember-style-modifier": "^0.8.0",
112
- "ember-template-imports": "^3.3.1",
113
- "ember-template-lint": "^5.11.2",
111
+ "ember-template-imports": "^4.1.2",
112
+ "ember-template-lint": "^6.0.0",
114
113
  "ember-try": "^2.0.0",
115
114
  "eslint": "^8.35.0",
116
115
  "eslint-config-ember": "0.3.0",
@@ -128,24 +127,24 @@
128
127
  "qunit-dom": "^2.0.0",
129
128
  "release-it": "^14.10.0",
130
129
  "remarkable": "^2.0.1",
131
- "sass": "^1.55.0",
132
- "stylelint": "^15.10.1",
130
+ "sass": "^1.68.0",
131
+ "stylelint": "^15.10.3",
133
132
  "stylelint-config-prettier": "^9.0.5",
134
133
  "stylelint-config-recommended-scss": "^13.0.0",
135
134
  "stylelint-prettier": "^4.0.2",
136
135
  "stylelint-scss": "^4.3.0",
137
- "typescript": "^4.9.5",
136
+ "typescript": "^5.5.0",
138
137
  "webpack": "^5.76.0"
139
138
  },
140
139
  "peerDependencies": {
141
140
  "@ember/string": "^3.1.1"
142
141
  },
143
142
  "engines": {
144
- "node": "14.* || >= 16"
143
+ "node": ">= 18"
145
144
  },
146
145
  "volta": {
147
- "node": "16.20.1",
148
- "yarn": "1.22.19"
146
+ "node": "20.14.0",
147
+ "pnpm": "9.2.0"
149
148
  },
150
149
  "publishConfig": {
151
150
  "registry": "https://registry.npmjs.org"
@@ -1,9 +1,8 @@
1
1
  import Service from '@ember/service';
2
- import { TrackedArray } from 'tracked-built-ins';
3
2
  import { Promise } from 'rsvp';
4
3
  export interface Section {
5
4
  name: string;
6
- subsections: TrackedArray<Subsection>;
5
+ subsections: Subsection[];
7
6
  }
8
7
  interface Subsection {
9
8
  name: string;
@@ -13,7 +12,7 @@ export default class EmberFreestyleService extends Service {
13
12
  showNotes: boolean;
14
13
  showCode: boolean;
15
14
  showApi: boolean;
16
- menu: TrackedArray<Section> | null;
15
+ menu: Section[];
17
16
  showMenu: boolean;
18
17
  allowRenderingAllSections: boolean;
19
18
  defaultTheme: string;
@@ -34,6 +33,7 @@ export default class EmberFreestyleService extends Service {
34
33
  ensureHljsTheme(theme: string): void;
35
34
  ensureHljsLanguage(language: string): Promise<void>;
36
35
  registerSection(sectionName: string, subsectionName?: string): void;
36
+ notifyMenuChanged: () => void;
37
37
  }
38
38
  declare module '@ember/service' {
39
39
  interface Registry {
@@ -1,82 +1,102 @@
1
- import type FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
2
- import type FreestyleUsageArgument from 'ember-freestyle/components/freestyle/usage/argument';
3
- import type FreestyleUsageArray from 'ember-freestyle/components/freestyle/usage/array';
4
- import type FreestyleUsageBasicCssVariable from 'ember-freestyle/components/freestyle/usage/basic-css-variable';
5
- import type FreestyleUsageBool from 'ember-freestyle/components/freestyle/usage/bool';
6
- import type FreestyleUsageBoolControl from 'ember-freestyle/components/freestyle/usage/bool/control';
7
- import type FreestyleUsageNumber from 'ember-freestyle/components/freestyle/usage/number';
8
- import type FreestyleUsageNumberControl from 'ember-freestyle/components/freestyle/usage/number/control';
9
- import type FreestyleUsageObject from 'ember-freestyle/components/freestyle/usage/object';
10
- import type FreestyleUsageObjectControl from 'ember-freestyle/components/freestyle/usage/object/control';
11
- import type FreestyleUsageString from 'ember-freestyle/components/freestyle/usage/string';
12
- import type FreestyleUsageStringControl from 'ember-freestyle/components/freestyle/usage/string/control';
13
- import type FreestyleUsageComponentLike from 'ember-freestyle/components/freestyle/usage/component-like';
14
- import type FreestyleUsageComponentLikeControl from 'ember-freestyle/components/freestyle/usage/component-like/control';
15
1
  import type FreestyleAnnotation from 'ember-freestyle/components/freestyle-annotation';
16
2
  import type FreestyleCollection from 'ember-freestyle/components/freestyle-collection';
17
- import type FreestyleDynamic from 'ember-freestyle/components/freestyle-dynamic';
18
- import type FreestyleDynamicInput from 'ember-freestyle/components/freestyle-dynamic-input';
19
3
  import type FreestyleDynamicInputSelectOption from 'ember-freestyle/components/freestyle-dynamic-input-select-option';
4
+ import type FreestyleDynamicInput from 'ember-freestyle/components/freestyle-dynamic-input';
5
+ import type FreestyleDynamic from 'ember-freestyle/components/freestyle-dynamic';
20
6
  import type FreestyleFocusButton from 'ember-freestyle/components/freestyle-focus-button';
21
7
  import type FreestyleGuide from 'ember-freestyle/components/freestyle-guide';
22
8
  import type FreestyleMenu from 'ember-freestyle/components/freestyle-menu';
23
- import type FreestylePalette from 'ember-freestyle/components/freestyle-palette';
24
9
  import type FreestylePaletteItem from 'ember-freestyle/components/freestyle-palette-item';
10
+ import type FreestylePalette from 'ember-freestyle/components/freestyle-palette';
25
11
  import type FreestyleSection from 'ember-freestyle/components/freestyle-section';
26
12
  import type FreestyleSource from 'ember-freestyle/components/freestyle-source';
27
13
  import type FreestyleSubsection from 'ember-freestyle/components/freestyle-subsection';
28
14
  import type FreestyleTypeface from 'ember-freestyle/components/freestyle-typeface';
29
- import type OldFreestyleUsage from 'ember-freestyle/components/freestyle-usage';
30
15
  import type FreestyleUsageControls from 'ember-freestyle/components/freestyle-usage-controls';
31
- import type FreestyleVariant from 'ember-freestyle/components/freestyle-variant';
16
+ import type FreestyleUsageLegacy from 'ember-freestyle/components/freestyle-usage';
32
17
  import type FreestyleVariantList from 'ember-freestyle/components/freestyle-variant-list';
33
- import FreestyleHighlight from './modifiers/freestyle-highlight';
34
-
35
- declare module '@glint/environment-ember-loose/registry' {
36
- export default interface Registry {
37
- 'Freestyle::Usage': typeof FreestyleUsage;
38
- 'Freestyle::Usage::Argument': typeof FreestyleUsageArgument;
39
- 'freestyle/usage/argument': typeof FreestyleUsageArgument;
40
- 'Freestyle::Usage::Array': typeof FreestyleUsageArray;
41
- 'freestyle/usage/array': typeof FreestyleUsageArray;
42
- 'Freestyle::Usage::Bool': typeof FreestyleUsageBool;
43
- 'freestyle/usage/bool': typeof FreestyleUsageBool;
44
- 'Freestyle::Usage::Bool::Control': typeof FreestyleUsageBoolControl;
45
- 'Freestyle::Usage::Number': typeof FreestyleUsageNumber;
46
- 'Freestyle::Usage::BasicCssVariable': typeof FreestyleUsageBasicCssVariable;
47
- 'freestyle/usage/basic-css-variable': typeof FreestyleUsageBasicCssVariable;
48
- 'freestyle/usage/number': typeof FreestyleUsageNumber;
49
- 'Freestyle::Usage::Number::Control': typeof FreestyleUsageNumberControl;
50
- 'Freestyle::Usage::Object': typeof FreestyleUsageObject;
51
- 'Freestyle::Usage::Object::Control': typeof FreestyleUsageObjectControl;
52
- 'freestyle/usage/object': typeof FreestyleUsageObject;
53
- 'Freestyle::Usage::String': typeof FreestyleUsageString;
54
- 'freestyle/usage/string': typeof FreestyleUsageString;
55
- 'Freestyle::Usage::String::Control': typeof FreestyleUsageStringControl;
56
- 'Freestyle::Usage::ComponentLike': typeof FreestyleUsageComponentLike;
57
- 'freestyle/usage/component-like': typeof FreestyleUsageComponentLike;
58
- 'Freestyle::Usage::ComponentLike::Control': typeof FreestyleUsageComponentLikeControl;
18
+ import type FreestyleVariant from 'ember-freestyle/components/freestyle-variant';
19
+ import type FreestyleUsageArgument from 'ember-freestyle/components/freestyle/usage/argument';
20
+ import type FreestyleUsageArray from 'ember-freestyle/components/freestyle/usage/array';
21
+ import type FreestyleUsageBasicCssVariable from 'ember-freestyle/components/freestyle/usage/basic-css-variable';
22
+ import type FreestyleUsageBoolControl from 'ember-freestyle/components/freestyle/usage/bool/control';
23
+ import type FreestyleUsageBool from 'ember-freestyle/components/freestyle/usage/bool';
24
+ import type FreestyleUsageComponentLikeControl from 'ember-freestyle/components/freestyle/usage/component-like/control';
25
+ import type FreestyleUsageComponentLike from 'ember-freestyle/components/freestyle/usage/component-like';
26
+ import type FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
27
+ import type FreestyleUsageNumberControl from 'ember-freestyle/components/freestyle/usage/number/control';
28
+ import type FreestyleUsageNumber from 'ember-freestyle/components/freestyle/usage/number';
29
+ import type FreestyleUsageObjectControl from 'ember-freestyle/components/freestyle/usage/object/control';
30
+ import type FreestyleUsageObject from 'ember-freestyle/components/freestyle/usage/object';
31
+ import type FreestyleUsageStringControl from 'ember-freestyle/components/freestyle/usage/string/control';
32
+ import type FreestyleUsageString from 'ember-freestyle/components/freestyle/usage/string';
33
+ import type FreestyleHighlight from 'ember-freestyle/modifiers/freestyle-highlight';
34
+ import EnsureFreestyleTheme from './modifiers/ensure-freestyle-theme';
35
+ export default interface EmberFreestyleRegistry {
36
+ 'freestyle-annotation': typeof FreestyleAnnotation;
59
37
  FreestyleAnnotation: typeof FreestyleAnnotation;
38
+ 'freestyle-collection': typeof FreestyleCollection;
60
39
  FreestyleCollection: typeof FreestyleCollection;
61
- FreestyleDynamic: typeof FreestyleDynamic;
62
- FreestyleDynamicInput: typeof FreestyleDynamicInput;
40
+ 'freestyle-dynamic-input-select-option': typeof FreestyleDynamicInputSelectOption;
63
41
  FreestyleDynamicInputSelectOption: typeof FreestyleDynamicInputSelectOption;
42
+ 'freestyle-dynamic-input': typeof FreestyleDynamicInput;
43
+ FreestyleDynamicInput: typeof FreestyleDynamicInput;
44
+ 'freestyle-dynamic': typeof FreestyleDynamic;
45
+ FreestyleDynamic: typeof FreestyleDynamic;
46
+ 'freestyle-focus-button': typeof FreestyleFocusButton;
64
47
  FreestyleFocusButton: typeof FreestyleFocusButton;
48
+ 'freestyle-guide': typeof FreestyleGuide;
65
49
  FreestyleGuide: typeof FreestyleGuide;
50
+ 'freestyle-menu': typeof FreestyleMenu;
66
51
  FreestyleMenu: typeof FreestyleMenu;
67
- FreestylePalette: typeof FreestylePalette;
52
+ 'freestyle-palette-item': typeof FreestylePaletteItem;
68
53
  FreestylePaletteItem: typeof FreestylePaletteItem;
54
+ 'freestyle-palette': typeof FreestylePalette;
55
+ FreestylePalette: typeof FreestylePalette;
56
+ 'freestyle-section': typeof FreestyleSection;
69
57
  FreestyleSection: typeof FreestyleSection;
58
+ 'freestyle-source': typeof FreestyleSource;
70
59
  FreestyleSource: typeof FreestyleSource;
71
- FreestyleSubsection: typeof FreestyleSubsection;
72
60
  'freestyle-subsection': typeof FreestyleSubsection;
61
+ FreestyleSubsection: typeof FreestyleSubsection;
62
+ 'freestyle-typeface': typeof FreestyleTypeface;
73
63
  FreestyleTypeface: typeof FreestyleTypeface;
74
- FreestyleUsage: typeof OldFreestyleUsage;
64
+ 'freestyle-usage-controls': typeof FreestyleUsageControls;
75
65
  FreestyleUsageControls: typeof FreestyleUsageControls;
76
- FreestyleVariant: typeof FreestyleVariant;
77
- 'freestyle-variant': typeof FreestyleVariant;
78
- FreestyleVariantList: typeof FreestyleVariantList;
66
+ 'freestyle-usage': typeof FreestyleUsageLegacy;
67
+ FreestyleUsage: typeof FreestyleUsageLegacy;
79
68
  'freestyle-variant-list': typeof FreestyleVariantList;
69
+ FreestyleVariantList: typeof FreestyleVariantList;
70
+ 'freestyle-variant': typeof FreestyleVariant;
71
+ FreestyleVariant: typeof FreestyleVariant;
72
+ 'freestyle/usage/argument': typeof FreestyleUsageArgument;
73
+ 'Freestyle::Usage::Argument': typeof FreestyleUsageArgument;
74
+ 'freestyle/usage/array': typeof FreestyleUsageArray;
75
+ 'Freestyle::Usage::Array': typeof FreestyleUsageArray;
76
+ 'freestyle/usage/basic-css-variable': typeof FreestyleUsageBasicCssVariable;
77
+ 'Freestyle::Usage::BasicCssVariable': typeof FreestyleUsageBasicCssVariable;
78
+ 'freestyle/usage/bool/control': typeof FreestyleUsageBoolControl;
79
+ 'Freestyle::Usage::Bool::Control': typeof FreestyleUsageBoolControl;
80
+ 'freestyle/usage/bool': typeof FreestyleUsageBool;
81
+ 'Freestyle::Usage::Bool': typeof FreestyleUsageBool;
82
+ 'freestyle/usage/component-like/control': typeof FreestyleUsageComponentLikeControl;
83
+ 'Freestyle::Usage::ComponentLike::Control': typeof FreestyleUsageComponentLikeControl;
84
+ 'freestyle/usage/component-like': typeof FreestyleUsageComponentLike;
85
+ 'Freestyle::Usage::ComponentLike': typeof FreestyleUsageComponentLike;
86
+ 'freestyle/usage': typeof FreestyleUsage;
87
+ 'Freestyle::Usage': typeof FreestyleUsage;
88
+ 'freestyle/usage/number/control': typeof FreestyleUsageNumberControl;
89
+ 'Freestyle::Usage::Number::Control': typeof FreestyleUsageNumberControl;
90
+ 'freestyle/usage/number': typeof FreestyleUsageNumber;
91
+ 'Freestyle::Usage::Number': typeof FreestyleUsageNumber;
92
+ 'freestyle/usage/object/control': typeof FreestyleUsageObjectControl;
93
+ 'Freestyle::Usage::Object::Control': typeof FreestyleUsageObjectControl;
94
+ 'freestyle/usage/object': typeof FreestyleUsageObject;
95
+ 'Freestyle::Usage::Object': typeof FreestyleUsageObject;
96
+ 'freestyle/usage/string/control': typeof FreestyleUsageStringControl;
97
+ 'Freestyle::Usage::String::Control': typeof FreestyleUsageStringControl;
98
+ 'freestyle/usage/string': typeof FreestyleUsageString;
99
+ 'Freestyle::Usage::String': typeof FreestyleUsageString;
80
100
  'freestyle-highlight': typeof FreestyleHighlight;
81
- }
101
+ 'ensure-freestyle-theme': typeof EnsureFreestyleTheme;
82
102
  }
@@ -7,11 +7,8 @@ import { Falsy, UnsetValue } from './-private/shared';
7
7
  // and objects with an `isTruthy` method. In these cases, we just won't
8
8
  // narrow as much as we potentially could.
9
9
 
10
- type AndPair<A, B> = Falsy<A> extends true
11
- ? A
12
- : B extends UnsetValue
13
- ? A
14
- : A | B;
10
+ type AndPair<A, B> =
11
+ Falsy<A> extends true ? A : B extends UnsetValue ? A : A | B;
15
12
 
16
13
  interface AndHelperSignature<A, B, C, D, E> {
17
14
  Args: { Positional: [A, B?, C?, D?, E?] };
@@ -10,10 +10,10 @@ import { Falsy, Maybe, UnsetValue } from './-private/shared';
10
10
  type OrPair<A, B> = B extends UnsetValue
11
11
  ? A
12
12
  : Maybe<A> extends true
13
- ? NonNullable<A> | B
14
- : Falsy<A> extends true
15
- ? B
16
- : A | B;
13
+ ? NonNullable<A> | B
14
+ : Falsy<A> extends true
15
+ ? B
16
+ : A | B;
17
17
 
18
18
  interface OrHelperSignature<A, B, C, D, E> {
19
19
  Args: { Positional: [A, B?, C?, D?, E?] };
package/types/global.d.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  import '@glint/environment-ember-loose';
2
2
 
3
+ import type FreestyleRegistry from 'ember-freestyle/template-registry';
4
+
3
5
  import AndHelper from 'ember-truth-helpers/helpers/and';
4
6
  import EqHelper from 'ember-truth-helpers/helpers/eq';
5
7
  import NotHelper from 'ember-truth-helpers/helpers/not';
6
8
  import { HelperLike, ModifierLike } from '@glint/template';
7
- import { SafeString } from '@ember/template/-private/handlebars';
9
+ import { type SafeString } from '@ember/template';
8
10
 
9
11
  declare module '@glint/environment-ember-loose/registry' {
10
- export default interface Registry {
12
+ export default interface Registry extends FreestyleRegistry {
11
13
  and: typeof AndHelper;
12
14
  eq: typeof EqHelper;
13
15
  not: typeof NotHelper;
@@ -307,7 +307,6 @@ END-FREESTYLE-USAGE */
307
307
  margin: 0 1rem;
308
308
  max-width: calc(1200px - 1rem);
309
309
  padding: 1rem 0 0.4rem;
310
- text-transform: uppercase;
311
310
  }
312
311
  .FreestyleSection--hidden {
313
312
  display: none;
@@ -320,7 +319,6 @@ END-FREESTYLE-USAGE */
320
319
  font-size: 1.3rem;
321
320
  margin: 0 1rem;
322
321
  padding: 0.8rem 0 0.4rem;
323
- text-transform: uppercase;
324
322
  }
325
323
 
326
324
  .FreestyleMenu {
@@ -329,19 +327,24 @@ END-FREESTYLE-USAGE */
329
327
  padding-left: 1rem;
330
328
  }
331
329
  .FreestyleMenu-item, .FreestyleMenu-submenuItem {
332
- padding-top: 0.6rem;
333
- text-transform: uppercase;
330
+ padding-top: 0.1rem;
334
331
  }
335
332
  .FreestyleMenu-itemLink, .FreestyleMenu-submenuItemLink {
333
+ border-radius: 6px;
336
334
  color: #212121;
335
+ display: block;
336
+ padding: 0.3rem 0.3rem 0.3rem 0.5rem;
337
337
  text-decoration: none;
338
338
  }
339
339
  .FreestyleMenu-itemLink.active, .FreestyleMenu-submenuItemLink.active {
340
- color: #00bcd4;
340
+ background-color: #00bcd4;
341
+ color: white;
341
342
  text-decoration: none;
343
+ font-weight: bold;
342
344
  }
343
345
  .FreestyleMenu-itemLink:hover, .FreestyleMenu-submenuItemLink:hover {
344
- color: #ffc107;
346
+ background-color: #00bcd4;
347
+ color: white;
345
348
  text-decoration: none;
346
349
  }
347
350
  .FreestyleMenu-submenu {
package/glint.d.ts DELETED
@@ -1,81 +0,0 @@
1
- import type FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
2
- import type FreestyleUsageArgument from 'ember-freestyle/components/freestyle/usage/argument';
3
- import type FreestyleUsageArray from 'ember-freestyle/components/freestyle/usage/array';
4
- import type FreestyleUsageBasicCssVariable from 'ember-freestyle/components/freestyle/usage/basic-css-variable';
5
- import type FreestyleUsageBool from 'ember-freestyle/components/freestyle/usage/bool';
6
- import type FreestyleUsageBoolControl from 'ember-freestyle/components/freestyle/usage/bool/control';
7
- import type FreestyleUsageNumber from 'ember-freestyle/components/freestyle/usage/number';
8
- import type FreestyleUsageNumberControl from 'ember-freestyle/components/freestyle/usage/number/control';
9
- import type FreestyleUsageObject from 'ember-freestyle/components/freestyle/usage/object';
10
- import type FreestyleUsageObjectControl from 'ember-freestyle/components/freestyle/usage/object/control';
11
- import type FreestyleUsageString from 'ember-freestyle/components/freestyle/usage/string';
12
- import type FreestyleUsageStringControl from 'ember-freestyle/components/freestyle/usage/string/control';
13
- import type FreestyleUsageComponentLike from 'ember-freestyle/components/freestyle/usage/component-like';
14
- import type FreestyleUsageComponentLikeControl from 'ember-freestyle/components/freestyle/usage/component-like/control';
15
- import type FreestyleAnnotation from 'ember-freestyle/components/freestyle-annotation';
16
- import type FreestyleCollection from 'ember-freestyle/components/freestyle-collection';
17
- import type FreestyleDynamic from 'ember-freestyle/components/freestyle-dynamic';
18
- import type FreestyleDynamicInput from 'ember-freestyle/components/freestyle-dynamic-input';
19
- import type FreestyleDynamicInputSelectOption from 'ember-freestyle/components/freestyle-dynamic-input-select-option';
20
- import type FreestyleFocusButton from 'ember-freestyle/components/freestyle-focus-button';
21
- import type FreestyleGuide from 'ember-freestyle/components/freestyle-guide';
22
- import type FreestyleMenu from 'ember-freestyle/components/freestyle-menu';
23
- import type FreestylePalette from 'ember-freestyle/components/freestyle-palette';
24
- import type FreestylePaletteItem from 'ember-freestyle/components/freestyle-palette-item';
25
- import type FreestyleSection from 'ember-freestyle/components/freestyle-section';
26
- import type FreestyleSource from 'ember-freestyle/components/freestyle-source';
27
- import type FreestyleSubsection from 'ember-freestyle/components/freestyle-subsection';
28
- import type FreestyleTypeface from 'ember-freestyle/components/freestyle-typeface';
29
- import type OldFreestyleUsage from 'ember-freestyle/components/freestyle-usage';
30
- import type FreestyleUsageControls from 'ember-freestyle/components/freestyle-usage-controls';
31
- import type FreestyleVariant from 'ember-freestyle/components/freestyle-variant';
32
- import type FreestyleVariantList from 'ember-freestyle/components/freestyle-variant-list';
33
- import FreestyleHighlight from './modifiers/freestyle-highlight';
34
- declare module '@glint/environment-ember-loose/registry' {
35
- export default interface Registry {
36
- 'Freestyle::Usage': typeof FreestyleUsage;
37
- 'Freestyle::Usage::Argument': typeof FreestyleUsageArgument;
38
- 'freestyle/usage/argument': typeof FreestyleUsageArgument;
39
- 'Freestyle::Usage::Array': typeof FreestyleUsageArray;
40
- 'freestyle/usage/array': typeof FreestyleUsageArray;
41
- 'Freestyle::Usage::Bool': typeof FreestyleUsageBool;
42
- 'freestyle/usage/bool': typeof FreestyleUsageBool;
43
- 'Freestyle::Usage::Bool::Control': typeof FreestyleUsageBoolControl;
44
- 'Freestyle::Usage::Number': typeof FreestyleUsageNumber;
45
- 'Freestyle::Usage::BasicCssVariable': typeof FreestyleUsageBasicCssVariable;
46
- 'freestyle/usage/basic-css-variable': typeof FreestyleUsageBasicCssVariable;
47
- 'freestyle/usage/number': typeof FreestyleUsageNumber;
48
- 'Freestyle::Usage::Number::Control': typeof FreestyleUsageNumberControl;
49
- 'Freestyle::Usage::Object': typeof FreestyleUsageObject;
50
- 'Freestyle::Usage::Object::Control': typeof FreestyleUsageObjectControl;
51
- 'freestyle/usage/object': typeof FreestyleUsageObject;
52
- 'Freestyle::Usage::String': typeof FreestyleUsageString;
53
- 'freestyle/usage/string': typeof FreestyleUsageString;
54
- 'Freestyle::Usage::String::Control': typeof FreestyleUsageStringControl;
55
- 'Freestyle::Usage::ComponentLike': typeof FreestyleUsageComponentLike;
56
- 'freestyle/usage/component-like': typeof FreestyleUsageComponentLike;
57
- 'Freestyle::Usage::ComponentLike::Control': typeof FreestyleUsageComponentLikeControl;
58
- FreestyleAnnotation: typeof FreestyleAnnotation;
59
- FreestyleCollection: typeof FreestyleCollection;
60
- FreestyleDynamic: typeof FreestyleDynamic;
61
- FreestyleDynamicInput: typeof FreestyleDynamicInput;
62
- FreestyleDynamicInputSelectOption: typeof FreestyleDynamicInputSelectOption;
63
- FreestyleFocusButton: typeof FreestyleFocusButton;
64
- FreestyleGuide: typeof FreestyleGuide;
65
- FreestyleMenu: typeof FreestyleMenu;
66
- FreestylePalette: typeof FreestylePalette;
67
- FreestylePaletteItem: typeof FreestylePaletteItem;
68
- FreestyleSection: typeof FreestyleSection;
69
- FreestyleSource: typeof FreestyleSource;
70
- FreestyleSubsection: typeof FreestyleSubsection;
71
- 'freestyle-subsection': typeof FreestyleSubsection;
72
- FreestyleTypeface: typeof FreestyleTypeface;
73
- FreestyleUsage: typeof OldFreestyleUsage;
74
- FreestyleUsageControls: typeof FreestyleUsageControls;
75
- FreestyleVariant: typeof FreestyleVariant;
76
- 'freestyle-variant': typeof FreestyleVariant;
77
- FreestyleVariantList: typeof FreestyleVariantList;
78
- 'freestyle-variant-list': typeof FreestyleVariantList;
79
- 'freestyle-highlight': typeof FreestyleHighlight;
80
- }
81
- }