@wonderlandlabs-pixi-ux/box 1.2.3 → 1.2.6
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/dist/BoxTree.d.ts +3 -3
- package/dist/BoxTree.js +6 -6
- package/dist/BoxUx.d.ts +9 -9
- package/dist/BoxUx.js +9 -9
- package/dist/BoxUxBase.d.ts +1 -1
- package/dist/boxTreeRenderers.d.ts +1 -1
- package/dist/pixiEnvironment.d.ts +1 -0
- package/dist/pixiEnvironment.js +1 -1
- package/dist/sizeUtils.d.ts +2 -2
- package/dist/types.boxtree.d.ts +1 -1
- package/dist/types.boxtree.js +3 -3
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -2
- package/dist/utils.ux.d.ts +1 -1
- package/package.json +3 -2
- package/src/BoxTree.ts +7 -7
- package/src/BoxUx.ts +12 -12
- package/src/BoxUxBase.ts +1 -1
- package/src/boxTreeRenderers.ts +1 -1
- package/src/sizeUtils.ts +2 -2
- package/src/types.boxtree.ts +3 -3
- package/src/types.ts +2 -2
- package/src/utils.ux.ts +1 -1
- package/tsconfig.json +14 -6
- package/dist/Box.stories.d.ts +0 -15
- package/dist/Box.stories.js +0 -103
- package/dist/BoxLeafStore.d.ts +0 -7
- package/dist/BoxLeafStore.js +0 -9
- package/dist/BoxListStore.d.ts +0 -7
- package/dist/BoxListStore.js +0 -10
- package/dist/BoxRenderContentMap.d.ts +0 -26
- package/dist/BoxRenderContentMap.js +0 -97
- package/dist/BoxStore.d.ts +0 -56
- package/dist/BoxStore.js +0 -653
- package/dist/BoxTextStore.d.ts +0 -10
- package/dist/BoxTextStore.js +0 -6
- package/dist/BoxTreeRenderer.d.ts +0 -47
- package/dist/BoxTreeRenderer.js +0 -339
- package/dist/ProductCatalog.stories.d.ts +0 -10
- package/dist/ProductCatalog.stories.js +0 -221
- package/dist/_deprecated/Box.stories.d.ts +0 -15
- package/dist/_deprecated/Box.stories.js +0 -103
- package/dist/_deprecated/BoxLeafStore.d.ts +0 -7
- package/dist/_deprecated/BoxLeafStore.js +0 -9
- package/dist/_deprecated/BoxListStore.d.ts +0 -7
- package/dist/_deprecated/BoxListStore.js +0 -10
- package/dist/_deprecated/BoxStore.d.ts +0 -56
- package/dist/_deprecated/BoxStore.js +0 -654
- package/dist/_deprecated/BoxTextStore.d.ts +0 -10
- package/dist/_deprecated/BoxTextStore.js +0 -6
- package/dist/_deprecated/ProductCatalog.stories.d.ts +0 -10
- package/dist/_deprecated/ProductCatalog.stories.js +0 -222
- package/dist/_deprecated/types.d.ts +0 -564
- package/dist/_deprecated/types.js +0 -211
- package/dist/boxTreeUx.constants.d.ts +0 -5
- package/dist/boxTreeUx.constants.js +0 -5
- package/dist/boxTreeUx.utils.d.ts +0 -5
- package/dist/boxTreeUx.utils.js +0 -44
- package/dist/measurement.d.ts +0 -41
- package/dist/measurement.js +0 -52
- package/dist/types.boxtreeUx.d.ts +0 -29
- package/dist/types.boxtreeUx.js +0 -1
package/dist/BoxTree.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Forest, type StoreParams } from '@wonderlandlabs/forestry4';
|
|
2
2
|
import type { Application } from 'pixi.js';
|
|
3
|
-
import type { BoxTreeUxStyleManagerLike } from './types.ux';
|
|
4
|
-
import { type BoxContent, type BoxTreeConfig, type BoxTreeState, type Direction, type ResolvedArea, type ResolvedRect, type StyleName } from './types.boxtree';
|
|
5
|
-
export * from './types.boxtree';
|
|
3
|
+
import type { BoxTreeUxStyleManagerLike } from './types.ux.js';
|
|
4
|
+
import { type BoxContent, type BoxTreeConfig, type BoxTreeState, type Direction, type ResolvedArea, type ResolvedRect, type StyleName } from './types.boxtree.js';
|
|
5
|
+
export * from './types.boxtree.js';
|
|
6
6
|
type StyleQueryLike = {
|
|
7
7
|
nouns: string[];
|
|
8
8
|
states: string[];
|
package/dist/BoxTree.js
CHANGED
|
@@ -13,12 +13,12 @@ var _BoxTree_instances, _BoxTree_uxMapFn, _BoxTree_uxApplyToChildren, _BoxTree_u
|
|
|
13
13
|
import { Forest } from '@wonderlandlabs/forestry4';
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
import { distinctUntilChanged, map, skip } from 'rxjs';
|
|
16
|
-
import { AxisConstraintSchema, PxValueSchema } from './types';
|
|
17
|
-
import { applyAxisConstraints, resolveConstraintValuePx, resolveMeasurement } from './sizeUtils';
|
|
18
|
-
import { pathToString } from './pathUtils';
|
|
19
|
-
import { BoxUxPixi } from './BoxUx';
|
|
20
|
-
import { AlignInputSchema, AreaPivotInputSchema, BoxContentSchema, BoxAlignSchema, BoxAreaSchema, BoxTreeNodeConfigSchema, BoxTreeNodeStateSchema, BoxTreeStateSchema, } from './types.boxtree';
|
|
21
|
-
export * from './types.boxtree';
|
|
16
|
+
import { AxisConstraintSchema, PxValueSchema } from './types.js';
|
|
17
|
+
import { applyAxisConstraints, resolveConstraintValuePx, resolveMeasurement } from './sizeUtils.js';
|
|
18
|
+
import { pathToString } from './pathUtils.js';
|
|
19
|
+
import { BoxUxPixi } from './BoxUx.js';
|
|
20
|
+
import { AlignInputSchema, AreaPivotInputSchema, BoxContentSchema, BoxAlignSchema, BoxAreaSchema, BoxTreeNodeConfigSchema, BoxTreeNodeStateSchema, BoxTreeStateSchema, } from './types.boxtree.js';
|
|
21
|
+
export * from './types.boxtree.js';
|
|
22
22
|
const DEFAULT_BOX_UX_MAP_FN = (box) => new BoxUxPixi(box);
|
|
23
23
|
function zodMessage(error) {
|
|
24
24
|
if (error instanceof z.ZodError) {
|
package/dist/BoxUx.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import './pixiEnvironment';
|
|
1
|
+
import './pixiEnvironment.js';
|
|
2
2
|
import type { Application } from 'pixi.js';
|
|
3
3
|
import { Container, Graphics } from 'pixi.js';
|
|
4
|
-
import type { BoxRenderer, BoxTree } from './BoxTree';
|
|
5
|
-
import { BoxUxBase } from './BoxUxBase';
|
|
6
|
-
import { MapEnhanced } from './BoxUxContextMap';
|
|
7
|
-
import type { BoxTreeStyleMap, BoxTreeUxStyleManagerLike } from './types.ux';
|
|
8
|
-
export { BOX_UX_CONTENT_ORDER, BOX_UX_ORDER, BOX_UX_LAYER, BOX_RENDER_CONTENT_ORDER, getUxOrder, setUxOrder, } from './constants';
|
|
9
|
-
export { BACKGROUND_CONTAINER, BOX_UX_ENV, CHILD_CONTAINER, CONTENT_CONTAINER, OVERLAY_CONTAINER, ROOT_CONTAINER, STROKE_CONTAINER, } from './constants.ux';
|
|
10
|
-
export type { BoxTreeFillStyle, BoxTreeStrokeStyle, BoxTreeStyleMap, BoxTreeUxStyleManagerLike, } from './types.ux';
|
|
11
|
-
export { BoxUxBase } from './BoxUxBase';
|
|
4
|
+
import type { BoxRenderer, BoxTree } from './BoxTree.js';
|
|
5
|
+
import { BoxUxBase } from './BoxUxBase.js';
|
|
6
|
+
import { MapEnhanced } from './BoxUxContextMap.js';
|
|
7
|
+
import type { BoxTreeStyleMap, BoxTreeUxStyleManagerLike } from './types.ux.js';
|
|
8
|
+
export { BOX_UX_CONTENT_ORDER, BOX_UX_ORDER, BOX_UX_LAYER, BOX_RENDER_CONTENT_ORDER, getUxOrder, setUxOrder, } from './constants.js';
|
|
9
|
+
export { BACKGROUND_CONTAINER, BOX_UX_ENV, CHILD_CONTAINER, CONTENT_CONTAINER, OVERLAY_CONTAINER, ROOT_CONTAINER, STROKE_CONTAINER, } from './constants.ux.js';
|
|
10
|
+
export type { BoxTreeFillStyle, BoxTreeStrokeStyle, BoxTreeStyleMap, BoxTreeUxStyleManagerLike, } from './types.ux.js';
|
|
11
|
+
export { BoxUxBase } from './BoxUxBase.js';
|
|
12
12
|
/**
|
|
13
13
|
* Default BoxTree UX implementation for Pixi containers.
|
|
14
14
|
*
|
package/dist/BoxUx.js
CHANGED
|
@@ -10,16 +10,16 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _BoxUxPixi_instances, _BoxUxPixi_managedContentNode, _BoxUxPixi_managedContentKey, _BoxUxPixi_strokeGraphic, _BoxUxPixi_requireGraphicsLayer, _BoxUxPixi_requireContainerLayer, _BoxUxPixi_syncChildren, _BoxUxPixi_isRenderableContent, _BoxUxPixi_isContentEmpty, _BoxUxPixi_renderContentMap, _BoxUxPixi_clearManagedContent, _BoxUxPixi_syncNodeContent, _BoxUxPixi_renderBackground, _BoxUxPixi_destroyContent;
|
|
13
|
-
import './pixiEnvironment';
|
|
13
|
+
import './pixiEnvironment.js';
|
|
14
14
|
import { Container, Graphics, Sprite, Text, TextStyle } from 'pixi.js';
|
|
15
|
-
import { BoxUxBase } from './BoxUxBase';
|
|
16
|
-
import { MapEnhanced } from './BoxUxContextMap';
|
|
17
|
-
import { BOX_RENDER_CONTENT_ORDER, BOX_UX_LAYER, } from './constants';
|
|
18
|
-
import { BACKGROUND_CONTAINER, BOX_UX_ENV, CHILD_CONTAINER, CONTENT_CONTAINER, OVERLAY_CONTAINER, ROOT_CONTAINER, STROKE_CONTAINER, } from './constants.ux';
|
|
19
|
-
import { asColorNumber, asNonNegativeNumber, resolveStyleProp } from './utils.ux';
|
|
20
|
-
export { BOX_UX_CONTENT_ORDER, BOX_UX_ORDER, BOX_UX_LAYER, BOX_RENDER_CONTENT_ORDER, getUxOrder, setUxOrder, } from './constants';
|
|
21
|
-
export { BACKGROUND_CONTAINER, BOX_UX_ENV, CHILD_CONTAINER, CONTENT_CONTAINER, OVERLAY_CONTAINER, ROOT_CONTAINER, STROKE_CONTAINER, } from './constants.ux';
|
|
22
|
-
export { BoxUxBase } from './BoxUxBase';
|
|
15
|
+
import { BoxUxBase } from './BoxUxBase.js';
|
|
16
|
+
import { MapEnhanced } from './BoxUxContextMap.js';
|
|
17
|
+
import { BOX_RENDER_CONTENT_ORDER, BOX_UX_LAYER, } from './constants.js';
|
|
18
|
+
import { BACKGROUND_CONTAINER, BOX_UX_ENV, CHILD_CONTAINER, CONTENT_CONTAINER, OVERLAY_CONTAINER, ROOT_CONTAINER, STROKE_CONTAINER, } from './constants.ux.js';
|
|
19
|
+
import { asColorNumber, asNonNegativeNumber, resolveStyleProp } from './utils.ux.js';
|
|
20
|
+
export { BOX_UX_CONTENT_ORDER, BOX_UX_ORDER, BOX_UX_LAYER, BOX_RENDER_CONTENT_ORDER, getUxOrder, setUxOrder, } from './constants.js';
|
|
21
|
+
export { BACKGROUND_CONTAINER, BOX_UX_ENV, CHILD_CONTAINER, CONTENT_CONTAINER, OVERLAY_CONTAINER, ROOT_CONTAINER, STROKE_CONTAINER, } from './constants.ux.js';
|
|
22
|
+
export { BoxUxBase } from './BoxUxBase.js';
|
|
23
23
|
function isBoxUxPixi(value) {
|
|
24
24
|
if (!value || typeof value !== 'object') {
|
|
25
25
|
return false;
|
package/dist/BoxUxBase.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/pixiEnvironment.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Pixi touches `navigator` at module init time; provide a minimal shim in non-browser runtimes.
|
|
3
2
|
if (typeof globalThis.navigator === 'undefined') {
|
|
4
3
|
Object.defineProperty(globalThis, 'navigator', {
|
|
@@ -7,3 +6,4 @@ if (typeof globalThis.navigator === 'undefined') {
|
|
|
7
6
|
writable: true,
|
|
8
7
|
});
|
|
9
8
|
}
|
|
9
|
+
export {};
|
package/dist/sizeUtils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AXIS } from './constants';
|
|
2
|
-
import type { AxisConstraintLike, Measurement } from './types';
|
|
1
|
+
import { AXIS } from './constants.js';
|
|
2
|
+
import type { AxisConstraintLike, Measurement } from './types.js';
|
|
3
3
|
type AxisValue = (typeof AXIS)[keyof typeof AXIS];
|
|
4
4
|
export type ResolveMeasurementOptions = {
|
|
5
5
|
axis?: AxisValue;
|
package/dist/types.boxtree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type AxisConstraintLike, type Measurement } from './types';
|
|
2
|
+
import { type AxisConstraintLike, type Measurement } from './types.js';
|
|
3
3
|
export type BoxStyle = Record<string, unknown>;
|
|
4
4
|
export declare const AxisSchema: z.ZodEnum<{
|
|
5
5
|
x: "x";
|
package/dist/types.boxtree.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ALIGN_ENUM_ALIASES, ALIGN_ENUM_KEYWORDS, AXIS } from './constants';
|
|
3
|
-
import { dictToStringArray } from './enumUtils';
|
|
4
|
-
import { AxisConstraintSchema, MeasurementSchema, } from './types';
|
|
2
|
+
import { ALIGN_ENUM_ALIASES, ALIGN_ENUM_KEYWORDS, AXIS } from './constants.js';
|
|
3
|
+
import { dictToStringArray } from './enumUtils.js';
|
|
4
|
+
import { AxisConstraintSchema, MeasurementSchema, } from './types.js';
|
|
5
5
|
export const AxisSchema = z.enum(dictToStringArray(AXIS));
|
|
6
6
|
export const DirectionSchema = z.enum(['row', 'column']);
|
|
7
7
|
export const BoxContentTypeSchema = z.enum(['text', 'url', 'image']);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ALIGN, UNIT_BASIS } from './constants';
|
|
2
|
+
import { ALIGN, UNIT_BASIS } from './constants.js';
|
|
3
3
|
export type AlignLabel = keyof typeof ALIGN;
|
|
4
4
|
export type MeasurementModeLabel = keyof typeof UNIT_BASIS;
|
|
5
5
|
export declare const SizeModeSchema: z.ZodEnum<{
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { MEASUREMENT_ENUM_CANONICAL, MEASUREMENT_ENUM_INPUT, UNIT_BASIS, } from './constants';
|
|
3
|
-
import { dictToStringArray } from './enumUtils';
|
|
2
|
+
import { MEASUREMENT_ENUM_CANONICAL, MEASUREMENT_ENUM_INPUT, UNIT_BASIS, } from './constants.js';
|
|
3
|
+
import { dictToStringArray } from './enumUtils.js';
|
|
4
4
|
export const SizeModeSchema = z.enum(dictToStringArray(MEASUREMENT_ENUM_CANONICAL));
|
|
5
5
|
export const FractionalMeasurementModeSchema = z.literal(MEASUREMENT_ENUM_INPUT.FRACTION);
|
|
6
6
|
export const MeasurementInputModeSchema = z.enum(dictToStringArray(MEASUREMENT_ENUM_INPUT));
|
package/dist/utils.ux.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BoxTreeStyleMap, BoxTreeUxStyleManagerLike } from './types.ux';
|
|
1
|
+
import type { BoxTreeStyleMap, BoxTreeUxStyleManagerLike } from './types.ux.js';
|
|
2
2
|
export declare function asColorNumber(value: unknown): number | undefined;
|
|
3
3
|
export declare function asNonNegativeNumber(value: unknown): number | undefined;
|
|
4
4
|
export declare function styleMapEquals(a: BoxTreeStyleMap, b: BoxTreeStyleMap): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderlandlabs-pixi-ux/box",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Box component with size, padding, anchor, and content alignment for wonderlandlabs-pixi-ux",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -33,5 +33,6 @@
|
|
|
33
33
|
"type": "git",
|
|
34
34
|
"url": "git+https://github.com/wonderlandlabs-pixi-ux/wonderlandlabs-pixi-ux.git",
|
|
35
35
|
"directory": "packages/box"
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"type": "module"
|
|
37
38
|
}
|
package/src/BoxTree.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { Forest, type StoreParams } from '@wonderlandlabs/forestry4';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import type { Application, Ticker } from 'pixi.js';
|
|
4
4
|
import { distinctUntilChanged, map, skip, type Subscription } from 'rxjs';
|
|
5
|
-
import { AxisConstraintSchema, PxValueSchema, type PxValue } from './types';
|
|
6
|
-
import { applyAxisConstraints, resolveConstraintValuePx, resolveMeasurement } from './sizeUtils';
|
|
7
|
-
import { pathToString } from './pathUtils';
|
|
8
|
-
import { BoxUxPixi } from './BoxUx';
|
|
9
|
-
import type { BoxTreeUxStyleManagerLike } from './types.ux';
|
|
5
|
+
import { AxisConstraintSchema, PxValueSchema, type PxValue } from './types.js';
|
|
6
|
+
import { applyAxisConstraints, resolveConstraintValuePx, resolveMeasurement } from './sizeUtils.js';
|
|
7
|
+
import { pathToString } from './pathUtils.js';
|
|
8
|
+
import { BoxUxPixi } from './BoxUx.js';
|
|
9
|
+
import type { BoxTreeUxStyleManagerLike } from './types.ux.js';
|
|
10
10
|
import {
|
|
11
11
|
AlignInputSchema,
|
|
12
12
|
AreaPivotInputSchema,
|
|
@@ -29,9 +29,9 @@ import {
|
|
|
29
29
|
type ResolvedArea,
|
|
30
30
|
type ResolvedRect,
|
|
31
31
|
type StyleName,
|
|
32
|
-
} from './types.boxtree';
|
|
32
|
+
} from './types.boxtree.js';
|
|
33
33
|
|
|
34
|
-
export * from './types.boxtree';
|
|
34
|
+
export * from './types.boxtree.js';
|
|
35
35
|
|
|
36
36
|
type StyleQueryLike = {
|
|
37
37
|
nouns: string[];
|
package/src/BoxUx.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import './pixiEnvironment';
|
|
1
|
+
import './pixiEnvironment.js';
|
|
2
2
|
import type { Application } from 'pixi.js';
|
|
3
3
|
import { Container, Graphics, Sprite, Text, TextStyle } from 'pixi.js';
|
|
4
|
-
import type { BoxRenderer, BoxTree } from './BoxTree';
|
|
5
|
-
import { BoxUxBase } from './BoxUxBase';
|
|
6
|
-
import { MapEnhanced } from './BoxUxContextMap';
|
|
4
|
+
import type { BoxRenderer, BoxTree } from './BoxTree.js';
|
|
5
|
+
import { BoxUxBase } from './BoxUxBase.js';
|
|
6
|
+
import { MapEnhanced } from './BoxUxContextMap.js';
|
|
7
7
|
import {
|
|
8
8
|
BOX_RENDER_CONTENT_ORDER,
|
|
9
9
|
BOX_UX_CONTENT_ORDER,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
BOX_UX_ORDER,
|
|
12
12
|
getUxOrder,
|
|
13
13
|
setUxOrder,
|
|
14
|
-
} from './constants';
|
|
14
|
+
} from './constants.js';
|
|
15
15
|
import {
|
|
16
16
|
BACKGROUND_CONTAINER,
|
|
17
17
|
BOX_UX_ENV,
|
|
@@ -20,12 +20,12 @@ import {
|
|
|
20
20
|
OVERLAY_CONTAINER,
|
|
21
21
|
ROOT_CONTAINER,
|
|
22
22
|
STROKE_CONTAINER,
|
|
23
|
-
} from './constants.ux';
|
|
24
|
-
import { asColorNumber, asNonNegativeNumber, resolveStyleProp } from './utils.ux';
|
|
23
|
+
} from './constants.ux.js';
|
|
24
|
+
import { asColorNumber, asNonNegativeNumber, resolveStyleProp } from './utils.ux.js';
|
|
25
25
|
import type {
|
|
26
26
|
BoxTreeStyleMap,
|
|
27
27
|
BoxTreeUxStyleManagerLike,
|
|
28
|
-
} from './types.ux';
|
|
28
|
+
} from './types.ux.js';
|
|
29
29
|
|
|
30
30
|
export {
|
|
31
31
|
BOX_UX_CONTENT_ORDER,
|
|
@@ -34,7 +34,7 @@ export {
|
|
|
34
34
|
BOX_RENDER_CONTENT_ORDER,
|
|
35
35
|
getUxOrder,
|
|
36
36
|
setUxOrder,
|
|
37
|
-
} from './constants';
|
|
37
|
+
} from './constants.js';
|
|
38
38
|
export {
|
|
39
39
|
BACKGROUND_CONTAINER,
|
|
40
40
|
BOX_UX_ENV,
|
|
@@ -43,14 +43,14 @@ export {
|
|
|
43
43
|
OVERLAY_CONTAINER,
|
|
44
44
|
ROOT_CONTAINER,
|
|
45
45
|
STROKE_CONTAINER,
|
|
46
|
-
} from './constants.ux';
|
|
46
|
+
} from './constants.ux.js';
|
|
47
47
|
export type {
|
|
48
48
|
BoxTreeFillStyle,
|
|
49
49
|
BoxTreeStrokeStyle,
|
|
50
50
|
BoxTreeStyleMap,
|
|
51
51
|
BoxTreeUxStyleManagerLike,
|
|
52
|
-
} from './types.ux';
|
|
53
|
-
export { BoxUxBase } from './BoxUxBase';
|
|
52
|
+
} from './types.ux.js';
|
|
53
|
+
export { BoxUxBase } from './BoxUxBase.js';
|
|
54
54
|
|
|
55
55
|
function isBoxUxPixi(value: unknown): value is BoxUxPixi {
|
|
56
56
|
if (!value || typeof value !== 'object') {
|
package/src/BoxUxBase.ts
CHANGED
package/src/boxTreeRenderers.ts
CHANGED
package/src/sizeUtils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AXIS } from './constants';
|
|
2
|
-
import type { AxisConstraintLike, Measurement } from './types';
|
|
1
|
+
import { AXIS } from './constants.js';
|
|
2
|
+
import type { AxisConstraintLike, Measurement } from './types.js';
|
|
3
3
|
|
|
4
4
|
type AxisValue = (typeof AXIS)[keyof typeof AXIS];
|
|
5
5
|
|
package/src/types.boxtree.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ALIGN_ENUM_ALIASES, ALIGN_ENUM_KEYWORDS, AXIS } from './constants';
|
|
3
|
-
import { dictToStringArray } from './enumUtils';
|
|
2
|
+
import { ALIGN_ENUM_ALIASES, ALIGN_ENUM_KEYWORDS, AXIS } from './constants.js';
|
|
3
|
+
import { dictToStringArray } from './enumUtils.js';
|
|
4
4
|
import {
|
|
5
5
|
AxisConstraintSchema,
|
|
6
6
|
MeasurementSchema,
|
|
7
7
|
type AxisConstraintLike,
|
|
8
8
|
type Measurement,
|
|
9
|
-
} from './types';
|
|
9
|
+
} from './types.js';
|
|
10
10
|
|
|
11
11
|
export type BoxStyle = Record<string, unknown>;
|
|
12
12
|
|
package/src/types.ts
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
MEASUREMENT_ENUM_CANONICAL,
|
|
5
5
|
MEASUREMENT_ENUM_INPUT,
|
|
6
6
|
UNIT_BASIS,
|
|
7
|
-
} from './constants';
|
|
8
|
-
import { dictToStringArray } from './enumUtils';
|
|
7
|
+
} from './constants.js';
|
|
8
|
+
import { dictToStringArray } from './enumUtils.js';
|
|
9
9
|
|
|
10
10
|
export type AlignLabel = keyof typeof ALIGN;
|
|
11
11
|
export type MeasurementModeLabel = keyof typeof UNIT_BASIS;
|
package/src/utils.ux.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2020",
|
|
4
|
-
"module": "
|
|
5
|
-
"lib": [
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2020",
|
|
7
|
+
"DOM",
|
|
8
|
+
"DOM.Iterable"
|
|
9
|
+
],
|
|
6
10
|
"declaration": true,
|
|
7
11
|
"outDir": "./dist",
|
|
8
12
|
"rootDir": "./src",
|
|
9
13
|
"strict": true,
|
|
10
|
-
"moduleResolution": "
|
|
14
|
+
"moduleResolution": "NodeNext",
|
|
11
15
|
"esModuleInterop": true,
|
|
12
16
|
"skipLibCheck": true,
|
|
13
17
|
"forceConsistentCasingInFileNames": true,
|
|
14
18
|
"resolveJsonModule": true
|
|
15
19
|
},
|
|
16
|
-
"include": [
|
|
17
|
-
|
|
20
|
+
"include": [
|
|
21
|
+
"src"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist"
|
|
26
|
+
]
|
|
18
27
|
}
|
|
19
|
-
|
package/dist/Box.stories.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/html';
|
|
2
|
-
import type { Align } from './types';
|
|
3
|
-
interface BoxArgs {
|
|
4
|
-
padding: number;
|
|
5
|
-
alignX: Align;
|
|
6
|
-
alignY: Align;
|
|
7
|
-
boxWidth: number;
|
|
8
|
-
boxHeight: number;
|
|
9
|
-
contentWidth: number;
|
|
10
|
-
contentHeight: number;
|
|
11
|
-
}
|
|
12
|
-
declare const meta: Meta<BoxArgs>;
|
|
13
|
-
export default meta;
|
|
14
|
-
type Story = StoryObj<BoxArgs>;
|
|
15
|
-
export declare const AlignmentDemo: Story;
|
package/dist/Box.stories.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Application, Graphics } from 'pixi.js';
|
|
2
|
-
import { BoxLeafStore } from './BoxLeafStore';
|
|
3
|
-
const meta = {
|
|
4
|
-
title: 'Box/BoxLeafStore',
|
|
5
|
-
argTypes: {
|
|
6
|
-
padding: {
|
|
7
|
-
control: { type: 'range', min: 0, max: 50, step: 5 },
|
|
8
|
-
description: 'Uniform padding around content',
|
|
9
|
-
},
|
|
10
|
-
alignX: {
|
|
11
|
-
control: { type: 'select' },
|
|
12
|
-
options: ['start', 'center', 'end'],
|
|
13
|
-
description: 'Horizontal alignment of content',
|
|
14
|
-
},
|
|
15
|
-
alignY: {
|
|
16
|
-
control: { type: 'select' },
|
|
17
|
-
options: ['start', 'center', 'end'],
|
|
18
|
-
description: 'Vertical alignment of content',
|
|
19
|
-
},
|
|
20
|
-
boxWidth: {
|
|
21
|
-
control: { type: 'range', min: 100, max: 500, step: 10 },
|
|
22
|
-
description: 'Box width',
|
|
23
|
-
},
|
|
24
|
-
boxHeight: {
|
|
25
|
-
control: { type: 'range', min: 100, max: 400, step: 10 },
|
|
26
|
-
description: 'Box height',
|
|
27
|
-
},
|
|
28
|
-
contentWidth: {
|
|
29
|
-
control: { type: 'range', min: 20, max: 200, step: 10 },
|
|
30
|
-
description: 'Content box width',
|
|
31
|
-
},
|
|
32
|
-
contentHeight: {
|
|
33
|
-
control: { type: 'range', min: 20, max: 200, step: 10 },
|
|
34
|
-
description: 'Content box height',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
args: {
|
|
38
|
-
padding: 20,
|
|
39
|
-
alignX: 'center',
|
|
40
|
-
alignY: 'center',
|
|
41
|
-
boxWidth: 300,
|
|
42
|
-
boxHeight: 200,
|
|
43
|
-
contentWidth: 80,
|
|
44
|
-
contentHeight: 60,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
export default meta;
|
|
48
|
-
export const AlignmentDemo = {
|
|
49
|
-
render: (args) => {
|
|
50
|
-
const wrapper = document.createElement('div');
|
|
51
|
-
wrapper.style.width = '100%';
|
|
52
|
-
wrapper.style.height = '600px';
|
|
53
|
-
wrapper.style.position = 'relative';
|
|
54
|
-
let boxStore;
|
|
55
|
-
const app = new Application();
|
|
56
|
-
app.init({
|
|
57
|
-
width: 800,
|
|
58
|
-
height: 600,
|
|
59
|
-
backgroundColor: 0x1a1a2e,
|
|
60
|
-
antialias: true,
|
|
61
|
-
}).then(() => {
|
|
62
|
-
wrapper.appendChild(app.canvas);
|
|
63
|
-
// Create the box store with new config format
|
|
64
|
-
boxStore = new BoxLeafStore({
|
|
65
|
-
id: 'demo-box',
|
|
66
|
-
x: 250,
|
|
67
|
-
y: 200,
|
|
68
|
-
xDef: { size: args.boxWidth, align: args.alignX, sizeMode: 'px' },
|
|
69
|
-
yDef: { size: args.boxHeight, align: args.alignY, sizeMode: 'px' },
|
|
70
|
-
padding: {
|
|
71
|
-
top: args.padding,
|
|
72
|
-
right: args.padding,
|
|
73
|
-
bottom: args.padding,
|
|
74
|
-
left: args.padding,
|
|
75
|
-
},
|
|
76
|
-
style: {
|
|
77
|
-
fill: {
|
|
78
|
-
color: { r: 0.2, g: 0.3, b: 0.5 },
|
|
79
|
-
alpha: 1,
|
|
80
|
-
},
|
|
81
|
-
stroke: {
|
|
82
|
-
color: { r: 0.4, g: 0.5, b: 0.8 },
|
|
83
|
-
alpha: 1,
|
|
84
|
-
width: 2,
|
|
85
|
-
},
|
|
86
|
-
borderRadius: 8,
|
|
87
|
-
},
|
|
88
|
-
}, app);
|
|
89
|
-
// Create content graphics
|
|
90
|
-
const contentBox = new Graphics({ label: 'content-box' });
|
|
91
|
-
contentBox.roundRect(0, 0, args.contentWidth, args.contentHeight, 4);
|
|
92
|
-
contentBox.fill({ color: 0xff6b6b, alpha: 0.9 });
|
|
93
|
-
contentBox.stroke({ color: 0xffffff, alpha: 0.5, width: 1 });
|
|
94
|
-
// Set content on the leaf store
|
|
95
|
-
boxStore.setContent(contentBox);
|
|
96
|
-
// Add box to stage
|
|
97
|
-
app.stage.addChild(boxStore.container);
|
|
98
|
-
// Trigger initial render
|
|
99
|
-
boxStore.markDirty();
|
|
100
|
-
});
|
|
101
|
-
return wrapper;
|
|
102
|
-
},
|
|
103
|
-
};
|
package/dist/BoxLeafStore.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Application, type ContainerOptions, type Graphics, type Sprite, type Text, type Container } from 'pixi.js';
|
|
2
|
-
import { BoxStore } from './BoxStore';
|
|
3
|
-
import type { BaseBoxConfig, BoxProps } from './types';
|
|
4
|
-
export declare class BoxLeafStore extends BoxStore {
|
|
5
|
-
constructor(config: BaseBoxConfig, app: Application, boxProps?: BoxProps, rootProps?: ContainerOptions);
|
|
6
|
-
setContent(content: Graphics | Sprite | Text | Container | null): void;
|
|
7
|
-
}
|
package/dist/BoxLeafStore.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BoxStore } from './BoxStore';
|
|
2
|
-
export class BoxLeafStore extends BoxStore {
|
|
3
|
-
constructor(config, app, boxProps, rootProps) {
|
|
4
|
-
super({ ...config, kind: 'leaf' }, app, boxProps, rootProps);
|
|
5
|
-
}
|
|
6
|
-
setContent(content) {
|
|
7
|
-
super.setContent(content);
|
|
8
|
-
}
|
|
9
|
-
}
|
package/dist/BoxListStore.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Application, type ContainerOptions } from 'pixi.js';
|
|
2
|
-
import { BoxStore } from './BoxStore';
|
|
3
|
-
import type { BaseBoxConfig, BoxProps } from './types';
|
|
4
|
-
export declare class BoxListStore extends BoxStore {
|
|
5
|
-
constructor(config: BaseBoxConfig, app: Application, boxProps?: BoxProps, rootProps?: ContainerOptions);
|
|
6
|
-
addChild(child: BaseBoxConfig | BoxStore): BoxStore;
|
|
7
|
-
}
|
package/dist/BoxListStore.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BoxStore } from './BoxStore';
|
|
2
|
-
export class BoxListStore extends BoxStore {
|
|
3
|
-
constructor(config, app, boxProps, rootProps) {
|
|
4
|
-
super({ ...config, kind: 'list' }, app, boxProps, rootProps);
|
|
5
|
-
}
|
|
6
|
-
addChild(child) {
|
|
7
|
-
const nextConfig = child instanceof BoxStore ? child.toConfig() : child;
|
|
8
|
-
return super.addChild(nextConfig);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Container, Graphics } from 'pixi.js';
|
|
2
|
-
import type { BoxTree } from './BoxTree';
|
|
3
|
-
export declare const BOX_RENDER_CONTENT_ORDER: {
|
|
4
|
-
readonly BACKGROUND: 0;
|
|
5
|
-
readonly CHILDREN: 50;
|
|
6
|
-
readonly OVERLAY: 100;
|
|
7
|
-
};
|
|
8
|
-
type LayerContent = Container | Graphics;
|
|
9
|
-
type BoxRenderContentFactories = {
|
|
10
|
-
createBackgroundGraphic: () => Graphics;
|
|
11
|
-
createChildrenContainer: () => Container;
|
|
12
|
-
createOverlayContainer: () => Container;
|
|
13
|
-
createStrokeGraphic: () => Graphics;
|
|
14
|
-
};
|
|
15
|
-
export declare class BoxRenderContentMap extends Map<number, LayerContent> {
|
|
16
|
-
#private;
|
|
17
|
-
readonly $box: BoxTree;
|
|
18
|
-
constructor(box: BoxTree, factories: BoxRenderContentFactories);
|
|
19
|
-
$background(): Graphics;
|
|
20
|
-
$children(): Container;
|
|
21
|
-
$overlay(): Container;
|
|
22
|
-
$stroke(): Graphics;
|
|
23
|
-
$ensureDefaults(): void;
|
|
24
|
-
$render(parent: Container): void;
|
|
25
|
-
}
|
|
26
|
-
export {};
|