@things-factory/station 10.1.147 → 10.1.149
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-client/index.d.ts +1 -0
- package/dist-client/index.js +1 -0
- package/dist-client/index.js.map +1 -1
- package/dist-client/station/scene/scene-kit.d.ts +9 -0
- package/dist-client/station/scene/scene-kit.js +10 -0
- package/dist-client/station/scene/scene-kit.js.map +1 -0
- package/dist-client/station/scene/station-context-scene.d.ts +0 -11
- package/dist-client/station/scene/station-context-scene.js +0 -11
- package/dist-client/station/scene/station-context-scene.js.map +1 -1
- package/dist-client/station/station-refresh-policy.d.ts +17 -0
- package/dist-client/station/station-refresh-policy.js +18 -0
- package/dist-client/station/station-refresh-policy.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -9
package/dist-client/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './station/station-tile-registry.js';
|
|
2
2
|
export * from './station/station-palette.js';
|
|
3
|
+
export * from './station/station-refresh-policy.js';
|
|
3
4
|
export * from './station/station-board-binding.js';
|
|
4
5
|
export * from './station/station-context.js';
|
|
5
6
|
export * from './station/station-runtime.js';
|
package/dist-client/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './station/station-tile-registry.js';
|
|
2
2
|
export * from './station/station-palette.js';
|
|
3
|
+
export * from './station/station-refresh-policy.js';
|
|
3
4
|
export * from './station/station-board-binding.js';
|
|
4
5
|
export * from './station/station-context.js';
|
|
5
6
|
export * from './station/station-runtime.js';
|
package/dist-client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,0BAA0B,CAAA;AAExC;;;;;;;;;;;GAWG","sourcesContent":["export * from './station/station-tile-registry.js'\nexport * from './station/station-palette.js'\nexport * from './station/station-board-binding.js'\nexport * from './station/station-context.js'\nexport * from './station/station-runtime.js'\nexport * from './station/station-scene-context.js'\nexport * from './station/station-screen-flow.js'\nexport * from './station/station-work-runtime.js'\nexport * from './station/station-work-scenarios.js'\nexport * from './station/task-counts.js'\n\n/*\n * ── 씬 등록은 이 입구에 없다 (2026-09-24) ─────────────────────────────────────\n * 여기 `export * from './station/scene/index.js'` 가 있었다. 그러면 도우미 하나(`scenarioById` 같은)를 가져오는\n * 쪽마다 씬 여섯이 **부수효과로 등록되고** `@hatiolab/things-scene` 과 lit 이 통째로 따라왔다. operato-plant 의\n * 순수한 저작 검사가 이 입구를 부르자 그 시험이 things-scene 을 못 싣고 멈춰서 드러났다.\n *\n * 그려지게 하는 것은 **앱이 한 번, 드러나게** 부른다:\n *\n * import '@things-factory/station/dist-client/station/scene/index.js'\n *\n * 입구가 그것을 내보내지 않으므로 R1(정본 지정자) 의 「index 가 내보내지 않을 때만 안쪽 경로」에 맞는다.\n */\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,0BAA0B,CAAA;AAExC;;;;;;;;;;;GAWG","sourcesContent":["export * from './station/station-tile-registry.js'\nexport * from './station/station-palette.js'\nexport * from './station/station-refresh-policy.js'\nexport * from './station/station-board-binding.js'\nexport * from './station/station-context.js'\nexport * from './station/station-runtime.js'\nexport * from './station/station-scene-context.js'\nexport * from './station/station-screen-flow.js'\nexport * from './station/station-work-runtime.js'\nexport * from './station/station-work-scenarios.js'\nexport * from './station/task-counts.js'\n\n/*\n * ── 씬 등록은 이 입구에 없다 (2026-09-24) ─────────────────────────────────────\n * 여기 `export * from './station/scene/index.js'` 가 있었다. 그러면 도우미 하나(`scenarioById` 같은)를 가져오는\n * 쪽마다 씬 여섯이 **부수효과로 등록되고** `@hatiolab/things-scene` 과 lit 이 통째로 따라왔다. operato-plant 의\n * 순수한 저작 검사가 이 입구를 부르자 그 시험이 things-scene 을 못 싣고 멈춰서 드러났다.\n *\n * 그려지게 하는 것은 **앱이 한 번, 드러나게** 부른다:\n *\n * import '@things-factory/station/dist-client/station/scene/index.js'\n *\n * 입구가 그것을 내보내지 않으므로 R1(정본 지정자) 의 「index 가 내보내지 않을 때만 안쪽 경로」에 맞는다.\n */\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an application needs to draw its own station scenes: the base scene, the drawing style and the icons.
|
|
3
|
+
*
|
|
4
|
+
* Importing this registers no scene. The station's own scenes register through `@things-factory/station/scenes`,
|
|
5
|
+
* which an application imports once, where it means to.
|
|
6
|
+
*/
|
|
7
|
+
export * from './station-scene.js';
|
|
8
|
+
export * from './station-scene-style.js';
|
|
9
|
+
export * from './station-icons.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an application needs to draw its own station scenes: the base scene, the drawing style and the icons.
|
|
3
|
+
*
|
|
4
|
+
* Importing this registers no scene. The station's own scenes register through `@things-factory/station/scenes`,
|
|
5
|
+
* which an application imports once, where it means to.
|
|
6
|
+
*/
|
|
7
|
+
export * from './station-scene.js';
|
|
8
|
+
export * from './station-scene-style.js';
|
|
9
|
+
export * from './station-icons.js';
|
|
10
|
+
//# sourceMappingURL=scene-kit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-kit.js","sourceRoot":"","sources":["../../../client/station/scene/scene-kit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA","sourcesContent":["/**\n * What an application needs to draw its own station scenes: the base scene, the drawing style and the icons.\n *\n * Importing this registers no scene. The station's own scenes register through `@things-factory/station/scenes`,\n * which an application imports once, where it means to.\n */\nexport * from './station-scene.js'\nexport * from './station-scene-style.js'\nexport * from './station-icons.js'\n"]}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import { ComponentNature, ServiceComponent } from '@hatiolab/things-scene';
|
|
2
|
-
/** What the host reads off a board to decide how hard to keep it current. */
|
|
3
|
-
export interface StationRefreshPolicy {
|
|
4
|
-
everyMs?: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Read the policy straight off the board model, before the scene is built.
|
|
8
|
-
*
|
|
9
|
-
* The host needs it at open time and there are no components yet, so this looks at the JSON rather
|
|
10
|
-
* than at a live component.
|
|
11
|
-
*/
|
|
12
|
-
export declare function stationRefreshPolicyOf(model: any): StationRefreshPolicy;
|
|
13
2
|
export default class StationContextScene extends ServiceComponent {
|
|
14
3
|
get serviceName(): string;
|
|
15
4
|
/**
|
|
@@ -56,17 +56,6 @@ const NATURE = {
|
|
|
56
56
|
}
|
|
57
57
|
]
|
|
58
58
|
};
|
|
59
|
-
/**
|
|
60
|
-
* Read the policy straight off the board model, before the scene is built.
|
|
61
|
-
*
|
|
62
|
-
* The host needs it at open time and there are no components yet, so this looks at the JSON rather
|
|
63
|
-
* than at a live component.
|
|
64
|
-
*/
|
|
65
|
-
export function stationRefreshPolicyOf(model) {
|
|
66
|
-
const declared = (model?.components ?? []).find((component) => component?.type === 'station-context');
|
|
67
|
-
const seconds = Number(declared?.refreshSeconds);
|
|
68
|
-
return Number.isFinite(seconds) && seconds > 0 ? { everyMs: seconds * 1000 } : {};
|
|
69
|
-
}
|
|
70
59
|
/** What this component registers itself as, so a host can ask whether a board is a station screen. */
|
|
71
60
|
const DECLARATION_SERVICE = `${STATION_SERVICE}-declaration`;
|
|
72
61
|
let StationContextScene = class StationContextScene extends ServiceComponent {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"station-context-scene.js","sourceRoot":"","sources":["../../../client/station/scene/station-context-scene.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE;QACV;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,+BAA+B;YACtC,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,YAAY;SACvB;QACD;YACE;;;;;;eAMG;YACH,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,yBAAyB;YAChC,IAAI,EAAE,gBAAgB;YACtB,QAAQ,EAAE,gBAAgB;SAC3B;KACF;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"station-context-scene.js","sourceRoot":"","sources":["../../../client/station/scene/station-context-scene.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0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AEhD,IAAI,CAAC,GAAG,WAAW,IAAI,IAAI,GAAG,KAAK,GAAG,WAAW,EAAE,CAAC;gBAClD,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;YAC9B,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,YAAY,GAAG,YAAY,CAAA;QACnC,OAAO,CAAC,OAAO,EAAE,CAAA;IACnB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AA3EoB,mBAAmB;IADvC,cAAc,CAAC,iBAAiB,CAAC;GACb,mBAAmB,CA2EvC;eA3EoB,mBAAmB","sourcesContent":["import { ComponentNature, ServiceComponent, sceneComponent } from '@hatiolab/things-scene'\n\nimport { stationBindingNames } from '../station-board-binding'\nimport { STATION_COLOR } from './station-scene-style'\nimport { STATION_SERVICE } from '../station-scene-context'\n\n/**\n * On a board · **the data source the whole screen binds off.**\n *\n * ── What it is for ─────────────────────────────────────────────────────────\n * Values reach any component whose id is a context name, and structured branches reach any component\n * whose id is a branch name (`order`, `directive`, `route`, …). Both work, and both are invisible\n * while a board is being drawn — nothing on the property panel says such an id means anything, so an\n * author has to be told, and there are three dozen names.\n *\n * This lists them on the canvas while editing, and records in the board model that this board is a\n * station screen. It also carries the refresh policy, which the host reads off the model when it\n * opens the board.\n *\n * ── What is not here ───────────────────────────────────────────────────────\n * It is **not** where the context comes from. The page registers that when it opens the board,\n * present or not. Hanging the context off a component would mean a board drawn without one shows a\n * screenful of nothing, silently, and a shop-floor screen is the last place that can happen.\n *\n * ── Times in `data` are raw ────────────────────────────────────────────────\n * The object here is the snapshot, so `task.since` is milliseconds. Words come from the label doors\n * (`station-field`, or an id binding), which run through the app's own time formatting. A board that\n * wants a readable time takes it from there, not by formatting one here.\n *\n * ── Invisible to the operator ──────────────────────────────────────────────\n * `ServiceComponent` draws an icon in edit mode and nothing in view mode. The author sees it, the\n * floor does not.\n */\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: false,\n properties: [\n {\n type: 'checkbox',\n label: 'list the fields while editing',\n name: 'showFields',\n property: 'showFields'\n },\n {\n /*\n * How often to re-read, in seconds. Empty means only when this tablet does something.\n *\n * A policy and not a subscription: the clock belongs to the screen, one for the whole board.\n * Per-component it would be one timer per label, and deleting the wrong box would stop the\n * screen updating with nothing to say so.\n */\n type: 'number',\n label: 'refresh every (seconds)',\n name: 'refreshSeconds',\n property: 'refreshSeconds'\n }\n ]\n}\n\n/** What this component registers itself as, so a host can ask whether a board is a station screen. */\nconst DECLARATION_SERVICE = `${STATION_SERVICE}-declaration`\n\n@sceneComponent('station-context')\nexport default class StationContextScene extends ServiceComponent {\n get serviceName() {\n return DECLARATION_SERVICE\n }\n\n /**\n * ── Why this is not a data source ────────────────────────────────────────\n * It published the whole context for a while, so a board could bind through `#station-context`.\n * That door was **redundant and broken**: redundant because the host already pushes `scene.data`\n * keyed by component id, so naming a component `directive` hands it the directive and the standard\n * mapping editor takes it from there; broken because a `ServiceComponent` draws nothing in view\n * mode, so its `render` never ran, so nothing ever claimed the name or published anything.\n *\n * Two ways to do one thing, and the second one silently did nothing. Removed rather than repaired\n * — the door that works is the framework's own.\n */\n\n render(context: CanvasRenderingContext2D) {\n /* View mode draws the icon and nothing else — the base already returns early there. */\n super.render(context as any)\n\n const state: any = this.state\n\n if ((this as any).app?.isViewMode || !state.showFields) {\n return\n }\n\n const { left, top, width, height } = state\n const names = stationBindingNames()\n\n context.save()\n context.beginPath()\n context.rect(left, top, width, height)\n context.clip()\n\n context.fillStyle = STATION_COLOR.paper\n context.globalAlpha = 0.92\n context.fill()\n context.globalAlpha = 1\n context.strokeStyle = STATION_COLOR.action\n context.stroke()\n\n context.textBaseline = 'top'\n context.textAlign = 'left'\n context.fillStyle = STATION_COLOR.action\n context.font = 'bold 11px sans-serif'\n context.fillText('station context — put one of these in a component id', left + 8, top + 8)\n\n /*\n * Down the columns, as many as fit. Truncating is fine and paging is not worth it — the point is\n * that the names exist and roughly what they look like, not to be a reference card.\n */\n const lineHeight = 13\n const rows = Math.max(1, Math.floor((height - 30) / lineHeight))\n const columnWidth = 130\n\n context.font = '10px sans-serif'\n context.fillStyle = STATION_COLOR.ink\n\n names.forEach((name, index) => {\n const x = left + 8 + Math.floor(index / rows) * columnWidth\n const y = top + 26 + (index % rows) * lineHeight\n\n if (x + columnWidth <= left + width + columnWidth) {\n context.fillText(name, x, y)\n }\n })\n\n context.textBaseline = 'alphabetic'\n context.restore()\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How hard a host keeps a station board current — read off the board model.
|
|
3
|
+
*
|
|
4
|
+
* The board declares it on its `station-context` component (`refreshSeconds`). This reader sits apart from that
|
|
5
|
+
* component so a host can ask without registering any scene.
|
|
6
|
+
*/
|
|
7
|
+
/** What the host reads off a board to decide how hard to keep it current. */
|
|
8
|
+
export interface StationRefreshPolicy {
|
|
9
|
+
everyMs?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Read the policy straight off the board model, before the scene is built.
|
|
13
|
+
*
|
|
14
|
+
* The host needs it at open time and there are no components yet, so this looks at the JSON rather
|
|
15
|
+
* than at a live component.
|
|
16
|
+
*/
|
|
17
|
+
export declare function stationRefreshPolicyOf(model: any): StationRefreshPolicy;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How hard a host keeps a station board current — read off the board model.
|
|
3
|
+
*
|
|
4
|
+
* The board declares it on its `station-context` component (`refreshSeconds`). This reader sits apart from that
|
|
5
|
+
* component so a host can ask without registering any scene.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Read the policy straight off the board model, before the scene is built.
|
|
9
|
+
*
|
|
10
|
+
* The host needs it at open time and there are no components yet, so this looks at the JSON rather
|
|
11
|
+
* than at a live component.
|
|
12
|
+
*/
|
|
13
|
+
export function stationRefreshPolicyOf(model) {
|
|
14
|
+
const declared = (model?.components ?? []).find((component) => component?.type === 'station-context');
|
|
15
|
+
const seconds = Number(declared?.refreshSeconds);
|
|
16
|
+
return Number.isFinite(seconds) && seconds > 0 ? { everyMs: seconds * 1000 } : {};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=station-refresh-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"station-refresh-policy.js","sourceRoot":"","sources":["../../client/station/station-refresh-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAU;IAC/C,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAc,EAAE,EAAE,CAAC,SAAS,EAAE,IAAI,KAAK,iBAAiB,CAAC,CAAA;IAC1G,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;IAEhD,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACnF,CAAC","sourcesContent":["/**\n * How hard a host keeps a station board current — read off the board model.\n *\n * The board declares it on its `station-context` component (`refreshSeconds`). This reader sits apart from that\n * component so a host can ask without registering any scene.\n */\n\n/** What the host reads off a board to decide how hard to keep it current. */\nexport interface StationRefreshPolicy {\n everyMs?: number\n}\n\n/**\n * Read the policy straight off the board model, before the scene is built.\n *\n * The host needs it at open time and there are no components yet, so this looks at the JSON rather\n * than at a live component.\n */\nexport function stationRefreshPolicyOf(model: any): StationRefreshPolicy {\n const declared = (model?.components ?? []).find((component: any) => component?.type === 'station-context')\n const seconds = Number(declared?.refreshSeconds)\n\n return Number.isFinite(seconds) && seconds > 0 ? { everyMs: seconds * 1000 } : {}\n}\n"]}
|