@polycyphers/bim 0.1.8 → 0.2.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/README.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  Commercial React sketch-to-layout and BIM studio. One browser UI calls the canonical server engine; no architectural catalogue, geometry solver, exporter, provider key or machine credential ships in this npm package.
4
4
 
5
+ ## 0.2.0 — PlanLynq UX redesign (B items)
6
+
7
+ Every new behaviour is opt-in. With none of the new props, the studio behaves as in 0.1.8 (standalone header and home screen, wall-by-wall form, service error text, busy toast, light theme, `style.css` with inlined fonts). Strings and colours changed for everyone: the remaining hard-coded studio copy is now EN/DE/FR/AR, and the stylesheet resolves every colour through `--bim-*` tokens.
8
+
9
+ | Prop | Values (default first) | What it does |
10
+ |---|---|---|
11
+ | `chrome` | `'standalone'` \| `'host'` | `host`: no SDK header, language picker or home screen; never calls `history.pushState`; does not set `<html lang/dir>`; language only from the `language` prop. `/studio/` and `/verify*` open the studio. Signed-in account options sit in the studio controls. Also switches the defaults of `errorMessages`, `progress` and `layout` below. |
12
+ | `features` | `{sketchUpload, refine: 'on'\|'soon'\|'off'; billing: 'on'\|'off'}` | Per-feature switch. Missing keys fall back to the service config (`aiEnabled:false` → upload/reading and refine `soon`; `billingEnabled:false` → billing `off`), then to `on`. When sketch upload is not `on` no upload control and no AI acknowledgement is ever shown; `soon` shows a focusable `aria-disabled` "coming soon" line with a reason. |
13
+ | `measureFlow` | `'walls'` \| `'room'` | `room`: the "Your room" step — Rectangle W×D (default) / L-shape / Custom walls, live outline, right angles marked *estimated* (never sent as user-given), optional collapsed room wishes with `programme: null`, More options (view wall, ceiling height, country), "These are my measurements." + **Show layouts**. |
14
+ | `onError` | `(e: StudioError) => void` | Every service/transport failure: `{code, status, message, limit}`. |
15
+ | `onLimit` | `(code: string) => void` | Limit codes (HTTP 423, `guest_trial_limit`, `project_quota_exceeded`). When set, the studio shows no alert for them. |
16
+ | `errorMessages` | `'service'` \| `'localized'` (default under `chrome="host"`) | `localized`: translated text per error code, never a raw server title. |
17
+ | `theme` | `'light'` \| `'dark'` \| `'auto'` | Sets `data-bim-theme`. Drawings always stay on a light sheet. |
18
+ | `progress` | `'toast'` \| `'inline'` (default under `chrome="host"`) | `inline`: spinner and "Checking your layout…" inside the pressed primary button and a polite live region instead of the fixed toast. The workspace always has `aria-busy` while working. |
19
+ | `layout` | `'classic'` \| `'consumer'` (default under `chrome="host"`) | `consumer`: one Download panel (PDF / DXF / SVG / 3D model (IFC), each with its purpose, a reason when unavailable and the retention line), layout cards with thumbnails and "Compare side by side", a version timeline with Restore per row and a "Saved · vN" indicator, Refine folded into Layouts (typed `edgeLengths` edits through `/edits` when AI is off — never `/chat`), and "I already have a measured plan" as the existing-plan entry. |
20
+
21
+ Other changes: sign-in and content deletion are real modal dialogs (labelled, focus moved in and trapped, Escape closes, focus returns; Sign in / Create account / Verify email are tabs) and the debug "Verification destination" line is gone. Arabic numbers, prices and dates use Western digits. Existing-plan rooms can be picked by clicking corner chips; opening kinds and operations are translated. New types: `StudioChrome`, `StudioTheme`, `StudioFeatures`, `StudioFeatureState`, `MeasureFlow`, `StudioError`, `StudioErrorCode`.
22
+
23
+ **Stylesheets.** `@polycyphers/bim/style.css` is unchanged in role (fonts inlined as `data:`, 0.1.8-compatible). For a strict CSP use `@polycyphers/bim/studio.css` (no `@font-face`, no `data:` URLs) and either serve Geist yourself or import `@polycyphers/bim/fonts.css`, which loads the woff2 files shipped in `dist/fonts/`. The SDK renders no `style` attributes; engine SVG content is sanitized but may carry its own presentation attributes.
24
+
25
+ **Tokens.** Each `--bim-*` token falls back to the host token of the same name (`--bim-accent` → `--pl-accent`, `--bim-ink` → `--pl-ink`, …) and then to the 0.1.8 palette with an AA info colour (#2f6b5f). Hosts restyle by setting `--pl-*` (or `--bim-*`) tokens rather than overriding class names.
26
+
27
+ **Licence grants.** Browser grants are matched against the package version. A grant issued for `ver: "0.1.x"` does not license 0.2.0; issue `0.2.x` (or a wider pattern) before hosts upgrade.
28
+
29
+ **Host follow-up after publishing (PlanLynq `apps/vision-web`).** Bump the dependency to 0.2.0 and move the version guard (`BIM_PACKAGE_VERSION === '0.1.8'` in `StudioEntry.tsx`/`WorkspacePage.tsx`), the lockfile and the integrity tests together. Pass `chrome="host"`, `measureFlow="room"`, `features` (sketch upload and refine `soon`, billing `off` while payments and AI are off), `onLimit` (to show the host's limit banner) and optionally `theme`. Then delete the overrides these replace: A11 (header/pricing/billing hiding), A12 (upload entry points and the refine `nth-child(3)` rule), A14 (`initialInput` starter walls) and A15 (the 423 status wrapper), and re-check the rest of `studioSkin.css` against the new class names (`.download-panel`, `.saved-indicator`, `.feature-soon`, `.room-step`). Switch to `studio.css` + host-served fonts if a CSP ships.
30
+
5
31
  ## 0.1.8 release candidate
6
32
 
7
33
  Public hosts may provide `initialProjectId` using the exact project UUID allocated by their server. It seeds only the first public project, including pending manual saves, image-upload drafts and existing-plan preservation. The identifier must be a 32-character hexadecimal UUID. An invalid identifier stops creation; it never falls back to a different project. The seed remains available through an unsuccessful first attempt and is consumed after a real snapshot is adopted. Later new projects use new identifiers. Embedded hosts ignore this public-only preference.
@@ -1,11 +1,45 @@
1
1
  import type { Lang, ProjectInput } from './types';
2
2
  import './style.css';
3
+ import { type StudioError } from './studioErrors';
3
4
  import { type BimBrand } from './branding';
4
5
  export interface StudioState {
5
6
  busy: boolean;
6
7
  hasUnsavedChanges: boolean;
7
8
  }
9
+ /** `standalone` (default, 0.1.8 behaviour) renders the SDK header, language picker and marketing home screen.
10
+ * `host` renders only the studio: no header, no home screen, no history.pushState, no <html> lang/dir changes;
11
+ * the language comes from the `language` prop only. */
12
+ export type StudioChrome = 'standalone' | 'host';
13
+ /** `on` = 0.1.8 behaviour, `soon` = visible but disabled with a translated "coming soon" line, `off` = hidden. */
14
+ export type StudioFeatureState = 'on' | 'soon' | 'off';
15
+ /** Per-feature switches. Each falls back to the service config (`aiEnabled:false` turns sketch upload/reading and
16
+ * refine to `soon`; `billingEnabled:false` turns billing `off`), then to `on`. `sketchUpload` covers image upload
17
+ * and AI sketch reading together, because the service requires the AI-processing acknowledgement for any upload. */
18
+ export interface StudioFeatures {
19
+ sketchUpload?: StudioFeatureState;
20
+ refine?: StudioFeatureState;
21
+ billing?: 'on' | 'off';
22
+ }
23
+ /** `walls` (default, 0.1.8) is the wall-by-wall form with a required room programme. `room` is the "Your room" step:
24
+ * Rectangle W×D by default, L-shape, or Custom walls; right angles marked estimated; optional programme (null). */
25
+ export type MeasureFlow = 'walls' | 'room';
26
+ /** `light` (default, 0.1.8), `dark`, or `auto` (follows prefers-color-scheme). Drawings always stay on a light sheet. */
27
+ export type StudioTheme = 'light' | 'dark' | 'auto';
8
28
  export interface StudioProps {
29
+ theme?: StudioTheme;
30
+ /** `classic` (standalone default, 0.1.8) or `consumer` (chrome="host" default): one Download panel with per-format purposes, layout cards with thumbnails and compare, a version timeline. */
31
+ layout?: 'classic' | 'consumer';
32
+ /** `toast` (standalone default, 0.1.8) shows a fixed busy toast; `inline` (chrome="host" default) shows progress inside the pressed primary button plus a polite live region. The workspace always carries aria-busy while working. */
33
+ progress?: 'toast' | 'inline';
34
+ chrome?: StudioChrome;
35
+ features?: StudioFeatures;
36
+ measureFlow?: MeasureFlow;
37
+ /** Every service/transport failure, with a stable code and the text the studio would show. */
38
+ onError?: (error: StudioError) => void;
39
+ /** Called for limit codes (HTTP 423, guest_trial_limit, project_quota_exceeded). When set, the studio shows no alert for them. */
40
+ onLimit?: (code: string) => void;
41
+ /** `service` (default for standalone, 0.1.8) shows the service's problem text; `localized` (default for chrome="host") shows translated text per error code and never a raw server title. */
42
+ errorMessages?: 'service' | 'localized';
9
43
  enableExistingPlanReview?: boolean;
10
44
  onStateChange?: (state: StudioState) => void;
11
45
  language?: Lang;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { Lang } from './types';
3
+ type Props = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> & {
4
+ language: Lang;
5
+ /** The current value: a number (NaN/null/undefined shown empty) or the caller's own text state. */
6
+ value: number | string | null | undefined;
7
+ /** Receives the typed text normalized to a point decimal ("" when empty or invalid), exactly as a native number input reports it. */
8
+ onText: (text: string) => void;
9
+ };
10
+ /** Decimal field. EN/AR keep the native number input unchanged; DE/FR get a text field that accepts "3,2" (or "3.2") and reports "3.2".
11
+ * The decimal keypad is used only for non-negative fields (it has no minus sign on some phones). */
12
+ export declare function DecimalInput({ language, value, onText, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -1,7 +1,8 @@
1
1
  import type { PendingDraft, Snapshot } from './types';
2
2
  import type { Lang, Bundle } from './types';
3
3
  import { type PlanApi } from './digitizationTypes';
4
- export declare function DigitizationReview({ projectId, projectVersion, language, api, onState, onDownload, disabled, sourceObjectId, imageUrl, pendingDraft, persistPending, onPendingSaved, registerPendingSaver, loadSavedOnMount }: {
4
+ export declare function DigitizationReview({ projectId, projectVersion, language, api, onState, onDownload, disabled, sourceObjectId, imageUrl, pendingDraft, persistPending, onPendingSaved, registerPendingSaver, loadSavedOnMount, aiReading }: {
5
+ aiReading?: boolean;
5
6
  projectId: string;
6
7
  projectVersion: number;
7
8
  loadSavedOnMount?: boolean;
@@ -0,0 +1,26 @@
1
+ import type { Lang, ProjectInput } from './types';
2
+ import { type RoomShape } from './studioState';
3
+ type Edges = ProjectInput['footprint']['edges'];
4
+ /** Shape picker and dimension fields of the "Your room" step (B1). Custom hands back to the wall table. */
5
+ export declare function RoomShapeFields({ input, language, onEdges, onShape }: {
6
+ input: ProjectInput;
7
+ language: Lang;
8
+ onEdges: (edges: Edges) => void;
9
+ onShape: (shape: RoomShape) => void;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ /** Live outline; north is up. Drawn on a light sheet in every theme. */
12
+ export declare function RoomOutline({ input, language }: {
13
+ input: ProjectInput;
14
+ language: Lang;
15
+ }): import("react/jsx-runtime").JSX.Element;
16
+ /** B6: deterministic adjustments through the engine's typed /edits contract (edgeLengths). Never AI or chat. */
17
+ export declare function AdjustLengths({ input, language, busy, onApply }: {
18
+ input: ProjectInput;
19
+ language: Lang;
20
+ busy: boolean;
21
+ onApply: (edges: {
22
+ edgeId: string;
23
+ lengthM: number;
24
+ }[]) => void;
25
+ }): import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -14,7 +14,10 @@ interface Props {
14
14
  onRightChange: (version: number) => void;
15
15
  onCompare: () => void;
16
16
  onRestore: () => void;
17
+ /** Consumer layout (B9): a timeline with Restore on every earlier row. */
18
+ timeline?: boolean;
19
+ onRestoreVersion?: (version: number) => void;
17
20
  }
18
21
  /** Presentation only: all reads, comparison values and CAS restoration belong to the host API. */
19
- export declare function VersionHistory({ language: lang, version, busy, preview, open, versions, comparison, left, right, onToggle, onLeftChange, onRightChange, onCompare, onRestore }: Props): import("react/jsx-runtime").JSX.Element;
22
+ export declare function VersionHistory({ language: lang, version, busy, preview, open, versions, comparison, left, right, onToggle, onLeftChange, onRightChange, onCompare, onRestore, timeline, onRestoreVersion }: Props): import("react/jsx-runtime").JSX.Element;
20
23
  export {};
Binary file
@@ -0,0 +1,93 @@
1
+ Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://openfontlicense.org
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/dist/fonts.css ADDED
@@ -0,0 +1,2 @@
1
+ @font-face{font-family:Geist;src:url(./fonts/Geist-Regular.woff2) format("woff2");font-weight:400;font-display:swap}
2
+ @font-face{font-family:"Geist Mono";src:url(./fonts/GeistMono-Regular.woff2) format("woff2");font-weight:400;font-display:swap}