frontile 0.18.11 → 0.18.13
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/declarations/components/buttons/button-group.d.ts +1 -1
- package/declarations/components/buttons/button-group.d.ts.map +1 -1
- package/declarations/components/buttons/button.d.ts +4 -2
- package/declarations/components/buttons/button.d.ts.map +1 -1
- package/declarations/components/buttons/chip.d.ts +4 -3
- package/declarations/components/buttons/chip.d.ts.map +1 -1
- package/declarations/components/buttons/icon-button.d.ts +50 -0
- package/declarations/components/buttons/icon-button.d.ts.map +1 -0
- package/declarations/components/buttons/index.d.ts +1 -0
- package/declarations/components/buttons/index.d.ts.map +1 -1
- package/declarations/components/buttons/toggle-button.d.ts +1 -1
- package/declarations/components/buttons/toggle-button.d.ts.map +1 -1
- package/declarations/components/forms/select/types.d.ts +1 -1
- package/declarations/components/layout/app-layout.d.ts +53 -5
- package/declarations/components/layout/app-layout.d.ts.map +1 -1
- package/declarations/components/layout/aside.d.ts +79 -0
- package/declarations/components/layout/aside.d.ts.map +1 -1
- package/declarations/components/layout/context.d.ts +12 -4
- package/declarations/components/layout/context.d.ts.map +1 -1
- package/declarations/components/layout/in-layout-region.d.ts +38 -0
- package/declarations/components/layout/in-layout-region.d.ts.map +1 -0
- package/declarations/components/layout/index.d.ts +2 -0
- package/declarations/components/layout/index.d.ts.map +1 -1
- package/declarations/components/layout/navbar.d.ts +43 -0
- package/declarations/components/layout/navbar.d.ts.map +1 -1
- package/declarations/components/layout/region.d.ts +60 -0
- package/declarations/components/layout/region.d.ts.map +1 -0
- package/declarations/components/layout/sidebar.d.ts +43 -0
- package/declarations/components/layout/sidebar.d.ts.map +1 -1
- package/declarations/components/overlays/tooltip.d.ts +1 -1
- package/declarations/components/status/badge.d.ts +8 -7
- package/declarations/components/status/badge.d.ts.map +1 -1
- package/declarations/components/utilities/card.d.ts +94 -0
- package/declarations/components/utilities/card.d.ts.map +1 -0
- package/declarations/components/utilities/icon.d.ts +57 -0
- package/declarations/components/utilities/icon.d.ts.map +1 -0
- package/declarations/components/utilities/index.d.ts +2 -0
- package/declarations/components/utilities/index.d.ts.map +1 -1
- package/declarations/services/frontile-layout-regions.d.ts +69 -0
- package/declarations/services/frontile-layout-regions.d.ts.map +1 -0
- package/dist/_app_/services/frontile-layout-regions.js +1 -0
- package/dist/buttons.js +1 -0
- package/dist/buttons.js.map +1 -1
- package/dist/components/buttons/button.js.map +1 -1
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/buttons/icon-button.js +33 -0
- package/dist/components/buttons/icon-button.js.map +1 -0
- package/dist/components/buttons/index.js +1 -0
- package/dist/components/buttons/index.js.map +1 -1
- package/dist/components/forms/select/select.js +1 -1
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/layout/app-layout.js +11 -3
- package/dist/components/layout/app-layout.js.map +1 -1
- package/dist/components/layout/aside.js +56 -2
- package/dist/components/layout/aside.js.map +1 -1
- package/dist/components/layout/context.js.map +1 -1
- package/dist/components/layout/in-layout-region.js +42 -0
- package/dist/components/layout/in-layout-region.js.map +1 -0
- package/dist/components/layout/index.js +2 -0
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/region.js +51 -0
- package/dist/components/layout/region.js.map +1 -0
- package/dist/components/overlays/tooltip.js.map +1 -1
- package/dist/components/status/badge.js.map +1 -1
- package/dist/components/utilities/card.js +38 -0
- package/dist/components/utilities/card.js.map +1 -0
- package/dist/components/utilities/icon.js +33 -0
- package/dist/components/utilities/icon.js.map +1 -0
- package/dist/components/utilities/index.js +2 -0
- package/dist/components/utilities/index.js.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/layout.js +2 -0
- package/dist/layout.js.map +1 -1
- package/dist/services/frontile-layout-regions.js +149 -0
- package/dist/services/frontile-layout-regions.js.map +1 -0
- package/dist/utilities.js +2 -0
- package/dist/utilities.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { useStyles } from '@frontile/theme';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
class Icon extends Component {
|
|
7
|
+
// A plain icon takes the surrounding text color, unless it is inverse: an
|
|
8
|
+
// inherited color cannot be inverted, so it becomes neutral.
|
|
9
|
+
defaultColor(variant) {
|
|
10
|
+
return variant === 'plain' && !this.args.inverse ? undefined : 'neutral';
|
|
11
|
+
}
|
|
12
|
+
get classNames() {
|
|
13
|
+
const {
|
|
14
|
+
icon
|
|
15
|
+
} = useStyles();
|
|
16
|
+
const variant = this.args.variant ?? 'plain';
|
|
17
|
+
return icon({
|
|
18
|
+
size: this.args.size,
|
|
19
|
+
variant,
|
|
20
|
+
color: this.args.color ?? this.defaultColor(variant),
|
|
21
|
+
inverse: this.args.inverse,
|
|
22
|
+
class: this.args.classes?.base
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
static {
|
|
26
|
+
setComponentTemplate(precompileTemplate("<span class={{this.classNames}} role={{if @label \"img\"}} aria-label={{@label}} aria-hidden={{unless @label \"true\"}} ...attributes>{{yield}}</span>", {
|
|
27
|
+
strictMode: true
|
|
28
|
+
}), this);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Icon, Icon as default };
|
|
33
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","sources":["../../../src/components/utilities/icon.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, type IconVariants } from '@frontile/theme';\n\nexport interface IconSignature {\n Args: {\n /**\n * The size of the circle. The icon inside scales with it.\n *\n * @defaultValue 'md'\n */\n size?: IconVariants['size'];\n\n /**\n * The color role. A `plain` icon without a color takes the color of the\n * surrounding text; every other variant defaults to `neutral`.\n */\n color?: IconVariants['color'];\n\n /**\n * How the circle is drawn. `plain` has no circle, only the icon. `solid`,\n * `soft` and `subtle` fill it at decreasing strength, and `outline` draws\n * a ring. A plain icon's box is tighter than the circle of the other\n * variants at the same size.\n *\n * @defaultValue 'plain'\n */\n variant?: IconVariants['variant'];\n\n /**\n * Draws the icon, its fill and its ring in the opposite light or dark\n * scheme, for an icon on a surface of the other scheme. An inverse plain\n * icon with no `@color` is neutral.\n *\n * @defaultValue false\n */\n inverse?: boolean;\n\n /**\n * The accessible name. Without it the icon is decorative and hidden from\n * screen readers; set it when the icon carries meaning on its own.\n */\n label?: string;\n\n /**\n * Custom classes for the root element, merged over the defaults.\n */\n classes?: { base?: string };\n };\n Blocks: {\n /** The icon, for example an inline `<svg>` or a `FaIcon`. */\n default: [];\n };\n Element: HTMLSpanElement;\n}\n\nclass Icon extends Component<IconSignature> {\n // A plain icon takes the surrounding text color, unless it is inverse: an\n // inherited color cannot be inverted, so it becomes neutral.\n defaultColor(variant: string): 'neutral' | undefined {\n return variant === 'plain' && !this.args.inverse ? undefined : 'neutral';\n }\n\n get classNames(): string {\n const { icon } = useStyles();\n const variant = this.args.variant ?? 'plain';\n\n return icon({\n size: this.args.size,\n variant,\n color: this.args.color ?? this.defaultColor(variant),\n inverse: this.args.inverse,\n class: this.args.classes?.base\n });\n }\n\n <template>\n <span\n class={{this.classNames}}\n role={{if @label \"img\"}}\n aria-label={{@label}}\n aria-hidden={{unless @label \"true\"}}\n ...attributes\n >{{yield}}</span>\n </template>\n}\n\nexport { Icon };\nexport default Icon;\n"],"names":["Icon","Component","defaultColor","variant","args","inverse","undefined","classNames","icon","useStyles","size","color","class","classes","base","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AAuDA,MAAMA,aAAaC,SAAA,CAAU;AAC3B;AACA;EACAC,YAAAA,CAAaC,OAAe,EAAyB;AACnD,IAAA,OAAOA,OAAA,KAAY,WAAW,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO,GAAGC,SAAA,GAAY,SAAA;AACjE,EAAA;EAEA,IAAIC,UAAAA,GAAqB;IACvB,MAAM;AAAEC,MAAAA;KAAM,GAAGC,SAAA,EAAA;IACjB,MAAMN,UAAU,IAAI,CAACC,IAAI,CAACD,OAAO,IAAI,OAAA;AAErC,IAAA,OAAOK,IAAA,CAAK;AACVE,MAAAA,IAAA,EAAM,IAAI,CAACN,IAAI,CAACM,IAAI;MACpBP,OAAA;AACAQ,MAAAA,KAAA,EAAO,IAAI,CAACP,IAAI,CAACO,KAAK,IAAI,IAAI,CAACT,YAAY,CAACC,OAAA,CAAA;AAC5CE,MAAAA,OAAA,EAAS,IAAI,CAACD,IAAI,CAACC,OAAO;AAC1BO,MAAAA,KAAA,EAAO,IAAI,CAACR,IAAI,CAACS,OAAO,EAAEC;AAC5B,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,wJAAA,EAQA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import 'focus-visible/dist/focus-visible.js';
|
|
2
2
|
export { Avatar } from './avatar.js';
|
|
3
|
+
export { Icon } from './icon.js';
|
|
3
4
|
export { VisuallyHidden } from './visually-hidden.js';
|
|
4
5
|
export { Collapsible } from './collapsible.js';
|
|
5
6
|
export { Divider } from './divider.js';
|
|
7
|
+
export { Card } from './card.js';
|
|
6
8
|
export { Kbd } from './kbd.js';
|
|
7
9
|
export { isApplePlatform, parseKeys, resolveKbdPlatform, setKbdPlatform } from '../../utils/keys.js';
|
|
8
10
|
export { Skeleton } from './skeleton.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Button } from './components/buttons/button.js';
|
|
2
2
|
export { CloseButton } from './components/buttons/close-button.js';
|
|
3
|
+
export { IconButton } from './components/buttons/icon-button.js';
|
|
3
4
|
export { ToggleButton } from './components/buttons/toggle-button.js';
|
|
4
5
|
export { ButtonGroup } from './components/buttons/button-group.js';
|
|
5
6
|
export { Chip } from './components/buttons/chip.js';
|
|
@@ -58,9 +59,11 @@ export { Badge } from './components/status/badge.js';
|
|
|
58
59
|
export { ProgressBar } from './components/status/progress-bar.js';
|
|
59
60
|
import 'focus-visible/dist/focus-visible.js';
|
|
60
61
|
export { Avatar } from './components/utilities/avatar.js';
|
|
62
|
+
export { Icon } from './components/utilities/icon.js';
|
|
61
63
|
export { VisuallyHidden } from './components/utilities/visually-hidden.js';
|
|
62
64
|
export { Collapsible } from './components/utilities/collapsible.js';
|
|
63
65
|
export { Divider } from './components/utilities/divider.js';
|
|
66
|
+
export { Card } from './components/utilities/card.js';
|
|
64
67
|
export { Kbd } from './components/utilities/kbd.js';
|
|
65
68
|
export { isApplePlatform, parseKeys, resolveKbdPlatform, setKbdPlatform } from './utils/keys.js';
|
|
66
69
|
export { Skeleton } from './components/utilities/skeleton.js';
|
|
@@ -105,6 +108,8 @@ export { PageHeader } from './components/layout/page-header.js';
|
|
|
105
108
|
export { Sidebar } from './components/layout/sidebar.js';
|
|
106
109
|
export { SidebarGroup } from './components/layout/sidebar-group.js';
|
|
107
110
|
export { SidebarToggle } from './components/layout/sidebar-toggle.js';
|
|
111
|
+
export { Region } from './components/layout/region.js';
|
|
112
|
+
export { InLayoutRegion } from './components/layout/in-layout-region.js';
|
|
108
113
|
export { ListboxGroup } from './components/collections/listbox/group.js';
|
|
109
114
|
export { ListboxItem } from './components/collections/listbox/item.js';
|
|
110
115
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/layout.js
CHANGED
|
@@ -11,4 +11,6 @@ export { PageHeader } from './components/layout/page-header.js';
|
|
|
11
11
|
export { Sidebar } from './components/layout/sidebar.js';
|
|
12
12
|
export { SidebarGroup } from './components/layout/sidebar-group.js';
|
|
13
13
|
export { SidebarToggle } from './components/layout/sidebar-toggle.js';
|
|
14
|
+
export { Region } from './components/layout/region.js';
|
|
15
|
+
export { InLayoutRegion } from './components/layout/in-layout-region.js';
|
|
14
16
|
//# sourceMappingURL=layout.js.map
|
package/dist/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import Service from '@ember/service';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { schedule } from '@ember/runloop';
|
|
4
|
+
import { warn } from '@ember/debug';
|
|
5
|
+
import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../runtime--fcdnjmJ-DOFHQ2m8.js';
|
|
6
|
+
|
|
7
|
+
/** One named region: where it renders (the target) and who fills it. */
|
|
8
|
+
class LayoutRegionState {
|
|
9
|
+
static {
|
|
10
|
+
decorateFieldV2(this.prototype, "targets", [tracked], function () {
|
|
11
|
+
return [];
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
#targets = (initializeDeferredDecorator(this, "targets"), void 0);
|
|
15
|
+
/**
|
|
16
|
+
* Mounted targets in registration order. The newest is the one sources
|
|
17
|
+
* render into; when it goes away, the previous one takes over again.
|
|
18
|
+
* Reassigned, never mutated.
|
|
19
|
+
*/
|
|
20
|
+
static {
|
|
21
|
+
decorateFieldV2(this.prototype, "sources", [tracked], function () {
|
|
22
|
+
return [];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
#sources = (initializeDeferredDecorator(this, "sources"), void 0);
|
|
26
|
+
/** Sources in registration (render) order. Reassigned, never mutated. */
|
|
27
|
+
get hasContent() {
|
|
28
|
+
return this.sources.length > 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The target sources render into: the newest mounted one. */
|
|
32
|
+
get target() {
|
|
33
|
+
return this.targets[this.targets.length - 1];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Where `source` should render, or `null` when it is not shown. */
|
|
37
|
+
targetFor(source) {
|
|
38
|
+
const target = this.target;
|
|
39
|
+
if (!target) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const shown = target.multiple ? this.sources.includes(source) : this.sources[this.sources.length - 1] === source;
|
|
43
|
+
return shown ? target.element : null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Connects `InLayoutRegion` sources, rendered anywhere in the app, to the
|
|
49
|
+
* layout's named regions. Internal to Frontile: use `layout.Region`,
|
|
50
|
+
* `layout.Aside @region` and `InLayoutRegion` instead.
|
|
51
|
+
*
|
|
52
|
+
* Every write is deferred to `afterRender`. Sources register while the
|
|
53
|
+
* render is running, and the layout, which renders before `{{outlet}}`, has
|
|
54
|
+
* usually already read the same tracked state in that render. Writing it
|
|
55
|
+
* synchronously trips Glimmer's backtracking assertion. The deferred write
|
|
56
|
+
* re-renders in the same runloop, so no paint happens in between.
|
|
57
|
+
*/
|
|
58
|
+
class FrontileLayoutRegionsService extends Service {
|
|
59
|
+
#regions = new Map();
|
|
60
|
+
#emptyListeners = new Map();
|
|
61
|
+
#write(fn) {
|
|
62
|
+
schedule('afterRender', () => {
|
|
63
|
+
if (!this.isDestroying && !this.isDestroyed) {
|
|
64
|
+
fn();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The named region, created on first use (by a source or a target). */
|
|
70
|
+
region(name) {
|
|
71
|
+
let region = this.#regions.get(name);
|
|
72
|
+
if (!region) {
|
|
73
|
+
region = new LayoutRegionState();
|
|
74
|
+
this.#regions.set(name, region);
|
|
75
|
+
}
|
|
76
|
+
return region;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Whether any source fills the named region (tracked). */
|
|
80
|
+
hasContent(name) {
|
|
81
|
+
return this.region(name).hasContent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Where `source` renders in the named region, or `null` (tracked). */
|
|
85
|
+
targetFor(name, source) {
|
|
86
|
+
return this.region(name).targetFor(source);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Adds an element sources render into. The newest target wins; removing
|
|
91
|
+
* it hands the sources back to the previous one. Returns the undo
|
|
92
|
+
* function, which removes only this registration.
|
|
93
|
+
*/
|
|
94
|
+
registerTarget(name, element, options = {}) {
|
|
95
|
+
const region = this.region(name);
|
|
96
|
+
const target = {
|
|
97
|
+
element,
|
|
98
|
+
multiple: options.multiple ?? false
|
|
99
|
+
};
|
|
100
|
+
this.#write(() => {
|
|
101
|
+
// A target that has left the document (the aside moving between its
|
|
102
|
+
// column and its drawer) is being replaced, not duplicated.
|
|
103
|
+
warn(`frontile: two targets render the layout region "${name}" at once; sources follow the newest. Region names are global to the app.`, !region.targets.some(other => other.element !== element && other.element.isConnected), {
|
|
104
|
+
id: 'frontile.layout-region.duplicate-target'
|
|
105
|
+
});
|
|
106
|
+
region.targets = [...region.targets, target];
|
|
107
|
+
});
|
|
108
|
+
return () => this.#write(() => {
|
|
109
|
+
region.targets = region.targets.filter(t => t !== target);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Adds a source to the named region. Returns the undo function. The
|
|
115
|
+
* removal is deferred too, so a swap in one render goes 1 → 2 → 1 and the
|
|
116
|
+
* region is never seen empty.
|
|
117
|
+
*/
|
|
118
|
+
addSource(name, source) {
|
|
119
|
+
const region = this.region(name);
|
|
120
|
+
this.#write(() => {
|
|
121
|
+
region.sources = [...region.sources, source];
|
|
122
|
+
});
|
|
123
|
+
return () => this.#write(() => {
|
|
124
|
+
const before = region.sources.length;
|
|
125
|
+
region.sources = region.sources.filter(s => s !== source);
|
|
126
|
+
if (before > 0 && region.sources.length === 0) {
|
|
127
|
+
this.#emptyListeners.get(name)?.forEach(listener => listener());
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Calls `listener` whenever the named region loses its last source. Runs
|
|
134
|
+
* after render, so it may change tracked state.
|
|
135
|
+
*/
|
|
136
|
+
onEmpty(name, listener) {
|
|
137
|
+
let listeners = this.#emptyListeners.get(name);
|
|
138
|
+
if (!listeners) {
|
|
139
|
+
listeners = new Set();
|
|
140
|
+
this.#emptyListeners.set(name, listeners);
|
|
141
|
+
}
|
|
142
|
+
const set = listeners;
|
|
143
|
+
set.add(listener);
|
|
144
|
+
return () => set.delete(listener);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { LayoutRegionState, FrontileLayoutRegionsService as default };
|
|
149
|
+
//# sourceMappingURL=frontile-layout-regions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontile-layout-regions.js","sources":["../../src/services/frontile-layout-regions.ts"],"sourcesContent":["import Service from '@ember/service';\nimport { tracked } from '@glimmer/tracking';\nimport { schedule } from '@ember/runloop';\nimport { warn } from '@ember/debug';\n\n/** A mounted target: the element sources render into, and how. */\ninterface RegionTarget {\n readonly element: Element;\n /** Whether every source renders (`true`) or only the newest. */\n readonly multiple: boolean;\n}\n\n/** One named region: where it renders (the target) and who fills it. */\nexport class LayoutRegionState {\n /**\n * Mounted targets in registration order. The newest is the one sources\n * render into; when it goes away, the previous one takes over again.\n * Reassigned, never mutated.\n */\n @tracked targets: readonly RegionTarget[] = [];\n /** Sources in registration (render) order. Reassigned, never mutated. */\n @tracked sources: readonly object[] = [];\n get hasContent(): boolean {\n return this.sources.length > 0;\n }\n\n /** The target sources render into: the newest mounted one. */\n get target(): RegionTarget | undefined {\n return this.targets[this.targets.length - 1];\n }\n\n /** Where `source` should render, or `null` when it is not shown. */\n targetFor(source: object): Element | null {\n const target = this.target;\n if (!target) {\n return null;\n }\n const shown = target.multiple\n ? this.sources.includes(source)\n : this.sources[this.sources.length - 1] === source;\n return shown ? target.element : null;\n }\n}\n\n/**\n * Connects `InLayoutRegion` sources, rendered anywhere in the app, to the\n * layout's named regions. Internal to Frontile: use `layout.Region`,\n * `layout.Aside @region` and `InLayoutRegion` instead.\n *\n * Every write is deferred to `afterRender`. Sources register while the\n * render is running, and the layout, which renders before `{{outlet}}`, has\n * usually already read the same tracked state in that render. Writing it\n * synchronously trips Glimmer's backtracking assertion. The deferred write\n * re-renders in the same runloop, so no paint happens in between.\n */\nexport default class FrontileLayoutRegionsService extends Service {\n #regions = new Map<string, LayoutRegionState>();\n #emptyListeners = new Map<string, Set<() => void>>();\n\n #write(fn: () => void): void {\n schedule('afterRender', () => {\n if (!this.isDestroying && !this.isDestroyed) {\n fn();\n }\n });\n }\n\n /** The named region, created on first use (by a source or a target). */\n region(name: string): LayoutRegionState {\n let region = this.#regions.get(name);\n if (!region) {\n region = new LayoutRegionState();\n this.#regions.set(name, region);\n }\n return region;\n }\n\n /** Whether any source fills the named region (tracked). */\n hasContent(name: string): boolean {\n return this.region(name).hasContent;\n }\n\n /** Where `source` renders in the named region, or `null` (tracked). */\n targetFor(name: string, source: object): Element | null {\n return this.region(name).targetFor(source);\n }\n\n /**\n * Adds an element sources render into. The newest target wins; removing\n * it hands the sources back to the previous one. Returns the undo\n * function, which removes only this registration.\n */\n registerTarget(\n name: string,\n element: Element,\n options: { multiple?: boolean } = {}\n ): () => void {\n const region = this.region(name);\n const target: RegionTarget = {\n element,\n multiple: options.multiple ?? false\n };\n this.#write(() => {\n // A target that has left the document (the aside moving between its\n // column and its drawer) is being replaced, not duplicated.\n warn(\n `frontile: two targets render the layout region \"${name}\" at once; sources follow the newest. Region names are global to the app.`,\n !region.targets.some(\n (other) => other.element !== element && other.element.isConnected\n ),\n { id: 'frontile.layout-region.duplicate-target' }\n );\n region.targets = [...region.targets, target];\n });\n return () =>\n this.#write(() => {\n region.targets = region.targets.filter((t) => t !== target);\n });\n }\n\n /**\n * Adds a source to the named region. Returns the undo function. The\n * removal is deferred too, so a swap in one render goes 1 → 2 → 1 and the\n * region is never seen empty.\n */\n addSource(name: string, source: object): () => void {\n const region = this.region(name);\n this.#write(() => {\n region.sources = [...region.sources, source];\n });\n return () =>\n this.#write(() => {\n const before = region.sources.length;\n region.sources = region.sources.filter((s) => s !== source);\n if (before > 0 && region.sources.length === 0) {\n this.#emptyListeners.get(name)?.forEach((listener) => listener());\n }\n });\n }\n\n /**\n * Calls `listener` whenever the named region loses its last source. Runs\n * after render, so it may change tracked state.\n */\n onEmpty(name: string, listener: () => void): () => void {\n let listeners = this.#emptyListeners.get(name);\n if (!listeners) {\n listeners = new Set();\n this.#emptyListeners.set(name, listeners);\n }\n const set = listeners;\n set.add(listener);\n return () => set.delete(listener);\n }\n}\n\ndeclare module '@ember/service' {\n interface Registry {\n 'frontile-layout-regions': FrontileLayoutRegionsService;\n }\n}\n"],"names":["LayoutRegionState","g","prototype","tracked","i","hasContent","sources","length","target","targets","targetFor","source","shown","multiple","includes","element","FrontileLayoutRegionsService","Service","Map","#write","fn","schedule","isDestroying","isDestroyed","region","name","get","set","registerTarget","options","warn","some","other","isConnected","id","filter","t","addSource","before","s","forEach","listener","onEmpty","listeners","Set","add","delete"],"mappings":";;;;;;AAYA;AACO,MAAMA,iBAAiB,CAAC;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,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,QAAQ,IAAKA,QAAQ,EAAE,CAAC;AACnE,MAAA;AACF,IAAA,CAAC,CAAC;AACN,EAAA;;AAEA;AACF;AACA;AACA;AACEC,EAAAA,OAAOA,CAACjB,IAAY,EAAEgB,QAAoB,EAAc;IACtD,IAAIE,SAAS,GAAG,IAAI,CAAC,eAAe,CAACjB,GAAG,CAACD,IAAI,CAAC;IAC9C,IAAI,CAACkB,SAAS,EAAE;AACdA,MAAAA,SAAS,GAAG,IAAIC,GAAG,EAAE;MACrB,IAAI,CAAC,eAAe,CAACjB,GAAG,CAACF,IAAI,EAAEkB,SAAS,CAAC;AAC3C,IAAA;IACA,MAAMhB,GAAG,GAAGgB,SAAS;AACrBhB,IAAAA,GAAG,CAACkB,GAAG,CAACJ,QAAQ,CAAC;AACjB,IAAA,OAAO,MAAMd,GAAG,CAACmB,MAAM,CAACL,QAAQ,CAAC;AACnC,EAAA;AACF;;"}
|
package/dist/utilities.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import 'focus-visible/dist/focus-visible.js';
|
|
2
2
|
export { Avatar } from './components/utilities/avatar.js';
|
|
3
|
+
export { Icon } from './components/utilities/icon.js';
|
|
3
4
|
export { VisuallyHidden } from './components/utilities/visually-hidden.js';
|
|
4
5
|
export { Collapsible } from './components/utilities/collapsible.js';
|
|
5
6
|
export { Divider } from './components/utilities/divider.js';
|
|
7
|
+
export { Card } from './components/utilities/card.js';
|
|
6
8
|
export { Kbd } from './components/utilities/kbd.js';
|
|
7
9
|
export { isApplePlatform, parseKeys, resolveKbdPlatform, setKbdPlatform } from './utils/keys.js';
|
|
8
10
|
export { Skeleton } from './components/utilities/skeleton.js';
|
package/dist/utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utilities.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "frontile",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.13",
|
|
4
4
|
"description": "Component Library for Ember Octane apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@embroider/addon-shim": "^1.11.0",
|
|
99
99
|
"@embroider/macros": "^1.21.4",
|
|
100
100
|
"@floating-ui/dom": "^1.8.0",
|
|
101
|
-
"@frontile/theme": "^0.18.
|
|
101
|
+
"@frontile/theme": "^0.18.13",
|
|
102
102
|
"@glint/template": "^1.11.1",
|
|
103
103
|
"@universal-ember/table": "^4.1.1",
|
|
104
104
|
"date-fns": "^4.4.0",
|
|
@@ -153,8 +153,9 @@
|
|
|
153
153
|
"type": "addon",
|
|
154
154
|
"main": "addon-main.js",
|
|
155
155
|
"app-js": {
|
|
156
|
+
"./services/frontile-layout-regions.js": "./dist/_app_/services/frontile-layout-regions.js",
|
|
156
157
|
"./services/notifications.js": "./dist/_app_/services/notifications.js"
|
|
157
158
|
}
|
|
158
159
|
},
|
|
159
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "3a71985872a2de08f85908329002be2b0a59fea4"
|
|
160
161
|
}
|