@plitzi/sdk-authoring 0.35.1 → 0.35.3

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 CHANGED
@@ -1,5 +1,54 @@
1
1
  # @plitzi/sdk-authoring
2
2
 
3
+ ## 0.35.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 0211dc4: A form speaks the site's language when it refuses a value.
8
+
9
+ - **Every rule of a `formControl` can say what it wants to say.** `requiredMessage`, `minLengthMessage`,
10
+ `maxLengthMessage` and `formatMessage` join `patternMessage` and `matchesMessage`; left empty, each falls back to
11
+ the English sentence it said before. `formatMessage` is said when the value does not have the shape the control's
12
+ type asks for — an address, for an `email` — one attribute for every type that has a shape. Offered in the builder under the rule they belong to.
13
+ - **A `form` can turn the browser's own checks off (`noValidate`, "Skip Browser Validation" in the builder).** Left on
14
+ — the default, as before — the browser answers first for a blank required field and a malformed address, in a
15
+ bubble no style reaches and in the browser's language, while every other rule answers under the control. Turned
16
+ on, the form's rules are the only ones, and all of them answer under the control.
17
+ - **An `email` control checks the address itself,** by the same definition the browser uses, so the format is still
18
+ asked for when the browser's checks are off.
19
+
20
+ ## 0.35.2
21
+
22
+ ### Minor Changes
23
+
24
+ - 470aaf8: A booking form can ask for a date, and a toggle can say it is one.
25
+
26
+ - **`formControl` accepts `subType: 'date'`.** It renders the browser's own date picker and submits `YYYY-MM-DD`, so
27
+ a flow or a server action reads one format whatever the visitor's locale. Until now a date was a free text field
28
+ and every form that needed one parsed whatever somebody typed. Offered in the builder's Input Type list.
29
+ - **`button` accepts `ariaExpanded` and `ariaPressed`.** A button that opens a menu or an answer, or one that stays on
30
+ like a filter, can tell assistive technology so — statically, or bound to the state it flips
31
+ (`bind: { ariaExpanded: 'state.menuOpen' }`). Left out, neither attribute is rendered: an ordinary button does not
32
+ claim to control anything.
33
+
34
+ - 470aaf8: The theme is a data source, and a binding reads every source its template names.
35
+
36
+ - **`theme` global source.** `GlobalSources` publishes `runtime.sources.theme` as `{ mode, resolved }` for the area
37
+ the space paints in. `resolved` is always `light` or `dark`, so `{{ theme.resolved }}` is what a URL or a `when`
38
+ rule wants — a dashboard asking the API for a thumbnail in the visitor's scheme, for one. The comments that promised
39
+ `{{ theme.resolved }}` through the app store's `theme` mirror were wrong: nothing a binding reads lives there.
40
+ - **A binding subscribes to the roots of its `twigTemplate`.** It used to get only the head of its `source`, so a
41
+ binding on `list_spaces.item.id` whose template also said `{{ theme.resolved }}` or `{{ state.scope }}` resolved the
42
+ second name to nothing, silently. The names are read off the parsed template (`templateRootNames`, exported from
43
+ `@plitzi/sdk-shared/helpers/twigWrapper`). A name that is not a source is left out of the map rather than set to
44
+ `undefined`, so `{{ source }}` and the variables lifted to the template's root are never shadowed.
45
+ - **Authoring.** `theme` joins `GLOBAL_SOURCES`: `bind: { src: 'theme.resolved' }` is accepted, and an element can no
46
+ longer be named `theme`.
47
+
48
+ ### Patch Changes
49
+
50
+ - v0.35.2
51
+
3
52
  ## 0.35.1
4
53
 
5
54
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -701,6 +701,8 @@ export declare const button: ElementFactory<Partial<{
701
701
  disabled?: boolean | undefined;
702
702
  subType?: "button" | "submit" | "reset" | undefined;
703
703
  contentPlacement?: "before" | "after" | undefined;
704
+ ariaExpanded?: boolean | undefined;
705
+ ariaPressed?: boolean | undefined;
704
706
  }>>;
705
707
 
706
708
  export declare const cancelServerAction: (params: {
@@ -1270,6 +1272,8 @@ declare const elementDeclarations: {
1270
1272
  disabled?: boolean | undefined;
1271
1273
  subType?: "button" | "submit" | "reset" | undefined;
1272
1274
  contentPlacement?: "before" | "after" | undefined;
1275
+ ariaExpanded?: boolean | undefined;
1276
+ ariaPressed?: boolean | undefined;
1273
1277
  }>>;
1274
1278
  readonly Container: {
1275
1279
  readonly type: "container";
@@ -1739,6 +1743,7 @@ declare const elementDeclarations: {
1739
1743
  readonly method: "get";
1740
1744
  readonly actionUrl: "";
1741
1745
  readonly managedByInteractions: false;
1746
+ readonly noValidate: false;
1742
1747
  readonly errors: {};
1743
1748
  readonly values: {};
1744
1749
  };
@@ -1786,6 +1791,7 @@ declare const elementDeclarations: {
1786
1791
  } & ElementAttributesBrand<Partial<{
1787
1792
  values: Record<string, unknown>;
1788
1793
  method: "get" | "post";
1794
+ noValidate: boolean;
1789
1795
  actionUrl: string;
1790
1796
  managedByInteractions: boolean;
1791
1797
  errors: Record<string, string>;
@@ -1803,8 +1809,12 @@ declare const elementDeclarations: {
1803
1809
  readonly disabled: false;
1804
1810
  readonly options: readonly [];
1805
1811
  readonly required: true;
1812
+ readonly requiredMessage: "";
1806
1813
  readonly minLength: 0;
1814
+ readonly minLengthMessage: "";
1807
1815
  readonly maxLength: 0;
1816
+ readonly maxLengthMessage: "";
1817
+ readonly formatMessage: "";
1808
1818
  readonly pattern: "";
1809
1819
  readonly patternMessage: "";
1810
1820
  readonly matches: "";
@@ -4343,6 +4353,7 @@ export declare const form: {
4343
4353
  (props?: ElementProps<Partial<{
4344
4354
  values: Record<string, unknown>;
4345
4355
  method: "get" | "post";
4356
+ noValidate: boolean;
4346
4357
  actionUrl: string;
4347
4358
  managedByInteractions: boolean;
4348
4359
  errors: Record<string, string>;
@@ -4350,6 +4361,7 @@ export declare const form: {
4350
4361
  (children: ElementSpec[], props?: ElementProps<Partial<{
4351
4362
  values: Record<string, unknown>;
4352
4363
  method: "get" | "post";
4364
+ noValidate: boolean;
4353
4365
  actionUrl: string;
4354
4366
  managedByInteractions: boolean;
4355
4367
  errors: Record<string, string>;
@@ -4369,7 +4381,7 @@ declare type FormControlAttributes = AuthorableAttributes<FormControlProps, 'val
4369
4381
  declare type FormControlProps = {
4370
4382
  ref: RefObject<HTMLElement>;
4371
4383
  className: string;
4372
- subType: 'text' | 'number' | 'email' | 'password' | 'time' | 'checkbox' | 'switch' | 'select' | 'textarea' | 'hidden';
4384
+ subType: 'text' | 'number' | 'email' | 'password' | 'date' | 'time' | 'checkbox' | 'switch' | 'select' | 'textarea' | 'hidden';
4373
4385
  name: string;
4374
4386
  label: string;
4375
4387
  placeholder: string;
@@ -4383,9 +4395,17 @@ declare type FormControlProps = {
4383
4395
  /**
4384
4396
  * The rules a value has to meet before the form submits, checked by the form at submit time and by the control when
4385
4397
  * it loses focus. `0` and `''` mean no rule. See `validateField` for what each one says when it is broken.
4398
+ *
4399
+ * Each `…Message` is the sentence shown under the control when that rule is broken, in the site's language; empty
4400
+ * falls back to an English one. `formatMessage` speaks for the shape the control's own type asks of its value — an
4401
+ * address, for an `email` — so it is one attribute however many types come to have a shape.
4386
4402
  */
4403
+ requiredMessage: string;
4387
4404
  minLength: number;
4405
+ minLengthMessage: string;
4388
4406
  maxLength: number;
4407
+ maxLengthMessage: string;
4408
+ formatMessage: string;
4389
4409
  pattern: string;
4390
4410
  patternMessage: string;
4391
4411
  /** The `name` of another control in the same form this one has to repeat — a password confirmation, typically. */
@@ -4428,6 +4448,8 @@ export declare const getUtility: (action: string) => BuiltinUtility | undefined;
4428
4448
  * `host` is the odd one: it carries whatever the application EMBEDDING the space handed it, so it is empty for a
4429
4449
  * space that IS the page. It is listed here because a space authored as an application SHELL binds to it, and a
4430
4450
  * validator that refused the name would make that impossible to write.
4451
+ *
4452
+ * `theme` is `{ mode, resolved }` — `resolved` is always `light` or `dark`, which is what a URL or a rule wants.
4431
4453
  */
4432
4454
  export declare const GLOBAL_SOURCES: string[];
4433
4455
 
package/dist/index.js CHANGED
@@ -850,6 +850,7 @@ var t$31 = e()({
850
850
  method: "get",
851
851
  actionUrl: "",
852
852
  managedByInteractions: !1,
853
+ noValidate: !1,
853
854
  errors: {},
854
855
  values: {}
855
856
  },
@@ -950,8 +951,12 @@ var a$7 = e()({
950
951
  disabled: !1,
951
952
  options: [],
952
953
  required: !0,
954
+ requiredMessage: "",
953
955
  minLength: 0,
956
+ minLengthMessage: "",
954
957
  maxLength: 0,
958
+ maxLengthMessage: "",
959
+ formatMessage: "",
955
960
  pattern: "",
956
961
  patternMessage: "",
957
962
  matches: "",
@@ -3583,13 +3588,16 @@ var didYouMean = (name, candidates) => {
3583
3588
  * `host` is the odd one: it carries whatever the application EMBEDDING the space handed it, so it is empty for a
3584
3589
  * space that IS the page. It is listed here because a space authored as an application SHELL binds to it, and a
3585
3590
  * validator that refused the name would make that impossible to write.
3591
+ *
3592
+ * `theme` is `{ mode, resolved }` — `resolved` is always `light` or `dark`, which is what a URL or a rule wants.
3586
3593
  */
3587
3594
  var GLOBAL_SOURCES = [
3588
3595
  "variables",
3589
3596
  "navigation",
3590
3597
  "auth",
3591
3598
  "state",
3592
- "host"
3599
+ "host",
3600
+ "theme"
3593
3601
  ];
3594
3602
  /**
3595
3603
  * Turns what an author wrote into the name the runtime resolves.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.35.1",
3
+ "version": "0.35.3",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist/index.js",
@@ -44,11 +44,11 @@
44
44
  "devDependencies": {
45
45
  "@microsoft/api-extractor": "^7.59.1",
46
46
  "@plitzi/plitzi-ui": "^1.6.21",
47
- "@plitzi/sdk-elements": "0.35.1",
48
- "@plitzi/sdk-interactions": "0.35.1",
49
- "@plitzi/sdk-schema": "0.35.1",
50
- "@plitzi/sdk-shared": "0.35.1",
51
- "@plitzi/sdk-style": "0.35.1",
47
+ "@plitzi/sdk-elements": "0.35.3",
48
+ "@plitzi/sdk-interactions": "0.35.3",
49
+ "@plitzi/sdk-schema": "0.35.3",
50
+ "@plitzi/sdk-shared": "0.35.3",
51
+ "@plitzi/sdk-style": "0.35.3",
52
52
  "@types/react": "^19.3.0",
53
53
  "eslint": "^9.39.5",
54
54
  "typescript": "^6.0.3",