@hozo/behaviors 0.2.0 → 0.4.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/CHANGELOG.md +70 -0
- package/README.md +17 -3
- package/dist/command-shortcut.d.ts +23 -0
- package/dist/command-shortcut.d.ts.map +1 -0
- package/dist/command-shortcut.js +47 -0
- package/dist/command-shortcut.js.map +1 -0
- package/dist/command-shortcut.native.d.ts +11 -0
- package/dist/command-shortcut.native.d.ts.map +1 -0
- package/dist/command-shortcut.native.js +11 -0
- package/dist/command-shortcut.native.js.map +1 -0
- package/dist/drag-1d-session.d.ts +26 -0
- package/dist/drag-1d-session.d.ts.map +1 -0
- package/dist/drag-1d-session.js +65 -0
- package/dist/drag-1d-session.js.map +1 -0
- package/dist/drag-1d.d.ts +14 -0
- package/dist/drag-1d.d.ts.map +1 -0
- package/dist/drag-1d.js +93 -0
- package/dist/drag-1d.js.map +1 -0
- package/dist/drag-1d.native.d.ts +8 -0
- package/dist/drag-1d.native.d.ts.map +1 -0
- package/dist/drag-1d.native.js +52 -0
- package/dist/drag-1d.native.js.map +1 -0
- package/dist/floating-geometry.d.ts +19 -0
- package/dist/floating-geometry.d.ts.map +1 -1
- package/dist/floating-geometry.js +19 -0
- package/dist/floating-geometry.js.map +1 -1
- package/dist/floating-positioner.d.ts +4 -1
- package/dist/floating-positioner.d.ts.map +1 -1
- package/dist/floating-positioner.js +42 -4
- package/dist/floating-positioner.js.map +1 -1
- package/dist/floating-positioner.native.d.ts +5 -0
- package/dist/floating-positioner.native.d.ts.map +1 -1
- package/dist/floating-positioner.native.js +26 -8
- package/dist/floating-positioner.native.js.map +1 -1
- package/dist/i18n.d.ts +154 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +158 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.native.d.ts +3 -0
- package/dist/index.native.d.ts.map +1 -1
- package/dist/index.native.js +3 -0
- package/dist/index.native.js.map +1 -1
- package/dist/native.d.ts +2 -0
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +2 -0
- package/dist/native.js.map +1 -1
- package/dist/portal.native.d.ts.map +1 -1
- package/dist/portal.native.js +24 -21
- package/dist/portal.native.js.map +1 -1
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +8 -1
- package/dist/presence.js.map +1 -1
- package/dist/pressable-interaction.d.ts +41 -0
- package/dist/pressable-interaction.d.ts.map +1 -0
- package/dist/pressable-interaction.js +72 -0
- package/dist/pressable-interaction.js.map +1 -0
- package/dist/text-child.d.ts +1 -1
- package/dist/text-child.d.ts.map +1 -1
- package/dist/text-child.js +1 -1
- package/dist/text-child.js.map +1 -1
- package/dist/text-child.native.d.ts +7 -1
- package/dist/text-child.native.d.ts.map +1 -1
- package/dist/text-child.native.js +17 -3
- package/dist/text-child.native.js.map +1 -1
- package/package.json +7 -3
- package/src/command-shortcut.native.ts +15 -0
- package/src/command-shortcut.ts +51 -0
- package/src/drag-1d-session.ts +77 -0
- package/src/drag-1d.native.ts +65 -0
- package/src/drag-1d.ts +108 -0
- package/src/floating-geometry.ts +24 -0
- package/src/floating-positioner.native.tsx +27 -7
- package/src/floating-positioner.tsx +48 -2
- package/src/i18n.ts +212 -0
- package/src/index.native.ts +20 -0
- package/src/index.ts +20 -0
- package/src/native.ts +15 -0
- package/src/portal.native.tsx +30 -22
- package/src/presence.ts +7 -1
- package/src/pressable-interaction.ts +92 -0
- package/src/text-child.native.tsx +18 -6
- package/src/text-child.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
export { isApplePlatform, useCommandShortcut, } from './command-shortcut.js';
|
|
1
2
|
export { DismissableLayer, } from './dismissable-layer.js';
|
|
3
|
+
export { useDrag1D } from './drag-1d.js';
|
|
2
4
|
export { computePosition, parsePlacement, } from './floating-geometry.js';
|
|
3
5
|
export { FloatingPositioner, useFloatingPosition, } from './floating-positioner.js';
|
|
4
6
|
export { FocusScope, initialFocusIndex, shouldRestoreFocus, } from './focus-scope.js';
|
|
5
7
|
export { computeSafePolygon, DelayGroupMachine, isPointInPolygon, } from './hover-geometry.js';
|
|
6
8
|
export { TooltipGroupProvider, useHoverTrigger, useTooltipGroup, } from './hover-trigger.js';
|
|
9
|
+
export { fromI18next, fromReactIntl, HozoI18nProvider, hozoMessages, useHozoI18n, useHozoMessage, } from './i18n.js';
|
|
7
10
|
export { LiveRegion, useAnnounce, } from './live-region.js';
|
|
8
11
|
export { Portal, PortalHost, PortalProvider, } from './portal.js';
|
|
9
12
|
export { usePresence, } from './presence.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAEjB,MAAM,wBAAyB,CAAA;AAChC,OAAO,EAIL,eAAe,EAGf,cAAc,GAGf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,kBAAkB,EAGlB,mBAAmB,GACpB,MAAM,0BAA2B,CAAA;AAClC,OAAO,EAEL,UAAU,EAEV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,kBAAmB,CAAA;AAC1B,OAAO,EACL,kBAAkB,EAElB,iBAAiB,EACjB,gBAAgB,GAGjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,oBAAoB,EAKpB,eAAe,EACf,eAAe,GAChB,MAAM,oBAAqB,CAAA;AAC5B,OAAO,EACL,UAAU,EAGV,WAAW,GACZ,MAAM,kBAAmB,CAAA;AAC1B,OAAO,EACL,MAAM,EACN,UAAU,EAEV,cAAc,GACf,MAAM,aAAc,CAAA;AACrB,OAAO,EAGL,WAAW,GACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,SAAS,EAET,gBAAgB,EAIhB,QAAQ,EACR,aAAa,GACd,MAAM,m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AAU,EACV,WAAW,EACX,oBAAoB,EAEpB,YAAY,GACb,MAAM,gBAAgB,CAAA"}
|
package/dist/index.native.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
export { type CommandShortcutOptions, isApplePlatform, useCommandShortcut, } from './command-shortcut.native.ts';
|
|
1
2
|
export { DismissableLayer, type DismissableLayerProps, } from './dismissable-layer.native.tsx';
|
|
3
|
+
export { type Drag1DDetails, type Drag1DOptions, useDrag1D } from './drag-1d.native.ts';
|
|
2
4
|
export { type Alignment, type BasePlacement, type ComputePositionOptions, computePosition, type Placement, type PositionResult, parsePlacement, type Rect, type Viewport, } from './floating-geometry.ts';
|
|
3
5
|
export { FloatingPositioner, type FloatingPositionerProps, type UseFloatingPositionOptions, useFloatingPosition, } from './floating-positioner.native.tsx';
|
|
4
6
|
export { type FocusCandidate, FocusScope, type FocusScopeProps, initialFocusIndex, shouldRestoreFocus, } from './focus-scope.native.tsx';
|
|
5
7
|
export { computeSafePolygon, type DelayGroupConfig, DelayGroupMachine, isPointInPolygon, type Point, type Polygon, } from './hover-geometry.ts';
|
|
6
8
|
export { type NativeContentProps as ContentProps, type NativeTriggerProps as TriggerProps, TooltipGroupProvider, type TooltipGroupProviderProps, type UseHoverTriggerOptions, type UseHoverTriggerReturn, useHoverTrigger, useTooltipGroup, } from './hover-trigger.native.tsx';
|
|
9
|
+
export { fromI18next, fromReactIntl, type HozoI18n, HozoI18nProvider, type HozoI18nProviderProps, type HozoMessageKey, type HozoMessageParams, hozoMessages, type I18nextLike, type ReactIntlLike, useHozoI18n, useHozoMessage, } from './i18n.ts';
|
|
7
10
|
export { LiveRegion, type LiveRegionMode, type LiveRegionProps, useAnnounce, } from './live-region.native.tsx';
|
|
8
11
|
export { Portal, PortalHost, type PortalProps, PortalProvider, } from './portal.native.tsx';
|
|
9
12
|
export { type PresenceBinding, type PresenceState, usePresence } from './presence.native.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d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AAS,EACd,KAAK,aAAa,EAClB,QAAQ,EACR,aAAa,GACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,YAAY,GACb,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,eAAe,EACf,kBAAkB,GACnB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACvF,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,eAAe,EACf,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,cAAc,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,GACd,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,cAAc,EACnB,UAAU,EACV,KAAK,eAAe,EACpB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,KAAK,EACV,KAAK,OAAO,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,kBAAkB,IAAI,YAAY,EACvC,KAAK,kBAAkB,IAAI,YAAY,EACvC,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,eAAe,EACf,eAAe,GAChB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,WAAW,EACX,aAAa,EACb,KAAK,QAAQ,EACb,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,WAAW,GACZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,MAAM,EACN,UAAU,EACV,KAAK,WAAW,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC5F,OAAO,EACL,SAAS,EACT,KAAK,WAAW,EAChB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,QAAQ,EACR,aAAa,GACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,YAAY,GACb,MAAM,gBAAgB,CAAA"}
|
package/dist/index.native.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
export { isApplePlatform, useCommandShortcut, } from './command-shortcut.native.js';
|
|
1
2
|
export { DismissableLayer, } from './dismissable-layer.native.js';
|
|
3
|
+
export { useDrag1D } from './drag-1d.native.js';
|
|
2
4
|
export { computePosition, parsePlacement, } from './floating-geometry.js';
|
|
3
5
|
export { FloatingPositioner, useFloatingPosition, } from './floating-positioner.native.js';
|
|
4
6
|
export { FocusScope, initialFocusIndex, shouldRestoreFocus, } from './focus-scope.native.js';
|
|
5
7
|
export { computeSafePolygon, DelayGroupMachine, isPointInPolygon, } from './hover-geometry.js';
|
|
6
8
|
export { TooltipGroupProvider, useHoverTrigger, useTooltipGroup, } from './hover-trigger.native.js';
|
|
9
|
+
export { fromI18next, fromReactIntl, HozoI18nProvider, hozoMessages, useHozoI18n, useHozoMessage, } from './i18n.js';
|
|
7
10
|
export { LiveRegion, useAnnounce, } from './live-region.native.js';
|
|
8
11
|
export { Portal, PortalHost, PortalProvider, } from './portal.native.js';
|
|
9
12
|
export { usePresence } from './presence.native.js';
|
package/dist/index.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAEjB,MAAM,+BAAgC,CAAA;AACvC,OAAO,EAIL,eAAe,EAGf,cAAc,GAGf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,kBAAkB,EAGlB,mBAAmB,GACpB,MAAM,iCAAkC,CAAA;AACzC,OAAO,EAEL,UAAU,EAEV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yBAA0B,CAAA;AACjC,OAAO,EACL,kBAAkB,EAElB,iBAAiB,EACjB,gBAAgB,GAGjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAGL,oBAAoB,EAIpB,eAAe,EACf,eAAe,GAChB,MAAM,2BAA4B,CAAA;AACnC,OAAO,EACL,UAAU,EAGV,WAAW,GACZ,MAAM,yBAA0B,CAAA;AACjC,OAAO,EACL,MAAM,EACN,UAAU,EAEV,cAAc,GACf,MAAM,oBAAqB,CAAA;AAC5B,OAAO,EAA4C,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC5F,OAAO,EACL,SAAS,EAET,gBAAgB,EAIhB,QAAQ,EACR,aAAa,GACd,MAAM,0BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAyB,CAAA;AAC1D,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,oBAAoB,EAEpB,YAAY,GACb,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,kBAAkB,GACnB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,gBAAgB,GAEjB,MAAM,+BAAgC,CAAA;AACvC,OAAO,EAA0C,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACvF,OAAO,EAIL,eAAe,EAGf,cAAc,GAGf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,kBAAkB,EAGlB,mBAAmB,GACpB,MAAM,iCAAkC,CAAA;AACzC,OAAO,EAEL,UAAU,EAEV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yBAA0B,CAAA;AACjC,OAAO,EACL,kBAAkB,EAElB,iBAAiB,EACjB,gBAAgB,GAGjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAGL,oBAAoB,EAIpB,eAAe,EACf,eAAe,GAChB,MAAM,2BAA4B,CAAA;AACnC,OAAO,EACL,WAAW,EACX,aAAa,EAEb,gBAAgB,EAIhB,YAAY,EAGZ,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,UAAU,EAGV,WAAW,GACZ,MAAM,yBAA0B,CAAA;AACjC,OAAO,EACL,MAAM,EACN,UAAU,EAEV,cAAc,GACf,MAAM,oBAAqB,CAAA;AAC5B,OAAO,EAA4C,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC5F,OAAO,EACL,SAAS,EAET,gBAAgB,EAIhB,QAAQ,EACR,aAAa,GACd,MAAM,0BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAyB,CAAA;AAC1D,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,oBAAoB,EAEpB,YAAY,GACb,MAAM,gBAAgB,CAAA"}
|
package/dist/native.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { type HozoFocusMover, type HozoFocusTarget, hasAccessibilityFocusMover, moveAccessibilityFocus, setAccessibilityFocusMover, } from './accessibility-focus.native.ts';
|
|
2
|
+
export { type Drag1DOptions, useDrag1D } from './drag-1d.native.ts';
|
|
2
3
|
export type { Placement } from './floating-geometry.ts';
|
|
3
4
|
export { FloatingPositioner, type FloatingPositionerProps, type UseFloatingPositionOptions, useFloatingPosition, } from './floating-positioner.native.tsx';
|
|
4
5
|
export { type NativeContentProps, type NativeTriggerProps, type UseHoverTriggerOptions, type UseHoverTriggerReturn, useHoverTrigger, } from './hover-trigger.native.tsx';
|
|
6
|
+
export { fromI18next, fromReactIntl, type HozoI18n, HozoI18nProvider, type HozoI18nProviderProps, type HozoMessageKey, type HozoMessageParams, hozoMessages, type I18nextLike, type ReactIntlLike, useHozoI18n, useHozoMessage, } from './i18n.ts';
|
|
5
7
|
export { Portal, PortalHost, type PortalProps, PortalProvider } from './portal.native.tsx';
|
|
6
8
|
export { type PresenceBinding, type PresenceState, usePresence } from './presence.native.ts';
|
|
7
9
|
//# sourceMappingURL=native.d.ts.map
|
package/dist/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAA;AACxC,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,qBAAq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1
|
export { hasAccessibilityFocusMover, moveAccessibilityFocus, setAccessibilityFocusMover, } from './accessibility-focus.native.js';
|
|
2
|
+
export { useDrag1D } from './drag-1d.native.js';
|
|
2
3
|
export { FloatingPositioner, useFloatingPosition, } from './floating-positioner.native.js';
|
|
3
4
|
export { useHoverTrigger, } from './hover-trigger.native.js';
|
|
5
|
+
export { fromI18next, fromReactIntl, HozoI18nProvider, hozoMessages, useHozoI18n, useHozoMessage, } from './i18n.js';
|
|
4
6
|
export { Portal, PortalHost, PortalProvider } from './portal.native.js';
|
|
5
7
|
export { usePresence } from './presence.native.js';
|
|
6
8
|
//# sourceMappingURL=native.js.map
|
package/dist/native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAsB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEnE,OAAO,EACL,kBAAkB,EAGlB,mBAAmB,GACpB,MAAM,iCAAkC,CAAA;AACzC,OAAO,EAKL,eAAe,GAChB,MAAM,2BAA4B,CAAA;AACnC,OAAO,EACL,WAAW,EACX,aAAa,EAEb,gBAAgB,EAIhB,YAAY,EAGZ,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAoB,cAAc,EAAE,MAAM,oBAAqB,CAAA;AAC1F,OAAO,EAA4C,WAAW,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.native.d.ts","sourceRoot":"","sources":["../src/portal.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"portal.native.d.ts","sourceRoot":"","sources":["../src/portal.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAGd,MAAM,WAAW,WAAW;IAC1B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AASD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBAiCnE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EAAE,WAAW,GACnB,EAAE;IACD,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC9B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;;UAqBA;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,WAAW,4BAuBjE"}
|
package/dist/portal.native.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { createContext, useContext, useEffect, useId, useState } from 'react';
|
|
2
|
+
import React, { createContext, useContext, useEffect, useId, useMemo, useState, } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
const PortalContext = createContext(null);
|
|
5
5
|
/**
|
|
@@ -8,29 +8,31 @@ const PortalContext = createContext(null);
|
|
|
8
8
|
*/
|
|
9
9
|
export function PortalProvider({ children }) {
|
|
10
10
|
const [items, setItems] = useState(() => new Map());
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Portal effects depend on this API, not the item snapshot. Recreating it
|
|
12
|
+
// after a registration makes that effect unregister/register forever.
|
|
13
|
+
const methods = useMemo(() => {
|
|
14
|
+
const put = (id, node) => {
|
|
13
15
|
setItems((prev) => {
|
|
16
|
+
if (prev.has(id) && prev.get(id) === node)
|
|
17
|
+
return prev;
|
|
14
18
|
const next = new Map(prev);
|
|
15
19
|
next.set(id, node);
|
|
16
20
|
return next;
|
|
17
21
|
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
};
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
update: put,
|
|
25
|
+
unmount: (id) => {
|
|
26
|
+
setItems((prev) => {
|
|
27
|
+
if (!prev.has(id))
|
|
28
|
+
return prev;
|
|
29
|
+
const next = new Map(prev);
|
|
30
|
+
next.delete(id);
|
|
31
|
+
return next;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
34
36
|
return (_jsxs(PortalContext.Provider, { value: methods, children: [children, _jsx(PortalHost, { items: items })] }));
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
@@ -61,11 +63,12 @@ export function Portal({ children, disabled = false }) {
|
|
|
61
63
|
useEffect(() => {
|
|
62
64
|
if (disabled || !portal)
|
|
63
65
|
return;
|
|
64
|
-
|
|
66
|
+
// A changed child is an in-place item update, not an unregister/register:
|
|
67
|
+
// deleting/readding the same key would move it after unaffected siblings.
|
|
65
68
|
return () => {
|
|
66
69
|
portal.unmount(id);
|
|
67
70
|
};
|
|
68
|
-
}, [disabled, portal, id
|
|
71
|
+
}, [disabled, portal, id]);
|
|
69
72
|
useEffect(() => {
|
|
70
73
|
if (disabled || !portal)
|
|
71
74
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.native.js","sourceRoot":"","sources":["../src/portal.native.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"portal.native.js","sourceRoot":"","sources":["../src/portal.native.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAEb,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAuBnC,MAAM,aAAa,GAAG,aAAa,CAAuB,IAAI,CAAC,CAAA;AAE/D;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAA2B;IAClE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAyB,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;IAE3E,0EAA0E;IAC1E,sEAAsE;IACtE,MAAM,OAAO,GAAG,OAAO,CAAgB,GAAG,EAAE;QAC1C,MAAM,GAAG,GAA4B,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE;YAChD,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE;gBAChB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,IAAI;oBAAE,OAAO,IAAI,CAAA;gBACtD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAA;gBAC1B,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;gBAClB,OAAO,IAAI,CAAA;YACb,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA;QACD,OAAO;YACL,MAAM,EAAE,GAAG;YACX,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE;gBACd,QAAQ,CAAC,CAAC,IAAI,EAA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AW,CAAC;QAAC,aAAa,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAA;CACrF;
|
|
1
|
+
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE7C,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAA;IAChB,sCAAsC;IACtC,KAAK,EAAE,aAAa,CAAA;IACpB,gDAAgD;IAChD,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;IACnC,eAAe,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,aAAa,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAA;IACrF,cAAc,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,aAAa,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAA;CACrF;AAsCD,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,CAyD1D"}
|
package/dist/presence.js
CHANGED
|
@@ -36,7 +36,14 @@ function longest(durations, delays) {
|
|
|
36
36
|
/** How long the element's exit runs, from its computed style. */
|
|
37
37
|
function exitDuration(element) {
|
|
38
38
|
const style = getComputedStyle(element);
|
|
39
|
-
return Math.max(
|
|
39
|
+
return Math.max(
|
|
40
|
+
// `transition-none` -- and so `motion-reduce:transition-none` -- sets
|
|
41
|
+
// the property list to `none` and leaves the duration where the other
|
|
42
|
+
// classes put it. Nothing transitions then, and no `transitionend` will
|
|
43
|
+
// come to end the exit early.
|
|
44
|
+
style.transitionProperty === 'none'
|
|
45
|
+
? 0
|
|
46
|
+
: longest(style.transitionDuration, style.transitionDelay), style.animationName === 'none' ? 0 : longest(style.animationDuration, style.animationDelay));
|
|
40
47
|
}
|
|
41
48
|
export function usePresence(show) {
|
|
42
49
|
const [mounted, setMounted] = useState(show);
|
package/dist/presence.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,2BAA2B;AAC3B,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,0EAA0E;AAC1E,uEAAuE;AACvE,2DAA2D;AAC3D,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,oEAAoE;AACpE,oDAAoD;AAEpD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAehE,4EAA4E;AAC5E,MAAM,QAAQ,GAAG,GAAG,CAAA;AAEpB,6EAA6E;AAC7E,SAAS,OAAO,CAAC,SAAiB,EAAE,MAAc;IAChD,MAAM,EAAE,GAAG,CAAC,KAAa,EAAE,EAAE;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;YAAE,OAAO,CAAC,CAAA;QAClC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAA;IAC7D,CAAC,CAAA;IACD,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC9B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3B,gEAAgE;IAChE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAC3C,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM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AA;QACvB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;IAE3B,sEAAsE;IACtE,qEAAqE;IACrE,MAAM,KAAK,GAAG,WAAW,CACvB,CAAC,KAA0D,EAAE,EAAE;QAC7D,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa;YAAE,OAAM;QAChD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE;YAAE,OAAM;QAC3D,MAAM,EAAE,CAAA;IACV,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAA;IAED,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,IAAoB,EAAE,EAAE;QAC/C,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;IACxB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO;QACL,OAAO;QACP,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;QAC/B,GAAG;QACH,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,KAAK;KACtB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface HozoPressableInteractionState {
|
|
2
|
+
pressed: boolean;
|
|
3
|
+
hovered: boolean;
|
|
4
|
+
focused: boolean;
|
|
5
|
+
focusVisible: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The state a Native pressable shares with the Text inside it: a `HozoText`
|
|
9
|
+
* anywhere below reads it to apply its `hover:` and `active:` looks (#876).
|
|
10
|
+
* Here rather than in `@hozo/primitives` so `@hozo/patterns`' pressable
|
|
11
|
+
* provides the same one, and a Text a caller nests in a pattern reads it too
|
|
12
|
+
* (#974). `transition` is the primitive's own, for its colour motion.
|
|
13
|
+
*/
|
|
14
|
+
export declare const HozoInteractionContext: import("react").Context<(HozoPressableInteractionState & {
|
|
15
|
+
transition?: unknown;
|
|
16
|
+
}) | null>;
|
|
17
|
+
/**
|
|
18
|
+
* The Native pressable's event-driven facts, shared with patterns (#897).
|
|
19
|
+
* No subscriptions, animation nodes or global modality listeners. Hosts own
|
|
20
|
+
* event delivery and compose their caller's handlers after these callbacks.
|
|
21
|
+
* onChange runs synchronously for the existing native animation driver;
|
|
22
|
+
* React state drives the ordinary style/children callbacks.
|
|
23
|
+
*/
|
|
24
|
+
export declare function usePressableInteraction({ focusVisible, onChange, }?: {
|
|
25
|
+
/** Text fields indicate focus even after a pointer brings up their keyboard. */
|
|
26
|
+
focusVisible?: boolean | 'keyboard-input';
|
|
27
|
+
onChange?: (state: HozoPressableInteractionState) => void;
|
|
28
|
+
}): {
|
|
29
|
+
state: HozoPressableInteractionState;
|
|
30
|
+
handlers: {
|
|
31
|
+
hoverIn: () => void;
|
|
32
|
+
hoverOut: () => void;
|
|
33
|
+
focus: () => void;
|
|
34
|
+
blur: () => void;
|
|
35
|
+
pointerDown: () => void;
|
|
36
|
+
keyDown: () => void;
|
|
37
|
+
pressIn: () => void;
|
|
38
|
+
pressOut: () => void;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=pressable-interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressable-interaction.d.ts","sourceRoot":"","sources":["../src/pressable-interaction.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;iBACe,OAAO;UAClD,CAAA;AAaP;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,YAAoB,EACpB,QAAQ,GACT,GAAE;IACD,gFAAgF;IAChF,YAAY,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAA;IACzC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAA;CACrD;;;;;;;;;;;;EA8CL"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createContext, useCallback, useMemo, useRef, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The state a Native pressable shares with the Text inside it: a `HozoText`
|
|
4
|
+
* anywhere below reads it to apply its `hover:` and `active:` looks (#876).
|
|
5
|
+
* Here rather than in `@hozo/primitives` so `@hozo/patterns`' pressable
|
|
6
|
+
* provides the same one, and a Text a caller nests in a pattern reads it too
|
|
7
|
+
* (#974). `transition` is the primitive's own, for its colour motion.
|
|
8
|
+
*/
|
|
9
|
+
export const HozoInteractionContext = createContext(null);
|
|
10
|
+
const HOVERED = 1;
|
|
11
|
+
const FOCUSED = 2;
|
|
12
|
+
const PRESSED = 4;
|
|
13
|
+
const FOCUS_VISIBLE = 8;
|
|
14
|
+
const read = (mask) => ({
|
|
15
|
+
pressed: (mask & PRESSED) !== 0,
|
|
16
|
+
hovered: (mask & HOVERED) !== 0,
|
|
17
|
+
focused: (mask & FOCUSED) !== 0,
|
|
18
|
+
focusVisible: (mask & FOCUS_VISIBLE) !== 0,
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* The Native pressable's event-driven facts, shared with patterns (#897).
|
|
22
|
+
* No subscriptions, animation nodes or global modality listeners. Hosts own
|
|
23
|
+
* event delivery and compose their caller's handlers after these callbacks.
|
|
24
|
+
* onChange runs synchronously for the existing native animation driver;
|
|
25
|
+
* React state drives the ordinary style/children callbacks.
|
|
26
|
+
*/
|
|
27
|
+
export function usePressableInteraction({ focusVisible = false, onChange, } = {}) {
|
|
28
|
+
const [mask, setMask] = useState(0);
|
|
29
|
+
const live = useRef(0);
|
|
30
|
+
// Buttons use the existing modality policy: a pointer/press clears visible
|
|
31
|
+
// focus, a key restores it. Keyboard-input fields instead keep it until blur.
|
|
32
|
+
const modality = useRef('keyboard');
|
|
33
|
+
const set = useCallback((flag, active) => {
|
|
34
|
+
const next = active ? live.current | flag : live.current & ~flag;
|
|
35
|
+
live.current = next;
|
|
36
|
+
onChange?.(read(next));
|
|
37
|
+
setMask(next);
|
|
38
|
+
}, [onChange]);
|
|
39
|
+
const handlers = useMemo(() => ({
|
|
40
|
+
hoverIn: () => set(HOVERED, true),
|
|
41
|
+
hoverOut: () => set(HOVERED, false),
|
|
42
|
+
focus: () => {
|
|
43
|
+
set(FOCUSED, true);
|
|
44
|
+
if (focusVisible)
|
|
45
|
+
set(FOCUS_VISIBLE, focusVisible === 'keyboard-input' || modality.current === 'keyboard');
|
|
46
|
+
},
|
|
47
|
+
blur: () => {
|
|
48
|
+
set(FOCUSED, false);
|
|
49
|
+
if (focusVisible)
|
|
50
|
+
set(FOCUS_VISIBLE, false);
|
|
51
|
+
},
|
|
52
|
+
pointerDown: () => {
|
|
53
|
+
modality.current = 'pointer';
|
|
54
|
+
if (focusVisible === true)
|
|
55
|
+
set(FOCUS_VISIBLE, false);
|
|
56
|
+
},
|
|
57
|
+
keyDown: () => {
|
|
58
|
+
modality.current = 'keyboard';
|
|
59
|
+
if (focusVisible && (live.current & FOCUSED) !== 0)
|
|
60
|
+
set(FOCUS_VISIBLE, true);
|
|
61
|
+
},
|
|
62
|
+
pressIn: () => {
|
|
63
|
+
modality.current = 'pointer';
|
|
64
|
+
if (focusVisible === true)
|
|
65
|
+
set(FOCUS_VISIBLE, false);
|
|
66
|
+
set(PRESSED, true);
|
|
67
|
+
},
|
|
68
|
+
pressOut: () => set(PRESSED, false),
|
|
69
|
+
}), [focusVisible, set]);
|
|
70
|
+
return { state: useMemo(() => read(mask), [mask]), handlers };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=pressable-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressable-interaction.js","sourceRoot":"","sources":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AAE,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;YACpD,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACpB,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC;KACpC,CAAC,EACF,CAAC,YAAY,EAAE,GAAG,CAAC,CACpB,CAAA;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAA;AAC/D,CAAC"}
|
package/dist/text-child.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
/** Identity. See above, and `text-child.native.tsx` for the real one. */
|
|
3
|
-
export declare function hozoTextChildren(children: ReactNode): ReactNode;
|
|
3
|
+
export declare function hozoTextChildren(children: ReactNode, _style?: unknown): ReactNode;
|
|
4
4
|
//# sourceMappingURL=text-child.d.ts.map
|
package/dist/text-child.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-child.d.ts","sourceRoot":"","sources":["../src/text-child.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"text-child.d.ts","sourceRoot":"","sources":["../src/text-child.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAEjF"}
|
package/dist/text-child.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// matters for `@hozo/behaviors`'s own tests, which run through Node's type
|
|
12
12
|
// stripping and have no JSX transform.
|
|
13
13
|
/** Identity. See above, and `text-child.native.tsx` for the real one. */
|
|
14
|
-
export function hozoTextChildren(children) {
|
|
14
|
+
export function hozoTextChildren(children, _style) {
|
|
15
15
|
return children;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=text-child.js.map
|
package/dist/text-child.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-child.js","sourceRoot":"","sources":["../src/text-child.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,2EAA2E;AAC3E,gEAAgE;AAChE,0EAA0E;AAC1E,0EAA0E;AAC1E,wEAAwE;AACxE,kBAAkB;AAClB,EAAE;AACF,oEAAoE;AACpE,2EAA2E;AAC3E,uCAAuC;AAIvC,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,QAAmB;
|
|
1
|
+
{"version":3,"file":"text-child.js","sourceRoot":"","sources":["../src/text-child.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,2EAA2E;AAC3E,gEAAgE;AAChE,0EAA0E;AAC1E,0EAA0E;AAC1E,wEAAwE;AACxE,kBAAkB;AAClB,EAAE;AACF,oEAAoE;AACpE,2EAA2E;AAC3E,uCAAuC;AAIvC,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,QAAmB,EAAE,MAAgB;IACpE,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StyleProp, type TextStyle } from 'react-native';
|
|
2
3
|
/**
|
|
3
4
|
* Children with every text one inside a `Text`, and nothing else touched.
|
|
4
5
|
*
|
|
@@ -9,6 +10,11 @@ import { type ReactNode } from 'react';
|
|
|
9
10
|
*
|
|
10
11
|
* Numbers as well as strings. React renders both as text nodes, and React
|
|
11
12
|
* Native rejects both for the same reason.
|
|
13
|
+
*
|
|
14
|
+
* `style` is for a component whose box carries text classes -- a panel's
|
|
15
|
+
* colour, a tooltip's size -- which a `View` drops and the Web would have
|
|
16
|
+
* let its text inherit. A pattern that puts a caller's `ReactNode` into a
|
|
17
|
+
* `View` passes it through here, with the box's text half (#1205).
|
|
12
18
|
*/
|
|
13
|
-
export declare function hozoTextChildren(children: ReactNode): ReactNode;
|
|
19
|
+
export declare function hozoTextChildren(children: ReactNode, style?: StyleProp<TextStyle>): ReactNode;
|
|
14
20
|
//# sourceMappingURL=text-child.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-child.native.d.ts","sourceRoot":"","sources":["../src/text-child.native.tsx"],"names":[],"mappings":"AAyBA,OAAO,
|
|
1
|
+
{"version":3,"file":"text-child.native.d.ts","sourceRoot":"","sources":["../src/text-child.native.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAW7F"}
|
|
@@ -23,7 +23,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
23
23
|
// the expression is; this runs at render time, where the answer is
|
|
24
24
|
// simply available. A fallback being right about a case the compiler has
|
|
25
25
|
// to leave is not a divergence worth removing.
|
|
26
|
-
import { Children } from 'react';
|
|
26
|
+
import { Children, Fragment, isValidElement } from 'react';
|
|
27
27
|
import { Text } from 'react-native';
|
|
28
28
|
/**
|
|
29
29
|
* Children with every text one inside a `Text`, and nothing else touched.
|
|
@@ -35,8 +35,22 @@ import { Text } from 'react-native';
|
|
|
35
35
|
*
|
|
36
36
|
* Numbers as well as strings. React renders both as text nodes, and React
|
|
37
37
|
* Native rejects both for the same reason.
|
|
38
|
+
*
|
|
39
|
+
* `style` is for a component whose box carries text classes -- a panel's
|
|
40
|
+
* colour, a tooltip's size -- which a `View` drops and the Web would have
|
|
41
|
+
* let its text inherit. A pattern that puts a caller's `ReactNode` into a
|
|
42
|
+
* `View` passes it through here, with the box's text half (#1205).
|
|
38
43
|
*/
|
|
39
|
-
export function hozoTextChildren(children) {
|
|
40
|
-
return Children.map(children, (child) =>
|
|
44
|
+
export function hozoTextChildren(children, style) {
|
|
45
|
+
return Children.map(children, (child) => {
|
|
46
|
+
if (typeof child === 'string' || typeof child === 'number')
|
|
47
|
+
return _jsx(Text, { style: style, children: child });
|
|
48
|
+
// A Fragment is a transparent container, not a native text boundary.
|
|
49
|
+
// Preserve its key while normalizing its children; never inspect or
|
|
50
|
+
// execute arbitrary component elements to guess what they render.
|
|
51
|
+
if (isValidElement(child) && child.type === Fragment)
|
|
52
|
+
return _jsx(Fragment, { children: hozoTextChildren(child.props.children, style) }, child.key);
|
|
53
|
+
return child;
|
|
54
|
+
});
|
|
41
55
|
}
|
|
42
56
|
//# sourceMappingURL=text-child.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-child.native.js","sourceRoot":"","sources":["../src/text-child.native.tsx"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,sFAAsF;AACtF,EAAE;AACF,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,8BAA8B;AAC9B,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,qEAAqE;AACrE,qEAAqE;AACrE,0EAA0E;AAC1E,EAAE;AACF,qEAAqE;AACrE,0EAA0E;AAC1E,mEAAmE;AACnE,yEAAyE;AACzE,+CAA+C;AAE/C,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"text-child.native.js","source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4
|
-
"description": "
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Hozo's accessibility and internationalisation behaviours (FocusScope, RovingFocus, LiveRegion, Portal, DismissableLayer, FloatingPositioner), shared by Web and React Native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"behaviors",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"types": "./dist/native.d.ts",
|
|
41
41
|
"default": "./dist/native.js"
|
|
42
42
|
},
|
|
43
|
+
"./pressable-interaction": {
|
|
44
|
+
"types": "./dist/pressable-interaction.d.ts",
|
|
45
|
+
"default": "./dist/pressable-interaction.js"
|
|
46
|
+
},
|
|
43
47
|
"./package.json": "./package.json"
|
|
44
48
|
},
|
|
45
49
|
"files": [
|
|
@@ -58,7 +62,7 @@
|
|
|
58
62
|
"peerDependencies": {
|
|
59
63
|
"react": "^19.0.0",
|
|
60
64
|
"react-dom": "^19.0.0",
|
|
61
|
-
"react-native": ">=0.
|
|
65
|
+
"react-native": ">=0.87"
|
|
62
66
|
},
|
|
63
67
|
"peerDependenciesMeta": {
|
|
64
68
|
"react-dom": {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CommandShortcutOptions } from './command-shortcut.ts'
|
|
2
|
+
|
|
3
|
+
export type { CommandShortcutOptions }
|
|
4
|
+
|
|
5
|
+
export function isApplePlatform(): boolean {
|
|
6
|
+
return false
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Nothing on React Native: a phone has no ⌘K, and a hardware keyboard reaches
|
|
11
|
+
* an application through APIs React Native does not expose as one event. The
|
|
12
|
+
* palette is opened from a control the application draws. Kept as a hook so a
|
|
13
|
+
* screen written once calls it on both platforms.
|
|
14
|
+
*/
|
|
15
|
+
export function useCommandShortcut(_onTrigger: () => void, _options: CommandShortcutOptions = {}) {}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
|
|
3
|
+
export interface CommandShortcutOptions {
|
|
4
|
+
/** The letter, pressed with ⌘ on Apple platforms and Ctrl elsewhere; `k` by default. */
|
|
5
|
+
key?: string
|
|
6
|
+
/** Off while something else owns the keyboard. */
|
|
7
|
+
enabled?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** ⌘ on an Apple platform, Ctrl elsewhere -- the modifier each one's own shortcuts use. */
|
|
11
|
+
export function isApplePlatform(): boolean {
|
|
12
|
+
if (typeof navigator === 'undefined') return false
|
|
13
|
+
const platform =
|
|
14
|
+
(navigator as { userAgentData?: { platform?: string } }).userAgentData?.platform ??
|
|
15
|
+
navigator.platform ??
|
|
16
|
+
''
|
|
17
|
+
return /mac|iphone|ipad|ipod/i.test(platform)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Calls `onTrigger` for ⌘K on a Mac and Ctrl+K elsewhere, from anywhere on the
|
|
22
|
+
* page (#152).
|
|
23
|
+
*
|
|
24
|
+
* The browser's default is prevented only for the press that is handled:
|
|
25
|
+
* Ctrl+K is Chrome's "search from the address bar", and taking it away when
|
|
26
|
+
* nothing opens would be taking it for nothing. A press during IME
|
|
27
|
+
* composition is not a shortcut -- the composition owns the keyboard -- and
|
|
28
|
+
* neither is a held key repeating.
|
|
29
|
+
*
|
|
30
|
+
* A behaviour rather than part of `CommandPalette`, because a shortcut is
|
|
31
|
+
* useful without one: to focus a search field, or open a different panel.
|
|
32
|
+
*/
|
|
33
|
+
export function useCommandShortcut(onTrigger: () => void, options: CommandShortcutOptions = {}) {
|
|
34
|
+
const { key = 'k', enabled = true } = options
|
|
35
|
+
const latest = useRef(onTrigger)
|
|
36
|
+
latest.current = onTrigger
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!enabled || typeof document === 'undefined') return
|
|
39
|
+
const apple = isApplePlatform()
|
|
40
|
+
const handle = (event: KeyboardEvent) => {
|
|
41
|
+
if (event.isComposing || event.repeat) return
|
|
42
|
+
const modifier = apple ? event.metaKey && !event.ctrlKey : event.ctrlKey && !event.metaKey
|
|
43
|
+
if (!modifier || event.altKey || event.shiftKey) return
|
|
44
|
+
if (event.key.toLowerCase() !== key.toLowerCase()) return
|
|
45
|
+
event.preventDefault()
|
|
46
|
+
latest.current()
|
|
47
|
+
}
|
|
48
|
+
document.addEventListener('keydown', handle)
|
|
49
|
+
return () => document.removeEventListener('keydown', handle)
|
|
50
|
+
}, [enabled, key])
|
|
51
|
+
}
|