ember-primitives 0.43.1 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/components/heading.d.ts +14 -0
- package/declarations/components/heading.d.ts.map +1 -0
- package/declarations/components/one-time-password.d.ts +3 -0
- package/declarations/components/one-time-password.d.ts.map +1 -0
- package/declarations/components/shadowed.d.ts +33 -3
- package/declarations/components/shadowed.d.ts.map +1 -1
- package/declarations/index.d.ts +1 -1
- package/declarations/index.d.ts.map +1 -1
- package/declarations/test-support/dom.d.ts +14 -0
- package/declarations/test-support/dom.d.ts.map +1 -0
- package/declarations/test-support.d.ts +7 -0
- package/declarations/test-support.d.ts.map +1 -0
- package/dist/{floating-ui/modifier.js → component-Bs3N-G9z.js} +72 -4
- package/dist/component-Bs3N-G9z.js.map +1 -0
- package/dist/components/accordion.js +60 -1
- package/dist/components/heading.js +109 -0
- package/dist/components/heading.js.map +1 -0
- package/dist/components/one-time-password.js +3 -0
- package/dist/components/one-time-password.js.map +1 -0
- package/dist/components/popover.js +1 -2
- package/dist/components/rating.js +1 -1
- package/dist/components/shadowed.js +47 -35
- package/dist/components/switch.js +8 -2
- package/dist/components/toggle.js +1 -1
- package/dist/components/zoetrope.js +1 -1
- package/dist/floating-ui.js +1 -2
- package/dist/index-D052JWRa.js +149 -0
- package/dist/index-D052JWRa.js.map +1 -0
- package/dist/{components/zoetrope/index.js → index-DKE67I8L.js} +3 -3
- package/dist/index-DKE67I8L.js.map +1 -0
- package/dist/index.js +3 -4
- package/dist/otp-C6hCCXKx.js +291 -0
- package/dist/otp-C6hCCXKx.js.map +1 -0
- package/dist/test-support.js +255 -0
- package/dist/test-support.js.map +1 -0
- package/dist/{components/-private/utils.js → utils-C5796IKA.js} +2 -2
- package/dist/utils-C5796IKA.js.map +1 -0
- package/package.json +1 -9
- package/declarations/components/one-time-password/index.d.ts +0 -3
- package/declarations/components/one-time-password/index.d.ts.map +0 -1
- package/declarations/test-support/index.d.ts +0 -6
- package/declarations/test-support/index.d.ts.map +0 -1
- package/dist/components/-private/typed-elements.js +0 -14
- package/dist/components/-private/typed-elements.js.map +0 -1
- package/dist/components/-private/utils.js.map +0 -1
- package/dist/components/accordion/content.js +0 -6
- package/dist/components/accordion/content.js.map +0 -1
- package/dist/components/accordion/header.js +0 -7
- package/dist/components/accordion/header.js.map +0 -1
- package/dist/components/accordion/item.js +0 -7
- package/dist/components/accordion/item.js.map +0 -1
- package/dist/components/accordion/public.js +0 -2
- package/dist/components/accordion/public.js.map +0 -1
- package/dist/components/accordion/trigger.js +0 -7
- package/dist/components/accordion/trigger.js.map +0 -1
- package/dist/components/one-time-password/buttons.js +0 -26
- package/dist/components/one-time-password/buttons.js.map +0 -1
- package/dist/components/one-time-password/index.js +0 -4
- package/dist/components/one-time-password/index.js.map +0 -1
- package/dist/components/one-time-password/input.js +0 -90
- package/dist/components/one-time-password/input.js.map +0 -1
- package/dist/components/one-time-password/otp.js +0 -58
- package/dist/components/one-time-password/otp.js.map +0 -1
- package/dist/components/one-time-password/utils.js +0 -144
- package/dist/components/one-time-password/utils.js.map +0 -1
- package/dist/components/rating/index.js +0 -45
- package/dist/components/rating/index.js.map +0 -1
- package/dist/components/rating/public-types.js +0 -2
- package/dist/components/rating/public-types.js.map +0 -1
- package/dist/components/rating/range.js +0 -15
- package/dist/components/rating/range.js.map +0 -1
- package/dist/components/rating/stars.js +0 -19
- package/dist/components/rating/stars.js.map +0 -1
- package/dist/components/rating/state.js +0 -82
- package/dist/components/rating/state.js.map +0 -1
- package/dist/components/rating/utils.js +0 -18
- package/dist/components/rating/utils.js.map +0 -1
- package/dist/components/zoetrope/index.js.map +0 -1
- package/dist/components/zoetrope/types.js +0 -2
- package/dist/components/zoetrope/types.js.map +0 -1
- package/dist/floating-ui/component.js +0 -63
- package/dist/floating-ui/component.js.map +0 -1
- package/dist/floating-ui/middleware.js +0 -15
- package/dist/floating-ui/middleware.js.map +0 -1
- package/dist/floating-ui/modifier.js.map +0 -1
- package/dist/item-CwIzoqlC.js +0 -68
- package/dist/item-CwIzoqlC.js.map +0 -1
- package/dist/test-support/a11y.js +0 -24
- package/dist/test-support/a11y.js.map +0 -1
- package/dist/test-support/index.js +0 -7
- package/dist/test-support/index.js.map +0 -1
- package/dist/test-support/otp.js +0 -34
- package/dist/test-support/otp.js.map +0 -1
- package/dist/test-support/rating.js +0 -92
- package/dist/test-support/rating.js.map +0 -1
- package/dist/test-support/routing.js +0 -54
- package/dist/test-support/routing.js.map +0 -1
- package/dist/test-support/zoetrope.js +0 -43
- package/dist/test-support/zoetrope.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Component from "@glimmer/component";
|
|
2
|
+
import type Owner from "@ember/owner";
|
|
3
|
+
export declare class Heading extends Component<{
|
|
4
|
+
Element: HTMLElement;
|
|
5
|
+
Blocks: {
|
|
6
|
+
default: [];
|
|
7
|
+
};
|
|
8
|
+
}> {
|
|
9
|
+
headingScopeAnchor: Text;
|
|
10
|
+
constructor(owner: Owner, args: object);
|
|
11
|
+
get level(): number;
|
|
12
|
+
get hLevel(): string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=heading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/components/heading.gts"],"names":[],"mappings":"AAoKA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAK3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAyHtC,qBAAa,OAAQ,SAAQ,SAAS,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CAAC;IACA,kBAAkB,EAAE,IAAI,CAAC;gBACb,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IAMtC,IAAI,KAAK,WAWR;IAED,IAAI,MAAM,WAET;CAqBF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-time-password.d.ts","sourceRoot":"","sources":["../../src/components/one-time-password.gts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Component from "@glimmer/component";
|
|
2
|
+
import type Owner from "@ember/owner";
|
|
2
3
|
/**
|
|
3
4
|
* Render content in a shadow dom, attached to a div.
|
|
4
5
|
*
|
|
@@ -8,7 +9,7 @@ import type { TOC } from "@ember/component/template-only";
|
|
|
8
9
|
*
|
|
9
10
|
* This is useful when you want to render content that escapes your app's styles.
|
|
10
11
|
*/
|
|
11
|
-
export declare
|
|
12
|
+
export declare class Shadowed extends Component<{
|
|
12
13
|
/**
|
|
13
14
|
* The shadow dom attaches to a div element.
|
|
14
15
|
* You may specify any attribute, and it'll be applied to this host element.
|
|
@@ -30,6 +31,35 @@ export declare const Shadowed: TOC<{
|
|
|
30
31
|
*/
|
|
31
32
|
default: [];
|
|
32
33
|
};
|
|
33
|
-
}
|
|
34
|
+
}> {
|
|
35
|
+
shadow: HTMLDivElement;
|
|
36
|
+
host: HTMLDivElement;
|
|
37
|
+
/**
|
|
38
|
+
* ember-source 5.6 broke the ability to in-element
|
|
39
|
+
* natively into a shadowroot.
|
|
40
|
+
*
|
|
41
|
+
* We have two or three more dives than we should have here.
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* See these ember-source bugs:
|
|
45
|
+
* - https://github.com/emberjs/ember.js/issues/20643
|
|
46
|
+
* - https://github.com/emberjs/ember.js/issues/20642
|
|
47
|
+
* - https://github.com/emberjs/ember.js/issues/20641
|
|
48
|
+
*
|
|
49
|
+
* Ideally, shadowdom should be built in.
|
|
50
|
+
* Couple paths forward:
|
|
51
|
+
* - (as the overall template tag)
|
|
52
|
+
* <template shadowrootmode="open">
|
|
53
|
+
* </template>
|
|
54
|
+
*
|
|
55
|
+
* - Build a component into the framework that does the above ^
|
|
56
|
+
* - add additional parsing in content-tag to allow
|
|
57
|
+
* nested <template>
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
constructor(owner: Owner, args: {
|
|
61
|
+
includeStyles?: boolean;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
34
64
|
export default Shadowed;
|
|
35
65
|
//# sourceMappingURL=shadowed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadowed.d.ts","sourceRoot":"","sources":["../../src/components/shadowed.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shadowed.d.ts","sourceRoot":"","sources":["../../src/components/shadowed.gts"],"names":[],"mappings":"AA8GA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AA4BtC;;;;;;;;GAQG;AACH,qBAAa,QAAS,SAAQ,SAAS,CAAC;IACtC;;;OAGG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE;QACJ;;;;;;WAMG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,MAAM,EAAE;QACN;;WAEG;QACH,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH,CAAC;IACA,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;;;OAsBG;gBACS,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE;CAiC5D;AAED,eAAe,QAAQ,CAAC"}
|
package/declarations/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { Key, KeyCombo } from './components/keys';
|
|
|
8
8
|
export { StickyFooter } from './components/layout/sticky-footer';
|
|
9
9
|
export { Link } from './components/link';
|
|
10
10
|
export { Menu } from './components/menu';
|
|
11
|
-
export { OTP, OTPInput } from './components/one-time-password
|
|
11
|
+
export { OTP, OTPInput } from './components/one-time-password';
|
|
12
12
|
export { Popover } from './components/popover';
|
|
13
13
|
export { Portal } from './components/portal';
|
|
14
14
|
export { PortalTargets } from './components/portal-targets';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { find } from '@ember/test-helpers';
|
|
2
|
+
type Findable = Parameters<typeof find>[0] | Element;
|
|
3
|
+
/**
|
|
4
|
+
* Find an element within a shadow-root.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findInShadow(root: Findable, query: string): Element | null | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Does the element have a shadow root?
|
|
9
|
+
*/
|
|
10
|
+
export declare function hasShadowRoot(el: Element): boolean;
|
|
11
|
+
export declare function findShadow(root?: Findable): Element | undefined;
|
|
12
|
+
export declare function findInFirstShadow(query: string): Element | null | undefined;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/test-support/dom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;AAErD;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAIzD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,WAExC;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,uBAczC;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,8BAM9C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { setupTabster } from "./test-support/a11y.ts";
|
|
2
|
+
export { findInFirstShadow, findInShadow, findShadow, hasShadowRoot } from "./test-support/dom.ts";
|
|
3
|
+
export { fillOTP } from "./test-support/otp.ts";
|
|
4
|
+
export { rating } from "./test-support/rating.ts";
|
|
5
|
+
export { getRouter, setupRouting } from "./test-support/routing.ts";
|
|
6
|
+
export { ZoetropeHelper } from "./test-support/zoetrope.ts";
|
|
7
|
+
//# sourceMappingURL=test-support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.gts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { hash } from '@ember/helper';
|
|
5
|
+
import { modifier } from 'ember-modifier';
|
|
2
6
|
import { assert } from '@ember/debug';
|
|
3
7
|
import { autoUpdate, computePosition, offset, flip, shift, hide } from '@floating-ui/dom';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
8
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
9
|
+
import { setComponentTemplate } from '@ember/component';
|
|
10
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
11
|
+
|
|
12
|
+
function exposeMetadata() {
|
|
13
|
+
return {
|
|
14
|
+
name: 'metadata',
|
|
15
|
+
fn: data => {
|
|
16
|
+
// https://floating-ui.com/docs/middleware#always-return-an-object
|
|
17
|
+
return {
|
|
18
|
+
data
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
6
23
|
|
|
7
24
|
/**
|
|
8
25
|
* A modifier to apply to the _floating_ element.
|
|
@@ -75,5 +92,56 @@ const anchorTo = modifier((floatingElement, [_referenceElement], {
|
|
|
75
92
|
return cleanup;
|
|
76
93
|
});
|
|
77
94
|
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
const ref = modifier((element, positional) => {
|
|
96
|
+
const fn = positional[0];
|
|
97
|
+
fn(element);
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* A component that provides no DOM and yields two modifiers for creating
|
|
101
|
+
* creating floating uis, such as menus, popovers, tooltips, etc.
|
|
102
|
+
* This component currently uses [Floating UI](https://floating-ui.com/)
|
|
103
|
+
* but will be switching to [CSS Anchor Positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning) when that lands.
|
|
104
|
+
*
|
|
105
|
+
* Example usage:
|
|
106
|
+
* ```gjs
|
|
107
|
+
* import { FloatingUI } from 'ember-primitives/floating-ui';
|
|
108
|
+
*
|
|
109
|
+
* <template>
|
|
110
|
+
* <FloatingUI as |reference floating|>
|
|
111
|
+
* <button {{reference}}> ... </button>
|
|
112
|
+
* <menu {{floating}}> ... </menu>
|
|
113
|
+
* </FloatingUI>
|
|
114
|
+
* </template>
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
class FloatingUI extends Component {
|
|
118
|
+
static {
|
|
119
|
+
g(this.prototype, "reference", [tracked], function () {
|
|
120
|
+
return undefined;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
#reference = (i(this, "reference"), void 0);
|
|
124
|
+
static {
|
|
125
|
+
g(this.prototype, "data", [tracked], function () {
|
|
126
|
+
return undefined;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
#data = (i(this, "data"), void 0);
|
|
130
|
+
setData = data => this.data = data;
|
|
131
|
+
setReference = element => {
|
|
132
|
+
this.reference = element;
|
|
133
|
+
};
|
|
134
|
+
static {
|
|
135
|
+
setComponentTemplate(precompileTemplate("\n {{#let (modifier anchorTo flipOptions=@flipOptions hideOptions=@hideOptions middleware=@middleware offsetOptions=@offsetOptions placement=@placement shiftOptions=@shiftOptions strategy=@strategy setData=this.setData) as |prewiredAnchorTo|}}\n {{#let (if this.reference (modifier prewiredAnchorTo this.reference)) as |floating|}}\n {{!-- @glint-nocheck -- Excessively deep, possibly infinite --}}\n {{yield (modifier ref this.setReference) floating (hash setReference=this.setReference data=this.data)}}\n {{/let}}\n {{/let}}\n ", {
|
|
136
|
+
strictMode: true,
|
|
137
|
+
scope: () => ({
|
|
138
|
+
anchorTo,
|
|
139
|
+
ref,
|
|
140
|
+
hash
|
|
141
|
+
})
|
|
142
|
+
}), this);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { FloatingUI as F, anchorTo as a };
|
|
147
|
+
//# sourceMappingURL=component-Bs3N-G9z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-Bs3N-G9z.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -3,11 +3,70 @@ import Component from '@glimmer/component';
|
|
|
3
3
|
import { assert } from '@ember/debug';
|
|
4
4
|
import { hash } from '@ember/helper';
|
|
5
5
|
import { localCopy } from 'tracked-toolbox';
|
|
6
|
-
import { A as AccordionItem } from '../item-CwIzoqlC.js';
|
|
7
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
7
|
import { setComponentTemplate } from '@ember/component';
|
|
8
|
+
import { on } from '@ember/modifier';
|
|
9
|
+
import templateOnly from '@ember/component/template-only';
|
|
9
10
|
import { g, i } from 'decorator-transforms/runtime';
|
|
10
11
|
|
|
12
|
+
class AccordionContent extends Component {
|
|
13
|
+
static {
|
|
14
|
+
setComponentTemplate(precompileTemplate("\n <div role=\"region\" id={{@value}} data-state={{getDataState @isExpanded}} hidden={{this.isHidden}} data-disabled={{@disabled}} ...attributes>\n {{yield}}\n </div>\n ", {
|
|
15
|
+
strictMode: true,
|
|
16
|
+
scope: () => ({
|
|
17
|
+
getDataState
|
|
18
|
+
})
|
|
19
|
+
}), this);
|
|
20
|
+
}
|
|
21
|
+
get isHidden() {
|
|
22
|
+
return !this.args.isExpanded;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const AccordionTrigger = setComponentTemplate(precompileTemplate("\n <button type=\"button\" aria-controls={{@value}} aria-expanded={{@isExpanded}} data-state={{getDataState @isExpanded}} data-disabled={{@disabled}} aria-disabled={{if @disabled \"true\" \"false\"}} {{on \"click\" @toggleItem}} ...attributes>\n {{yield}}\n </button>\n", {
|
|
27
|
+
strictMode: true,
|
|
28
|
+
scope: () => ({
|
|
29
|
+
getDataState,
|
|
30
|
+
on
|
|
31
|
+
})
|
|
32
|
+
}), templateOnly());
|
|
33
|
+
|
|
34
|
+
const AccordionHeader = setComponentTemplate(precompileTemplate("\n <div role=\"heading\" aria-level=\"3\" data-state={{getDataState @isExpanded}} data-disabled={{@disabled}} ...attributes>\n {{yield (hash Trigger=(component Trigger value=@value isExpanded=@isExpanded disabled=@disabled toggleItem=@toggleItem))}}\n </div>\n", {
|
|
35
|
+
strictMode: true,
|
|
36
|
+
scope: () => ({
|
|
37
|
+
getDataState,
|
|
38
|
+
hash,
|
|
39
|
+
Trigger: AccordionTrigger
|
|
40
|
+
})
|
|
41
|
+
}), templateOnly());
|
|
42
|
+
|
|
43
|
+
function getDataState(isExpanded) {
|
|
44
|
+
return isExpanded ? "open" : "closed";
|
|
45
|
+
}
|
|
46
|
+
class AccordionItem extends Component {
|
|
47
|
+
static {
|
|
48
|
+
setComponentTemplate(precompileTemplate("\n <div data-state={{getDataState this.isExpanded}} data-disabled={{@disabled}} ...attributes>\n {{yield (hash isExpanded=this.isExpanded Header=(component Header value=@value isExpanded=this.isExpanded disabled=@disabled toggleItem=this.toggleItem) Content=(component Content value=@value isExpanded=this.isExpanded disabled=@disabled))}}\n </div>\n ", {
|
|
49
|
+
strictMode: true,
|
|
50
|
+
scope: () => ({
|
|
51
|
+
getDataState,
|
|
52
|
+
hash,
|
|
53
|
+
Header: AccordionHeader,
|
|
54
|
+
Content: AccordionContent
|
|
55
|
+
})
|
|
56
|
+
}), this);
|
|
57
|
+
}
|
|
58
|
+
get isExpanded() {
|
|
59
|
+
if (Array.isArray(this.args.selectedValue)) {
|
|
60
|
+
return this.args.selectedValue.includes(this.args.value);
|
|
61
|
+
}
|
|
62
|
+
return this.args.selectedValue === this.args.value;
|
|
63
|
+
}
|
|
64
|
+
toggleItem = () => {
|
|
65
|
+
if (this.args.disabled) return;
|
|
66
|
+
this.args.toggleItem(this.args.value);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
11
70
|
class Accordion extends Component {
|
|
12
71
|
static {
|
|
13
72
|
setComponentTemplate(precompileTemplate("\n <div data-disabled={{@disabled}} ...attributes>\n {{yield (hash Item=(component AccordionItem selectedValue=this.selectedValue toggleItem=this.toggleItem disabled=@disabled))}}\n </div>\n ", {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { assert } from '@ember/debug';
|
|
4
|
+
import { element } from 'ember-element-helper';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
|
|
8
|
+
const LOOKUP = new WeakMap();
|
|
9
|
+
const BOUNDARY_ELEMENTS = new Set(["SECTION", "ARTICLE", "ASIDE", "HEADER", "FOOTER", "MAIN", "NAV"]);
|
|
10
|
+
/**
|
|
11
|
+
* A set with both cases is more performant than calling toLowerCase
|
|
12
|
+
*/
|
|
13
|
+
const SECTION_HEADINGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6", "H1", "H2", "H3", "H4", "H5", "H6"]);
|
|
14
|
+
const TEST_BOUNDARY = "ember-testing";
|
|
15
|
+
function isRoot(element) {
|
|
16
|
+
return element === document.body || element.id === TEST_BOUNDARY;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The Platform native 'closest' function can't punch through shadow-boundaries
|
|
20
|
+
*/
|
|
21
|
+
function nearestAncestor(node, matcher) {
|
|
22
|
+
let parent = node.parentElement;
|
|
23
|
+
if (!parent) return;
|
|
24
|
+
while (parent) {
|
|
25
|
+
if (parent instanceof Element) {
|
|
26
|
+
if (matcher(parent)) return parent;
|
|
27
|
+
}
|
|
28
|
+
if (parent instanceof ShadowRoot) {
|
|
29
|
+
parent = parent.host;
|
|
30
|
+
}
|
|
31
|
+
parent = parent.parentNode;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The algorithm:
|
|
36
|
+
*
|
|
37
|
+
* section <- "our" level-changing boundary element
|
|
38
|
+
* h# <- the element we want to figure out the level of
|
|
39
|
+
*
|
|
40
|
+
* We start assuming we'll emit an h1.
|
|
41
|
+
* We adjust this based on what we find crawling up the tree.
|
|
42
|
+
*
|
|
43
|
+
* While traversing up, when we go from the h# to the section,
|
|
44
|
+
* and ignore it. Because this alone has no bearing on if the h# should be an h2.
|
|
45
|
+
* We need to continue traversing upwards, until we hit the next boundary element.
|
|
46
|
+
*
|
|
47
|
+
* IF we would change the level the heading, we will find another heading between
|
|
48
|
+
* these two boundary elements.
|
|
49
|
+
* We'll need to check the subtrees between these elements, stopping if we
|
|
50
|
+
* encounter other boundary elements.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
function levelOf(node) {
|
|
54
|
+
const ourBoundary = nearestAncestor(node, el => BOUNDARY_ELEMENTS.has(el.tagName));
|
|
55
|
+
/**
|
|
56
|
+
* We are the top-level
|
|
57
|
+
*/
|
|
58
|
+
if (!ourBoundary) {
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
const stopAt = nearestAncestor(ourBoundary, el => {
|
|
62
|
+
if (BOUNDARY_ELEMENTS.has(el.tagName)) return true;
|
|
63
|
+
return isRoot(el);
|
|
64
|
+
});
|
|
65
|
+
assert(`[BUG]: Could not find a stopping boundary for automatic heading level detection. Checked for ${[...BOUNDARY_ELEMENTS, "body", "#ember-testing"].map(x => x.toLowerCase()).join(", ")}`, stopAt);
|
|
66
|
+
let current = ourBoundary.parentNode;
|
|
67
|
+
while (current) {
|
|
68
|
+
for (const child of current.children) {
|
|
69
|
+
if (!SECTION_HEADINGS.has(child.tagName)) continue;
|
|
70
|
+
const level = parseInt(child.tagName.replace("h", "").replace("H", ""));
|
|
71
|
+
return level + 1;
|
|
72
|
+
}
|
|
73
|
+
if (current === stopAt) break;
|
|
74
|
+
if (current instanceof ShadowRoot) {
|
|
75
|
+
current = current.host;
|
|
76
|
+
}
|
|
77
|
+
current = current.parentNode;
|
|
78
|
+
}
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
class Heading extends Component {
|
|
82
|
+
headingScopeAnchor;
|
|
83
|
+
constructor(owner, args) {
|
|
84
|
+
super(owner, args);
|
|
85
|
+
this.headingScopeAnchor = document.createTextNode("");
|
|
86
|
+
}
|
|
87
|
+
get level() {
|
|
88
|
+
const existing = LOOKUP.get(this.headingScopeAnchor);
|
|
89
|
+
if (existing) return existing;
|
|
90
|
+
const parentLevel = levelOf(this.headingScopeAnchor);
|
|
91
|
+
const myLevel = parentLevel;
|
|
92
|
+
LOOKUP.set(this.headingScopeAnchor, myLevel);
|
|
93
|
+
return myLevel;
|
|
94
|
+
}
|
|
95
|
+
get hLevel() {
|
|
96
|
+
return `h${this.level}`;
|
|
97
|
+
}
|
|
98
|
+
static {
|
|
99
|
+
setComponentTemplate(precompileTemplate("\n {{this.headingScopeAnchor}}\n\n {{#let (element this.hLevel) as |El|}}\n <El ...attributes>\n {{yield}}\n </El>\n {{/let}}\n ", {
|
|
100
|
+
strictMode: true,
|
|
101
|
+
scope: () => ({
|
|
102
|
+
element
|
|
103
|
+
})
|
|
104
|
+
}), this);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { Heading };
|
|
109
|
+
//# sourceMappingURL=heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-time-password.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -4,8 +4,7 @@ import { arrow } from '@floating-ui/dom';
|
|
|
4
4
|
import { element } from 'ember-element-helper';
|
|
5
5
|
import { modifier } from 'ember-modifier';
|
|
6
6
|
import { cell } from 'ember-resources';
|
|
7
|
-
import { FloatingUI } from '../
|
|
8
|
-
import '../floating-ui/modifier.js';
|
|
7
|
+
import { F as FloatingUI } from '../component-Bs3N-G9z.js';
|
|
9
8
|
import { Portal } from './portal.js';
|
|
10
9
|
import { TARGETS } from './portal-targets.js';
|
|
11
10
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
@@ -1,36 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
3
|
-
import { cell } from 'ember-resources';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
4
3
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
4
|
import { setComponentTemplate } from '@ember/component';
|
|
6
5
|
import templateOnly from '@ember/component/template-only';
|
|
7
6
|
|
|
8
|
-
const Shadow = () => {
|
|
9
|
-
const shadow = cell();
|
|
10
|
-
return {
|
|
11
|
-
get root() {
|
|
12
|
-
return shadow.current;
|
|
13
|
-
},
|
|
14
|
-
attach: modifier(element => {
|
|
15
|
-
const shadowRoot = element.attachShadow({
|
|
16
|
-
mode: "open"
|
|
17
|
-
});
|
|
18
|
-
const div = document.createElement("div");
|
|
19
|
-
// ember-source 5.6 broke the ability to in-element
|
|
20
|
-
// natively into a shadowroot.
|
|
21
|
-
//
|
|
22
|
-
// See these ember-source bugs:
|
|
23
|
-
// - https://github.com/emberjs/ember.js/issues/20643
|
|
24
|
-
// - https://github.com/emberjs/ember.js/issues/20642
|
|
25
|
-
// - https://github.com/emberjs/ember.js/issues/20641
|
|
26
|
-
shadowRoot.appendChild(div);
|
|
27
|
-
shadow.set(div);
|
|
28
|
-
})
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
// index.html has the production-fingerprinted references to these links
|
|
32
|
-
// Ideally, we'd have some pre-processor scan everything for references to
|
|
33
|
-
// assets in public, but idk how to set that up
|
|
34
7
|
const getStyles = () => [...document.querySelectorAll("link")].map(link => link.href);
|
|
35
8
|
/**
|
|
36
9
|
* style + native @import
|
|
@@ -53,13 +26,52 @@ const Styles = setComponentTemplate(precompileTemplate("\n <style>\n {{#each
|
|
|
53
26
|
*
|
|
54
27
|
* This is useful when you want to render content that escapes your app's styles.
|
|
55
28
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
29
|
+
class Shadowed extends Component {
|
|
30
|
+
shadow;
|
|
31
|
+
host;
|
|
32
|
+
/**
|
|
33
|
+
* ember-source 5.6 broke the ability to in-element
|
|
34
|
+
* natively into a shadowroot.
|
|
35
|
+
*
|
|
36
|
+
* We have two or three more dives than we should have here.
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* See these ember-source bugs:
|
|
40
|
+
* - https://github.com/emberjs/ember.js/issues/20643
|
|
41
|
+
* - https://github.com/emberjs/ember.js/issues/20642
|
|
42
|
+
* - https://github.com/emberjs/ember.js/issues/20641
|
|
43
|
+
*
|
|
44
|
+
* Ideally, shadowdom should be built in.
|
|
45
|
+
* Couple paths forward:
|
|
46
|
+
* - (as the overall template tag)
|
|
47
|
+
* <template shadowrootmode="open">
|
|
48
|
+
* </template>
|
|
49
|
+
*
|
|
50
|
+
* - Build a component into the framework that does the above ^
|
|
51
|
+
* - add additional parsing in content-tag to allow
|
|
52
|
+
* nested <template>
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
constructor(owner, args) {
|
|
56
|
+
super(owner, args);
|
|
57
|
+
const element = document.createElement("div");
|
|
58
|
+
const shadowRoot = element.attachShadow({
|
|
59
|
+
mode: "open"
|
|
60
|
+
});
|
|
61
|
+
const div = document.createElement("div");
|
|
62
|
+
shadowRoot.appendChild(div);
|
|
63
|
+
this.host = element;
|
|
64
|
+
this.shadow = div;
|
|
65
|
+
}
|
|
66
|
+
static {
|
|
67
|
+
setComponentTemplate(precompileTemplate("\n <div ...attributes>{{this.host}}</div>\n\n {{#in-element this.shadow}}\n\n {{#if @includeStyles}}\n <Styles />\n {{/if}}\n\n {{yield}}\n\n {{/in-element}}\n ", {
|
|
68
|
+
strictMode: true,
|
|
69
|
+
scope: () => ({
|
|
70
|
+
Styles
|
|
71
|
+
})
|
|
72
|
+
}), this);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
63
75
|
|
|
64
76
|
export { Shadowed, Shadowed as default };
|
|
65
77
|
//# sourceMappingURL=shadowed.js.map
|
|
@@ -3,11 +3,17 @@ import { fn, hash } from '@ember/helper';
|
|
|
3
3
|
import { on } from '@ember/modifier';
|
|
4
4
|
import { cell } from 'ember-resources';
|
|
5
5
|
import { uniqueId } from '../utils.js';
|
|
6
|
-
import { Label } from './-private/typed-elements.js';
|
|
7
|
-
import { toggleWithFallback } from './-private/utils.js';
|
|
8
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
9
7
|
import { setComponentTemplate } from '@ember/component';
|
|
10
8
|
import templateOnly from '@ember/component/template-only';
|
|
9
|
+
import { t as toggleWithFallback } from '../utils-C5796IKA.js';
|
|
10
|
+
|
|
11
|
+
setComponentTemplate(precompileTemplate("\n <div ...attributes>{{yield}}</div>\n", {
|
|
12
|
+
strictMode: true
|
|
13
|
+
}), templateOnly());
|
|
14
|
+
const Label = setComponentTemplate(precompileTemplate("\n <label for={{@for}} ...attributes>{{yield}}</label>\n", {
|
|
15
|
+
strictMode: true
|
|
16
|
+
}), templateOnly());
|
|
11
17
|
|
|
12
18
|
const Checkbox = setComponentTemplate(precompileTemplate("\n {{#let (cell @checked) as |checked|}}\n <input id={{@id}} type=\"checkbox\" role=\"switch\" checked={{checked.current}} aria-checked={{checked.current}} data-state={{if checked.current \"on\" \"off\"}} {{on \"click\" (fn toggleWithFallback checked.toggle @onChange)}} ...attributes />\n {{/let}}\n", {
|
|
13
19
|
strictMode: true,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { fn } from '@ember/helper';
|
|
3
3
|
import { on } from '@ember/modifier';
|
|
4
4
|
import { cell } from 'ember-resources';
|
|
5
|
-
import { toggleWithFallback } from '
|
|
5
|
+
import { t as toggleWithFallback } from '../utils-C5796IKA.js';
|
|
6
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
7
|
import { setComponentTemplate } from '@ember/component';
|
|
8
8
|
import templateOnly from '@ember/component/template-only';
|
package/dist/floating-ui.js
CHANGED